Async programming: identify the wait before choosing the tool

Async programming, concurrency, and parallelism describe different ways an application waits for or performs work. Async is useful when a program waits for external work such as an HTTP response, a database, a file, or a timer. While that operation is incomplete, the caller can yield instead of staying blocked; async does not make the operation itself faster.

Concurrency lets independent operations make progress over overlapping periods. It can reduce total waiting time when I/O operations overlap, but the application still needs limits on how much work runs at once. Parallelism runs CPU-bound work across multiple cores. It can help when measurement shows the computation benefits enough to justify the coordination and resource cost.

Choose based on where time is spent and what must happen next. A task represents an operation's eventual completion, result, failure, or cancellation; it is not itself a thread. Awaiting an incomplete task lets a method yield and resume later, while blocking keeps the caller occupied. In .NET, the continuation context can affect where that method resumes, so ConfigureAwait(false) is a scoped choice for library code, not a universal rule.

  1. Why async programming exists

    Async code yields while I/O waits on a database, network, file system, timer, or remote service. The external operation takes the same time, while the application can keep a UI responsive or serve other work. This is different from parallel computation. Async improves how waiting is handled; it does not remove the underlying I/O delay or make CPU-bound work faster by itself.

  2. Async, concurrency, and parallelism are different

    Async, concurrency, and parallelism answer different questions. Async avoids blocking during I/O waits, concurrency keeps independent operations moving in the same period, and parallelism spreads CPU-bound calculations across cores. The distinction guides the implementation: use async for external waits, concurrency when independent waits can overlap, and parallelism only after measurement identifies a CPU bottleneck.

  3. Task, async, and await: the lifetime of asynchronous work

    Follow a method that needs an HTTP response, from starting the request to returning a parsed result. See how the HTTP task and the method's own task carry different parts of the work. The walkthrough covers what await does while the response is pending, how failures and cancellation reach the caller, and where the method continues afterward.