Re: Thread question

Nathan Bryant <[email protected]>
Newsgroups gmane.comp.java.linux.general
Organization Allegient Systems
Message-ID <[email protected]>
Daniel Malmkvist wrote:

> What I understand a thread pool will do  lot pf unnessesary polling to 
> no good. But in the 1-thread  per connection case the only resorces 
> that will be reserverd is a bit of memory (and  on a 64 bit plattform 
> that is not a problem). Or am I missing anything, is there any other 
> resorces that will be allocated. 

Polling doesn't actually hurt. In this context, "poll" actually refers 
to the poll(2) system call, which is designed for just this sort of 
thing - like select(2), it puts your process to sleep until any one of a 
number of file descriptors is ready for input or output. It is designed 
for high performance.

Using a thread pool will result in less context switch overhead and 
*much* less resident-set (RAM footprint) overhead, at the expense of a 
very low system call overhead. It's also much more portable to operating 
systems that don't handle 10K threads gracefully. It should scale above 
10K connections better.


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.