Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is AIO better than select and multi-threaded IO processing? [closed]

Tags:

c++

io

I have read that select and multi-threaded programming were low performing IO models, for example this IBM developerworks article on high perfomance IO.

I do not understand how synchronising/aynchronising : Blocking/Non-Blocking is improving the performance. Why is AIO the best option here?

like image 622
Anerudhan Gopal Avatar asked Jan 04 '12 09:01

Anerudhan Gopal


2 Answers

Being asynchronous and/or non-blocking does not provide any inherent speed boost to individual IO operations within a system, if it is going to take x milliseconds to read from the disk that’s what it will take.

The advantage of these approaches shows true in multi-threaded environments (or environments where operation can continue despite delayed IO) by allowing the IO operations to be effectively separately from the main thread of execution. The perceived performance increase from this is due to the decreased number resources used to simply wait for IO to return or unblock.

A good comparison of asynchronous and non-blocking is available in this thread.

like image 125
Turix Avatar answered Oct 12 '22 08:10

Turix


Blocking an entire process while waiting for a single IO to finish isn't efficient if there are other things the process could be doing. AIO is one means of allowing the process to do other things while the system is doing IO for it; multithreading is another. The difference between using multiple threads or using AIO is largely one of design; in a typical server, for example, it's much easier to use multiple threads, and there shouldn't be much difference in performance. For other applications, AIO might be simpler and/or give more performance. It's another tool to be considered, but it doesn't apply everywhere.

like image 39
James Kanze Avatar answered Oct 12 '22 07:10

James Kanze