by vkka · 5y ago · 0 comments
More efficient? Yes. Simpler? Not really. A synchronous program would be simpler, everyone who has done enough of these know it.
Let's say your program wants to list a directory, if it has nothing to do during that time then there is no point to using an asynchronous model, that only adds costs and complexity.
How do you do that without an async API? Thread pool and synchronous syscalls? That's not simpler.
And even if your program doesn't have any opportunity for doing IO in parallel, being able to chain a sequence of IO operations together and issue them with at most one syscall may still get you improved latency.
In general I totally agree that a synchronous program will be way simpler than an equivalent asynchronous one, though.
You can even choose between executing them sequentially and aborting on the first error or trying to complete as many as possible.