2 What is Async I/O?Executing I/O in the background, allowing foreground work to proceedI/O executes and completes in parallel with, and independent of, the application that initiated itCalled “Overlapped I/O” in Win32
3 What is Async I/O? Synchronous I/O Asynchronous I/O Start I/O Blocked ProcessAsynchronous I/OStart I/OBlockedProcessBackground I/OBackground I/O
4 Why use Async I/O? Scalability Throughput Threads are expensive Non-blocking UISilverlight
5 Why not Async I/O?ComplexityDebuggabilityUnnecessary?
6 Asynchronous Programming Model Standard pattern for async work in .NET 3.5Convert: string DoOperation(int param1, double param2); Into: IAsyncResult BeginDoOperation(int param1, double param2, AsyncCallback callback, object state); string EndDoOperation(IAsyncResult asyncResult);In WCF, use [OperationContract(AsyncPattern = true)]
7 Asynchronous Programming Model Four ways to complete asynchronous call:Supply an AsyncCallbackPoll IAsyncResult.IsCompletedWait on IAsyncResult.AsyncWaitHandle (blocking)Call EndXxx method (blocking)Always call EndXxx method!