Re: Threads in linux.

H. Peter Anvin (hpa@transmeta.com)
17 Aug 1999 16:09:37 GMT


Followup to: <Pine.LNX.4.10.9908171457060.11053-100000@visual19.doc.ic.ac.uk>
By author: Peter Liniker <pl198@doc.ic.ac.uk>
In newsgroup: linux.dev.kernel
>
> >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.
>
> Linux does not have kernel-level threads, this is true. There is a
> 'clone()' kernel call which can be used to implement threads in user
> space in a library (e.g. libpthreads with glibc2). This threading is as
> good as the windows threading in my experience.
>

Baloney. clone() *IS* kernel-level threading. The library is just
there to provide another API (the posix threads API). libpthreads
under Linux does have some problems (mostly because the POSIX thread
semantics were chosen by an "equally broken for everyone" algorithm),
but saying Linux doesn't have kernel-level threads is complete crap.

>
> Reason for this implementation is that Linux context-switches are very
> fast, so it made more sense to keep the context-switching code than
> re-write it as a 2 level process model for processes and threads.
>

Linux doesn't have (nor does it need) a two-level scheduler, but
that's not the same thing.

-hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!

- 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/