简体   繁体   中英

Can anyone explain to me this IOCP diagram?

In the book "WinSock Programming Fundamental: A Compilation", there is this diagram for IOCP:

在此处输入图片说明

I understand that the completion notifications arrive at the completion port, and that the four queued threads call GetQueuedCompletionStatus() to get a completion packet. But what does the other two worker threads shown below the completion port do, is it that these threads also call GetQueuedCompletionStatus() but they have already received a completion packet, and they are now processing it?

As Martin James says in his comment; The Queued Threads and the Worker Threads are all threads that have called GetQueuedCompletionStatus() . The threads designated as Worker Threads have been given a completion to process and are doing so. The threads designated as Queued Threads are waiting, either for more completions or are blocked by the IOCP due to the concurrency value that it was created with. If the later then they will wait for one of the Worker Threads to block on an API that the IOCP API knows about. If one Worker Threads completes processing the current completion that it has then it will go to the front of the queue of inactive threads (thus allowing the IOCP to provide its LIFO functionality which keeps active threads in play and thus helps to reduce context switches and memory faults).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM