How asynchronous programming would work without direct memory access (DMA)?

Viewed 323

To my understanding async programming involves no threads.

According to my understanding of Cleary article, it simply gains its performance by utilizing DMA engine in the hardware. It works as follow:

  1. Async Task initiates DMA engine to copy data from memory buffer to an I/O device.
  2. The tasks returns and relinquish control to the synchronizer - or whatever its called - to allow another task to run.
  3. When the DMA finishes, it notifies the operating system with and interrupt.
  4. Then somehow the operating system notifies the synchronizer that the operation is done.
  5. Finally the synchronizer runs the rest of the code in the Async task.

This is implemented in C# via a state machine, a simple example here ( Credits goes to Lasse V. Karlsen


To my knowledge IF DMA is not available, then Programmed I/O will be used involving the CPU in the data copy operation. Is there alternatives to DMA other than PI/O ?

How async-await gains performance in this case ? To my understanding I just see it adds more over-head ( the state-machine and the context switching of interrupts ) with zero gain.

To what extend my understanding is right ?

PS: I don't use C# at all - but I found the example really helpful -, I am okay with any example in any language.

0 Answers
Related