LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I have a few questions about IO... (https://www.linuxquestions.org/questions/linux-newbie-8/i-have-a-few-questions-about-io-931821/)

trist007 02-28-2012 06:04 PM

I have a few questions about IO...
 
I know on CPU time you can regulate priority using nice and renice.

I now see ionice which can also regulate priority on IO for a process.

However, I'd like to know more on how IO works in Linux.

Can two processes wait for IO from the same device, say the primary NIC of the server, at the same time? Meaning can the two processes receive the IO from the primary NIC concurrently? or is it one first then the other based on IO priority of ionice? Or in reality like in CPU(single core) CPU only does one process at a time?

So in today's multi-core servers, several processes can be in the CPU at a time because of the multi-cores.

So in dealing with IO

1. Can two separate processes wait for IO from the same device, primary NIC, at the same time? Or does one process get the IO first, then the 2nd?

2. Wait if two processes are waiting for IO from two separate NICs, does the IO get received concurrently or one then the other?

2. What about when dealing with separate devices, say one process is waiting for IO from one hard disk, and another process is waiting for IO from another hard disk. Those happen simultaneously?

3. What if two processes are waiting for IO on the same hard disk? Do they receive the IO concurrently or one then the other?

4. What if two processes are waiting for IO from the same hard disk but different partitions? Do they receive IO at the same time or one then the other?

5. Same conditions as above but using a SCSI controller but the same hard disk?

6. How does the output from "iostat" break this down?

trist007 02-28-2012 10:59 PM

Also, in case some of you are wondering this is not a homework assignment. You can take a look at my topic history to get an idea of what I do.

syg00 02-29-2012 03:18 AM

O.k., let's try some general answers:

Any number of requestors can wait concurrently; being trite, they all wait at the same speed. Interrupts are generally handled as FIFO within priority order.
Where there are multiple CPUs enabled for interrupt handling for a particular interrupt, then concurrency is possible.
I don't know about NICs, but for block devices I believe there is one interrupt handler per device. I/O's for disk are consolidated and handled as a block - when that block is handled requestors are serviced as above. Regardless of (maybe) I/O order or partitions.

From userland you can't tell, and neither can iostat. If you're interested, have a look at blktrace (for disk - as I said, I don't know about TCP).


All times are GMT -5. The time now is 01:50 AM.