whichever way I think about asynchronicity, I still come up with some sort of concurrency.
This guy here says that asynchronicity can have two flavors:
simulated asynchronicity ( let me call it that way)- where a thread is spawn for the async execution of some operations. To me this is a fake-asynchronicity and it's similar to concurrency. I don't see any real benefits here.
hardware supported asynch - where the request is just forwarded to the Hardware (like the Hard-disk or the Network Card) and the control of execution is immediately returned to the CPU. When the IO operation is ready, the CPU is notified and a call back is executed. This seems ok if you think about one single IO request, but if I try to extend the example for multiple IO requests then I still arrive at concurrency only that the concurency has been forwarded to the Hardware. Here's a diagram for two async IO calls:
- CPU ----- io async req 1 -----> Hardware
- CPU <------ returns the control (no data) ------- Hardware
- CPU ----- io async req 2 ------> Hardware
- CPU <------ return the control (no data) ------- Hardware
- CPU executes other operations while the Hardware executes two IO tasks
- CPU <------- data for req 1 ------- Hardware
- CPU executes the callback
- CPU executes other operations
- CPU <-------- data for req 2 ------- Hardware
- CPU executes the callback
As you can see, at line 5, the hardware handles two tasks simultaneously so the concurrency has been transferred to the hardware. So, as I said, whichever way I think about asynchronicity I still come up with some sort of concurrency, of course this time is not the CPU that handles it but the IO-Hardware.
Am I wrong ?
Does the IO hardware accept concurrency?
If yes, is the concurrency offered by the IO-hardware much better than that of the CPU?
If not, then the hardware is executing synchronously multiple IO operations, in which case, I don't see the benefits of asynchronicity vs. concurrency.
Thanks in advance for your help.