httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Mike Abbott)
Subject Re: AAP patch for 2.0a6 available
Date Mon, 28 Aug 2000 19:20:11 GMT
> This is pretty cool.

Thanks, I think so too.

> Is this a modification of Dexter, or a whole new MPM?

A whole new MPM.

> How much of this is implemented behind the
> scenes in the state threading library and how much is exposed in the
> Apache layer?

All thread scheduling happens within the ST library but everything else
is part of the STM in Apache.  For instance, the STM calls st_accept()
to get a new connection from a client and if there isn't one waiting the
ST library puts the thread on a waiting-for-I/O queue and runs another
thread.  But since both ST and STM are open source, it's all "exposed."

> It looks like it wouldn't be hard to write a pthreadish wrapper for
> this. Then, Apache could have a
> --with-threads=(pthread|pth|statethreads) configure option.

Unless I greatly misunderstand you, I think such a wrapper is not
possible.  One of the main features of state threads is that they are
nonconcurrent and nonpreemptive, unlike pthreads.  This is a key
property of state threads that makes them easier to program and debug
and also faster than pthreads.  For instance, in the STM I can write
statements like:
and use library functions like ctime(), readdir(), and gethostbyname()
that rely on static buffers, without worrying about race conditions.
With pthreads I must instead write:
and use ctime_r(), readdir_r(), and gethostbyname_r().  The STM has no
mutex locks in it at all so "porting" it to use pthreads would be a
nontrivial effort.  I don't know enough about Pth to comment on it, but
others on the state threads mailing list do.
Michael J. Abbott

View raw message