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, 23 Apr 1999, Ian D Romanick wrote:
> > On Fri, 23 Apr 1999, Tony Gale wrote:
> > > On 23-Apr-99 Chris Wedgwood wrote:
> > > >> It ought to one of two things:
> > > >>
> > > >> - Use a thread to handle each request, all in one process.
> > > >
> > > > No, that would be insane. Perhaps use threads the way it now uses
> > > > processes, but not one thread per request -- that would be death as
> > > > far as performance goes.
> > >
> > > Depends. You can use a thread pool and queue requests which are then
> > > picked up by the threads.
> >
> > how do you propose to do that efficiently? is there a nice way in
> > Unix/Linux to hand out incoming network requests to a pool of threads?
>
> Huh? It's not that hard of a problem. You have one (or several) thread
> that just reads from network sockets. They package up the requests and put
> them on the end of a queue. The other threads just pull requests off the
> head of the queue.

i wasn't trying to suggest it was hard to code or understand. my question
is how to do this efficiently. has anyone compared the performance of
this model with the performance of the same application implemented
using NT's completion ports?

every Unix model i've seen that uses the "single thread waits for event
and wakes up worker threads" has suffered from a variety of problems that
can cripple its performance, like:

how does the event waiter thread determine whether there is a
suitable/idle worker thread to awaken?

> The trick is all in waking up the sleeping threads when
> the queue becomes non-empty without having the "thundering herd" problem.

agreed! any ideas?

- Chuck Lever
--
corporate: <chuckl@netscape.com>
personal: <chucklever@netscape.net> or <cel@monkey.org>

The Linux Scalability project:
http://www.citi.umich.edu/projects/linux-scalability/


-
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.181 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site