Windows Server programming-Chapter 2 device IO and thread communication-5-I/O completion port

Source: Internet
Author: User

LI/OComplete Port

Windows2000 is designed as a secure, robust operating system that can serve thousands of users. In the past, one of the following two models is usually used to compile service applications:

 

LSerial Model

The thread waits for client requests (usually through the network ). When the request arrives, the thread wakes up and processes the client request.

 

LParallel Model

The thread waits for the client request and generates a new thread to process the request. When the new thread processes client requests, the old thread processes requests from another client cyclically. The new thread exits after the client request is fully processed.

 

The problem with the serial model is that it cannot handle multiple concurrent requests. If both clients send requests at the same time, only one request can be processed at a time. The second request must wait until the first request is completed. Service applications designed as serial models have no advantages on multi-processor machines. Obviously, the serial model is better for simple server applications, and fewer client connections allow requests to be processed quickly. The Ping service is a good example of a serial model server application.

 

Due to the limitations of the serial model, parallel models are extremely popular. In the parallel model, create a thread to process requests from all clients. The advantage is that there is only a small amount of work to be done in the thread waiting for the request to arrive. Most of the time, the thread is sleeping. When the client request arrives, the thread wakes up, creates a new thread to process the request, and waits for another connection. This means that the client request can be easily processed. In addition, because each client request has its own processing thread, the server application can be well scaled, which is more advantageous on the multi-processor machine. Therefore, when the parallel model is used, the performance of server applications is also improved by upgrading hardware (adding CPU.

 

Service applications of the parallel model are implemented in windows. The Windows team noticed that the performance was not as high as expected. In particular, the Windows team noticed that processing a large number of concurrent client requests means that a large number of threads are running simultaneously in the system. Since all threads are runable (without pending or waiting for something to happen), Microsoft realizes that Windows kernel has spent too much time on context switching of running threads, so that the thread does not have enough time to work. To make windows have a convincing server running environment, Microsoft needs to solve this problem. The result is the kernel object of the I/O completed port.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.