Tuesday, February 17, 2009

Dynamic Server Creation

Most concurrent servers operate dynamically.The server creates a new thread for each request that arrives.In fact,the server program is constructed in two parts:one that accepts the request and creates a new thread for the request,and another that consists of the code to handle an individual request.When a concurrent server starts executing,only the first part runs.That is,the main server thread waits for a request to arrive.When a request arrives,the main thread creates a new service thread to handle the request.The service thread handles one request and then terminates.Meanwhile,the main thread keeps alive- after creating a thread to handle a request,the main thread waits for another request to arrive.

For ex:If N clients are using a given service on a single computer,there are N+1 threads providing the service that means the main thread is waiting for additional requests,and N service threads are interacting with a single client.

No comments: