I don't have an exact answer to your question, but remember that each thread has to contain a stack of its own, and therefore takes up memory. The 'java.nio' (new i/o) package in recent versions of Java was designed for exactly this case that you're mentioning, where you have a lot of connections with little traffic and it's definitely the way to go, rather than trying to manage 10,000 threads.

On Jun 14, 2004, at 9:02 AM, Daniel Malmkvist wrote:

Hi

I have a question about threads. I was wondering about what realy happens to a thread on the OS level when i set it to read from a socket when there is no data there. I use Native threads (not green threads).

Will the thread realy sleep, no contex switch will be done. The thread will sleep until a the OS get a interruption from the NIC.

or will thread contex switching still be done to see if there is data to be read.

I have an application that should handle alot (>10 000) connection at the same time but usally no traffic. Is the best way to make a thread pool or is the best way to have 1 thread per connection. If no contex switching will be done I don't see why not.


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Reply via email to