Subject: Re: exit() strangeness with pth thread package...
To: Brian Stark <bstark@siemens-psc.com>
From: Todd Vierling <tv@wasabisystems.com>
List: netbsd-help
Date: 10/15/2000 12:23:15
On Sat, 14 Oct 2000, Brian Stark wrote:

: How does the scheduling work in pth? From what I have seen during my
: testing on NetBSD is that if I create multiple threads the thread that is
: currently running doesn't seem to yield the CPU to the other threads,

Read the pth documentation.  You need to *explicitly* yield control to other
threads (unless you make a blocking system call which pth understands;
there's magic there).  This is called "cooperative" threading.

You're expecting pth to do "preemptive" threading--that is, a thread can be
interrupted even midinstruction without explicit yielding.  You need a
thread package that can do preempting in this case, such as mit-pthreads or
PTL2.

Note that NetBSD doesn't have kernel based preemptive thread scheduling, and
PTL2/mit-pthreads is emulating it in userland, but someone is diligently
working to implement kernel-to-userland threading as I type this.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  http://www.wasabisystems.com/
-- Speed, stability, security, and support.  Wasabi NetBSD:  Run with it.