Python thread

George mydevgroup at gmail.com
Thu Sep 1 18:08:01 EDT 2011


So what exactly does threading module do, if it doesn't create a subprocess.
Does each thread have its own stack and PC.
What advantage would a threading module provide over sequential execution.


On 01/09/2011 22:54, "Terry Reedy" <tjreedy at udel.edu> wrote:

> On 9/1/2011 5:14 PM, George wrote:
>> Hi,
>> Why doesn't python threads show an associated PID?  On spawning python
>> threads using the threading module I can only see the main thread's pid on
>> using top or ps unix command, no  subprocesses are displayed. In otherwords
>> top or ps in not aware of any subprocesses created using threading module in
>> python.
> 
> Perhaps because threads are not subprocesses?
> 
>> Whereas in Java , creating threads will result in separate pid , these
>> subprocesses can be listed using top or ps. Java threads get mapped to the
>> cores in the system.
>> 
>> Does it mean that python threads are not mapped to the core in the system.
> 
> They all run on the same core.
> 
>> On using multiprocessing module, separate processes are created with unique
>> PID.
> 
> That is why multiprocessing was added.
> 





More information about the Python-list mailing list