Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Oct 1995 12:11:06 +1000 (EST)
From:      John Birrell <cimaxp1!jb@werple.net.au>
To:        mira!lambert.org!terry@werple.net.au (Terry Lambert)
Cc:        hackers@freebsd.org, jb@cimlogic.com.au
Subject:   Re: NetBSD/FreeBSD (pthreads)
Message-ID:  <199510200208.MAA11995@werple.net.au>
In-Reply-To: <199510200112.SAA03776@phaeton.artisoft.com> from "Terry Lambert" at Oct 19, 95 06:12:35 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > >usually it's for several blocking IO streams..
> > 
> > pthreads handles this...
> 
> No it doesn't.

To the thread is does *appear* to block.

> > But it does this via (I think...) all I/O being nonblocking, and if
> > it would block it then run another thread....
> 
> This is how it runs, period: It changes blocking operations into
> non-blocking operations plus a context switch.
> 
> If you get a real blocking operation (ie: one outside the model, etc.),
> then all threads are blocked because the context switcher can't run

Our scheduler runs on signals, so any calls outside the model are interrupted
and the next thread is run. An example of a blocking call that is outside
the pthreads model is msgrcv(). In our implementation, a blocking call to
msgrcv() will block for its time slice and then be interrupted by a SIGVTALRM
so that the next thread runs. The application has to handle the EINTR that is
returned to the thread once it gets to run again. Either that or the
application has to be written to use IPC_NOWAIT. Either way requires a
compromise.

> unless it converts the call.  Like fstatfs/statfs on a remote but
> down server (yit's not a select()'able operation).

This should still be interruptable by a signal.

> 					Terry Lambert
> 					terry@lambert.org
> ---
> Any opinions in this posting are my own and not those of my present
> or previous employers.
> 


-- 
John Birrell                                CIMlogic Pty Ltd
jb@cimlogic.com.au                          119 Cecil Street
Ph  +61  3 9690 9600                        South Melbourne Vic 3205
Fax +61  3 9690 6650                        Australia
Mob +61 18  353  137



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510200208.MAA11995>