Results 1 to 1 of 1
I will explain my question. Say DMA is not used in following example. Say process 1 and process 2 simultaneously open the same device and issue a read() call on ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-03-2011 #1
- Join Date
- Sep 2011
How does device driver know to which process to pass retrieved data?
I will explain my question. Say DMA is not used in following example.
Say process 1 and process 2 simultaneously open the same device and issue a read() call on it. Process 1 is interested in data X residing on the device and process 2 is interested in data Y residing on the device. The kernel will pass the read request to the device driver for the device which issues some I/O commands to the device. Then it puts the process to sleep (it needs to wait for the device to finish retrieving the data).
When the device has retrieved the data it issues an interrupt. This is a a-synchronous event. The interrupt handler puts the data in some kernel buffer I presume. How does the handler or kernel know to which user process (process 1 or 2) the data must be passed?
Say (with native command queuing active) that the data for process 2 was first retrieved by the device, then how does the interrupt handler know this and know it has to put the data in user space memory of process 2 and not of process 1?
Or is a device used by one process at a time and will any read() call need to wait till another process also issuing a read() call has finished? But then I do not understand books about the kernel which talk about wait queues for devices and that when an interrupt occurs the handler wakes up every process in the queue. I don't understand how this can work.
Obviously I misunderstand something. Can someone please explain to me the process.