On Mon, 14 Jun 1999, Joe wrote:

> hmmmm
> > 
> > 
> > I don't follow.  Linux _only_ has kernel-mode threads.  Each
> > thread is a
> > unique process with its own PID and context.  Linux is just
> > real slick
> > on doing the fork() by using the copy-on-write page-sharing
> > trick...
> > 
> 
>    apparently you can implement user mode threads in Linux too,
> and that is what Netscape uses ... (this I am told)
> 
>    so is there any way to tell that a thread is a thread and not
> a child process or just a forked process in Linux? Other than
> looking at the source code? ie -> does the task_struct keep this
> info?


I supposed you _can_ do whatever you want... IE a single kernel
thread _can_ be used to execute different user threads.  But this
would have to be written by the user, since the normal posix threads
doesn't behave this way.  Nor do I see why anyone would really want it
to behave this way.  If the threads block, they don't waste system
resources anyway since they aren't running, and if multiple threads
_can_ run in parallel (ie you fiddling with netscape window while it
is busy downloading with another thread) then they should, IMHO.




> 
> > But kernel-mode they are, and that is _all_ that you can do
> > unless you
> > write your own thread library.  IE the pthreads library  uses
> > kernel-level
> > processes for each thread...
> > 
> > 
> > 
> > linux _never_ keeps all threads on the same cpu.  Unless you
> > only have one
> > cpu...
> > 
> > 
>   really? so then Linux uses a sort of 'voluntary' thread
> migration mechanism?
> 

Linux sees "processes" and nothing else.  And the scheduler says "I
want something to run, so it looks for processes that are not blocked,
and grabs the one it thinks is most reasonable (ie highest priority,
recently ran on this processor [to improve cache hits], etc.)  But
threads bounce around the processors pretty wildly if you have more
threads than processors (or even if you have the same number but you
are getting lots of interrupts).

And it seems to work just fine on the machines I use here all the
time...






>     
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 

-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to