exec(threads)

sismex01 at hebmex.com sismex01 at hebmex.com
Mon Oct 7 16:29:17 EDT 2002


> From: JS [mailto:scjuonline at web.de]
> 
> > So when you said "no processes are created" you meant "I don't get
> > threads"? 
> 
> "No Processes" means, I get threads. (as expected)
> 
> >I'm not sure what the problem is yet, so can't yet do much to
> > help you solve it! Although you posted the code you didn't 
> > say how it failed to run on which platforms. Your original
> > post said you saw five new processes created on Linux, and
> > you then imply that the problem lies with Linux. Is this
> > actually the case or am I misunderstanding?
> 
> The code I posted was just a dirty testing hack.
> This code shows, that 5 processes are created under linux.
> Or at least I think so. But if a 'ps' gives me 
> 
>  PID TTY          TIME CMD
> ...
>  2543 pts/9    00:00:00 go.py
>  2544 pts/9    00:00:00 go.py
>  2545 pts/9    00:00:00 go.py
>  2546 pts/9    00:00:00 go.py
>  2547 pts/9    00:00:00 go.py
> 
> they should be processes, right?
> 
> What is used if I call start_new_thread()?
> Is it a user-level library? If yes, which one?
> 
> thx, J
>

OK, LinuxKernel 101.

Yes, they're "processes", and they're "threads" also.

In other OSs, threads and processes are completely different
beasts, created in differring manner, and sometimes (remember
AmigaOS y'all?) incompatible with each other. Sux.

On linux, threads and processes are the same beasty with
a different flavor and color. Both are created with syscall clone()
only with differring options, to create either what effectively
is a process (with it's accompanying semantics) or a thread
(with *it's* respective semantics). The "downside" is that
both appear in ps's output as the same thing; a threading program
appears the same as a forking program.

Hope this helps.

-gustavo













More information about the Python-list mailing list