Reputation: 6756
Who is executing the task for reading? It's kernel? And where the task is enqueued? Is the queue same for all processes?
http://linux.die.net/man/3/aio_read
The aio_read() function queues the I/O request described by the buffer pointed to by aiocbp. This function is the asynchronous analog of read(2).
Upvotes: 1
Views: 800
Reputation: 16399
The kernel starts an I/O request at the request of the process. The process goes and does other things. Since I/O is usually much slower than memory operations, this means the process can do a lot work before the read will have completed. The I/O completes asynchronously, meaning the process does not block, does not sit there doing nothing while the I/O subsystem goes out to disk and returns data.
An analogy is: you ask a friend to get you a glass of water when you are eating. While the friend gets water, you continue eating. When the friend gets back later, you drink the water. That is asynchronous delivery of a glass of water. Synchronous means that you sit at the table doing nothing, unable to do anything but wait for the glass of water
Upvotes: 3
Reputation: 2116
From my understanding the task is executed by the process calling aio_read. The results should be queued in the return buffer that you provided in the original call. This means that depending on the process and what socket it is trying to read your output will be different even if they are running concurrently since they will have different buffers to be stored in.
Hopefully that was helpful. For additional information I would take a look at the IBM Source I posted below
Asynchronous I/O is currently only supported for sockets. The aio_offset field may be set but it will be ignored.
Upvotes: 0