Platform SDK: Remote Procedure Call

Asynchronous I/O and Asynchronous RPC

Asynchronous I/O is an efficient means for a single thread to manage multiple I/O requests simultaneously. Asynchronous RPC on the server accomplishes a similar purpose for RPC requests. Designers using asynchronous RPC may be tempted to post asynchronous I/O requests from the server procedures. However, this technique should be avoided.

An asynchronous remote procedure call may complete before the asynchronous I/O request completes. When the asynchronous call completes, its thread terminates. Microsoft® Windows® NT and Windows 2000 bind all I/O requests to the thread that initiates them. If the thread terminates, any I/O requests pending on that thread are aborted. Pending I/O requests cannot be moved to another thread.

Therefore application designers can either use synchronous I/O in server procedures, or they can forward all requests that involve asynchronous I/O to procedures executing on a thread pool that the application manages. The Windows NT/Windows 2000 API provides functions for thread-pool management. See Process and Thread Functions.