lkml.org 
[lkml]   [1999]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.093 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site