I / O completion port
Windows 2000 is designed to be a safe, robust operating system that can serve thousands of users. Historically, a service application was written using one of two models:
Threads wait for requests from clients (usually over the network). When the request arrives, the thread wakes up and processes the client’s request.
The thread waits for the client’s request and generates a new thread to process it. When a new thread is processing a client’s request, the old thread loops through another client’s request. The new thread exits after fully processing the client’s request.
The problem of serial model is that it can’t handle multiple and concurrent requests well. If two clients make requests at the same time, only one can be processed at a time; the second request must wait for the first request to complete. A service application designed as a serial model has no advantage over a multiprocessor machine. Obviously, the serial model is better for simple server applications, and fewer client connections enable requests to be processed quickly. The Ping Service is a good example of a serial model server application.
Because of the limitation of serial model, parallel model is very popular. In the parallel model, a thread is created to process all requests from clients. The advantage is that the thread waiting for the request to arrive has little work to do. Most of the time, the thread is sleeping. When a client request arrives, the thread wakes up, creates a new thread to process the request, and waits for another connection. This means that incoming client requests can be easily processed. Moreover, because each client request has its own processing thread, the server application can scale well, and has more advantages in multi processor machines. Therefore, in the case of using the parallel model, when upgrading the hardware (adding CPU), the performance of the server application will also improve.
The service application of the parallel model is implemented under windows. The windows team noticed that it didn’t perform as well as expected. In particular, the windows team noticed that processing a large number of concurrent client requests meant that a large number of threads were running simultaneously in the system. Because all threads are runnable (without suspending or waiting for something to happen), Microsoft realized that the windows kernel spent too much time on context switching of running threads, so that threads did not have enough time to work. In order for windows to have a convincing server running environment, Microsoft needs to solve this problem. The result is an I / O completion port kernel object.