Re: I can't create thread more than 256 on Redhat 9
From: David Schwartz (davids_at_webmaster.com)
Date: 01/08/04
- Next message: P.T. Breuer: "Re: How can I get variable info from an executable file? (nm/objdump etc)"
- Previous message: Juergen Pfann: "Re: motv (xawtv) and slackware 9.1"
- In reply to: David Konerding: "Re: I can't create thread more than 256 on Redhat 9"
- Next in thread: David Konerding: "Re: I can't create thread more than 256 on Redhat 9"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 8 Jan 2004 13:25:06 -0800
"David Konerding" <dek@compbio.berkeley.edu> wrote in message
news:slrnbvr24j.g9a.dek@pink.Berkeley.EDU...
>> Yes, using threads would be more efficient than forking hundreds of
>> processes. But that doesn't mean using hundreds of threads! The advantage
>> of
>> threads is that they share file descriptors, so any given thread can do
>> I/O
>> for any client. So you don't need one thread for each client, you only
>> need
>> one thread for each task you can usefully do/pend at the same time.
> It's possible to share file descriptions through processes using the Unix
> IPC mechanism (or something like it- it's in Stevens).
Yes, but nobody has yet managed to make this work efficiently. There
aren't any practical 'process pool' servers that use a pool of processes the
same way a thread pool server uses a pool of threads. (At least, not so far
as I know.)
It's possible in theory, of course. And some have argued that such
servers could offer significant advantages over thread pool servers. The
main problem is that unless you keep all the structures associated with a
client connection in progress in shared memory, it's not possible for an
arbitrary process to handle an arbitrary connection.
My original statement is a bit imprecise. It's not just the difficulty
of sharing file descriptors but it's also the difficulty of managing client
state across a pool of processes simply because shared memory among
processes is awkward. To have more processes than clients, you'd have to
have more than one process that could pick up a given connection, which
would mean keeping all the information needed to handle that client in
shared memory, which would mean locks, which tend to be slow between
processes.
DS
- Next message: P.T. Breuer: "Re: How can I get variable info from an executable file? (nm/objdump etc)"
- Previous message: Juergen Pfann: "Re: motv (xawtv) and slackware 9.1"
- In reply to: David Konerding: "Re: I can't create thread more than 256 on Redhat 9"
- Next in thread: David Konerding: "Re: I can't create thread more than 256 on Redhat 9"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|