Re: Threads in linux.

Nathan Hand (nathanh@chirp.com.au)
Wed, 18 Aug 1999 13:19:45 +1000


On Tue, Aug 17, 1999 at 01:53:21PM -0400, Stephen Frost wrote:
> On Tue, 17 Aug 1999, Carlos Costa Portela wrote:
>
> > Hello all!
> >
> > This morning I went to a work-interview. Unfortunately, in that company
> > they use WinNT. But, well, they had a good opinion about linux, blah,
> > blah, blah...
> >
> > But the director says me that linux doesn't implement threads, is this
> > true?. He said that threads in linux are implemented by a library, not at
> > kernel-level.
> >
> > If you can give me more info, please let me know.
>
> From my understanding, most of the threading work is implemented in
> either glibc2 or linux-threads, w/ some kernel-level hooks (clone() I think?).

No, Linux 2.x implements threads entirely in the kernel. The userspace
library merely provides a POSIX API to the kernel interface (clone).

> Now, from my experiance linux handles threads pretty nicely, and from
> what I've seen according to POSIX semantics to boot. Linux, and unix, already
> handles multiple processes at a time, so the idea is, what's a thread but
> another process? (I know I'm going to get flamed for this by SOMEONE), so
> that's the way Linux handles it. Two threads in a running program are just
> simply two processes that share some info, similar to fork'ed processes, but
> not quite. ;)
>
> Anyhow, that's how I understand it, and I've yet to run into any
> problems or drawbacks in the linux thread implementation compared to other
> OS's (Solaris being one, NT another) that have threads at 'kernel-level'.

Linux's implementation is by far the most elegant.

-- 
Nathan Hand - Chirp Web Design - http://www.chirp.com.au/ - $e^{i\pi}+1 = 0$
Phone: +61 2 6230 1871   Fax: +61 2 6230 1515   E-mail: nathanh@chirp.com.au

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/