E.G. Must Not Allow File Owned by One User To Be Deleted by Another User
E.G. Must Not Allow File Owned by One User To Be Deleted by Another User
Operating System
20
21
1
Communication between I/O devices and the OS
22
23
2
Communication with the Processor
• Two methods
– Polling
• Device status bits are periodically checked to see if it is time for
the next I/O operation
– Interrupt-driven I/O
• Device delivers interrupt to the CPU when it requires attention
• Interrupts are like exceptions except that they are not
associated with any instruction
• CPU can check before starting a new instruction if an interrupt
has been delivered
• Interrupt-handling: Can be vectored or can use a Cause
register (Recall Exception-handling from Chapter 5)
24
25
3
Polling vs Interrupt-driven I/O cont’d
26
4
Transferring data between device and memory
• Two methods
– Interrupt-driven I/O
• Processor is involved in data transfer
• Problem: 100% overhead in the case of the hard disk example
– Direct Memory Access (DMA)
• Data is transferred directly from the device to memory (or vice
versa)
• Processor is involved only in
1. Initiating the DMA transfer
2. Handling interrupt at the end of DMA transfer
28
DMA
29
5
Hard disk DMA example
Find overhead for using DMA for data transfer from a hard disk.
Assume initial DMA setup = 1000 cycles
Interrupt handling on DMA completion = 500 cycles
Average size of data transfer = 4 KB
30