Zombie Threads (?)

James J. Besemer jb at cascade-sys.com
Sat May 4 19:56:21 EDT 2002


Simon Foster wrote:

> PS doesn't show threads, only processes.

Not true.  On my Linux system I was rather surprised to discover a seperate
proc entry for each thread.  Upon further reflection, it make perfect sense,
as threads need to distinguish many of the same kernel resources as procs
(registers, stack, pri, nice, wchan, stat, etc.).  Only difference is threads
all share a few key resources (address space, file handles, etc.) with
others.

On Linux, threads even have distinct PIDs, which may be a partial answer to
the earlier post about killing threads (though pitfalls likely remain).

This all is true threads, not the simulated ones Python implements on systems
that don't provide them in the OS.  Linux creates threads with the clone(2)
system call, very similar to fork(2) except with additional args.

> You've got zombie processes not
> threads.
> All threads run in the same process, that's why they're threads not
> processes, or am
> I missing something?

No.  You are right about this part.

Turns out I mistakenly confused some true zombie procs for zombie threads.

Then too, according to the Linux doc, threads return an integer result when
they exit and I don't know how this gets passed back to the parent.  I'm
guessing it's via wait(2), same as for a process, though the man page on wait
doesn't say that.  But if that's the mechanism then there may still be such
thing as a zombie thread, though it wasn't part of my original problem.

Thanks for taking the time to reply.

Regards

--jb

--
James J. Besemer  503-280-0838 voice
http://cascade-sys.com  503-280-0375 fax
mailto:jb at cascade-sys.com







More information about the Python-list mailing list