IO Completion Ports

zhaozj2021-02-17  79

I recently wanted to see the stuff on the completion of the port, so I started here. I am trying to translate it, it can be limited, and there are a few words I am not very grasped. Do you help?

Platform SDK: Storage

I / O Completion Ports

I / O completion ports are the mechanism by which an application uses a pool of threads that was created when the application was started to process asynchronous I / O requests. These threads are created for the sole purpose of processing I / O requests. Applications that .................................

I / O completion port (s) is a mechanism, through this mechanism, the application will first create a thread pool at startup, and then the application uses the thread pool to process asynchronous I / O requests. The unique purpose of these threads is used to process I / O requests. For applications that handle a large number of concurrent actions I / O requests, it is faster and more efficient to use the completion port (S) compared to the I / O request to occur.

The CreateIoCompletionPort function associates an I / O completion port with one or more file handles. When an asynchronous I / O operation started on a file handle associated with a completion port is completed, an I / O completion packet is queued to the port. This Can be used to Combine The Synchronization Point for Multiple File Handles Into A Single Object.

The CreateioCompletionPort function enables an I / O completion port with one or more file handles. When the asynchronous I / O operation started on the file handle associated with a completed port, an I / O completion package will enter the queue of the completion port. For multiple file handles, these multiple file handles can be combined into a separate object, can this be used to combine synchronization points?

A thread uses the GetQueuedCompletionStatus function to wait for a completion packet to be queued to the completion port, rather than waiting directly for the asynchronous I / O to complete. Threads that block their execution on a completion port are released in last-in-first -out (LIFO) order. This means that when a completion packet is queued to the completion port, the system releases the last thread to block its execution on the port. GetQueuedCompletionStatus function call, a thread will wait to enter a complete package Complete the queue of the port instead of waiting for the asynchronous I / O request to complete. Threads (we) will blocked their running ports (released in order to first out queue order). This means that when a completion package enters the queue of the completed port, the system will release threads recently blocked in the completion port.

When a thread calls GetQueuedCompletionStatus, it is associated with the specified completion port until it exits, specifies a different completion port, or frees the completion port. A thread can be associated with at most one completion port.

Calling getQueuedCompletionStatus, the thread will establish a connection with a specified completion port, continuing the existence period of the thread, or a different completion port, or release contact with the completion port. A thread can only be contacted with a completed port that does not exceed one.

The most important property of a completion port is the concurrency value. The concurrency value of a completion port is specified when the completion port is created. This value limits the number of runnable threads associated with the completion port. When the total number of runnable threads associated with the completion port reaches the concurrency value, the system blocks the execution of any subsequent threads that specify the completion port until the number of runnable threads associated with the completion port drops below the concurrency value. The most efficient scenario occurs when there are completion packets waiting in the queue, but no waits can be satisfied because the port has reached its concurrency limit. in this case, when a running thread calls GetQueuedCompletionStatus, it will immediately pick up the queued completion packet. No context switches will occur, because the Running Thread Is Continually Picking Up Completion Packets and The Other Threads Are UNBLE T O Run. Completing the most important feature of the port is concurrent. Completing the port and emissions can be specified when the completion port is created. The concurrent amount limits the number of running threads associated with the completion port. When the total number of running threads associated with the completion port reaches the sum, the system will block any subsequent threads associated with the completion port until the number of operational thread associated with the completion port is lowered. To smaller than the concurrent release. The most effective imaginary is that there is a completion package waiting in the queue without waiting to be satisfied, because the completion of the port reaches the limit of its concurrency. At this point, when a running thread calls getQueuedCompletionStatus, it will immediately take the completion package from the queue. This does not exist environmental switching, because the running thread will continue to complete the package from the queue, while other threads cannot run.

The best value to pick for the concurrency value is the number of CPUs on the machine. If your transaction required a lengthy computation, a larger concurrency value will allow more threads to run. Each transaction will take longer to complete, but more transactions will be Processed At the Same Time. It is easy to expeneration. The best selection value for and the best choice is the number of CPUs in your computer. If your transaction requires a long computation time, a relatively large concurrency can allow more threads to run. Although it takes longer to complete each transaction, more transactions can be handled simultaneously. For applications, it is easy to get the best effect by testing and launched.

The PostQueuedCompletionStatus function allows an application to queue its own special-purpose I / O completion packets to the completion port without starting an asynchronous I / O operation. This is useful for notifying worker threads of external events.

The PostQueuedCompletionStatus function allows applications to queue in a custom private I / O complete package without launching an asynchronous I / O operation. This is useful for notifying external events.

The completion port is freed when there are no more references to it. The completion port handle and every file handle associated with the completion port reference the completion port. All the handles must be closed to free the completion port. To close the port handle, Call the closehandle function.

When there is no more reference to a completed port, you need to release the completion port. This completed port handle and all file handles associated with the completion port need to be released. Calling CloseHandle can release the handle of the completion port.

转载请注明原文地址:https://www.9cbs.com/read-30887.html

New Post(0)