Thread Pooling

In a client/server system, a single server process frequently has to handle requests from multiple clients. Ideally, the server will handle these requests in a concurrent manner, using threads. (Single-threaded servers tend to form bottlenecks and do not survive long in a commercial environment.)

But how many threads should a server create? This is a little like asking how long is a piece of string. One solution would be to create a new thread for every client request, process the request, and then destroy the thread when processing has completed. However, this approach has at least two drawbacks. The first is that thread creation and destruction is a moderately expensive operation. The second drawback concerns the number of threads: ...

Get Microsoft® Visual J#™ .NET (Core Reference) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.