On Mon, Jul 14, 2003, Damon Hastings wrote:

> Can you give me a ballpark idea of the cost per
> context switch for 150 threads, almost all of which are waiting on I/O at
> any given time?

The costs depend on the particular method Pth uses for the context
implementation, of course. But all available methods Pth uses are very
cheap, because they are user-space only methods. Keep also in mind that
because Pth is a non-preemtive threading implementation, the context
switching is only performed if really required by the I/O.

> And does Pth block the entire process when all its threads
> are blocked?  (I would assume so, if you're using a global "select" under
> the covers.)

Sure, if _all_ threads are waiting for an event, the whole process is
waiting. And yes, internally the whole event management is based on a
single select(2) call.
                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
                                       www.engelschall.com

______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
Development Site                      http://www.ossp.org/pkg/lib/pth/
Distribution Files                          ftp://ftp.gnu.org/gnu/pth/
Distribution Snapshots                 ftp://ftp.ossp.org/pkg/lib/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to