Messages in this thread | | | Date | Fri, 23 Apr 1999 12:59:59 -0500 | From | Manoj Kasichainula <> | Subject | Re: Linus on Linux, Apache and Threads |
| |
On Fri, Apr 23, 1999 at 11:48:47AM -0400, Chuck Lever wrote: > is there a nice way in > Unix/Linux to hand out incoming network requests to a pool of threads?
Grab a tarball from http://dev.apache.org/from-cvs/apache-apr/ to look at an attempt to do this in a multiprocess multithreaded web server. See the pthreads/ subdirectory in the tarball for the server itself. The code is most definitely in pre-alpha state.
We have two methods in the code (selectable with a #define) for distributing connections to threads. One is with a pool of threads in an accept() loop (one per listening socket) pushing connections onto a queue, and another pool of worker threads popping connections off the queue and handling them.
Another is very similar to the Apache 1.3 model. Every thread is in a loop of
accept_mutex_lock() poll() all listening sockets accept a connection accept_mutex_unlock() process_connection()
-- Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/ "Violence is the first refuge of the violent." - Aaron Allston
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |