Re: Threads in linux.

Alex Belits (abelits@phobos.illtel.denver.co.us)
Tue, 17 Aug 1999 08:59:32 -0700 (PDT)


On Tue, 17 Aug 1999, Peter Liniker wrote:

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

This is exactly the same thing -- context switching time depends on what
is shared, so if you made threads with clone(2), they behave like threads,
and they look like any other threads through library interface (one *has*
to have a library interface to threads). The only difference is how they
are numbered in the system.

"Library-only" implementation of threads means that threads are
implemented in userspace in single process without any explicit support
from scheduler and resources management -- this kind of implementation
doesn't take advantage of SMP and can block process on anything blocking
that happens in any of its thread.

-- 
Alex

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