Chapter 9 Flashcards
(11 cards)
Sequence of interrupt handling on the hardware level
- An I/O device finishes an operation and sends an interrupt request to the interrupt controller
- The interrupt controller receives this request and signals an interrupt request to the CPU.
- CPU acknowledges this request and confirms the start of interrupt handling
- The interrupt controller informs the CPU about the interrupt number which the CPU uses to identify the specific interrupt handler to execute.
DMA
Is used to handle data transfers between mem and other devices independently of the CPU.
- CPU initially programs the DMA controller with the details of the transfer such as the memory address, the amount of data… once the setup is done, the DMA controller takes over the transfer process.
- The DMA controller sends a request to the disc controller to start transferring data and this request is made over the bus system
- The controller transfers the requested data directly to the main memory and this is done without the CPU involvement
- Once the data transfer is complete, the disc controller sends an ACK back to the DMA controller signaling that the transfer was successful
- DMA controller sends an interrupt request to the CPU signaling that the transfer is complete and then the CPU can process the data and continue with the next task
Device classes
- Character oriented devices: handle data one character at a time such as keyboards, sequential process of data
- Block oriented devices: handle data in large blocks such as secondary storage, supports random access
Address space models
- Separate I/O @ space: 2 distinct @ spaces. One for mem and the other for I/O ports
- Shared @ space: combines I/O and mem @ spaces into one. Devices are accessed as if they are mem locations
- Hybrid architecture: have multiple types of @ spaces.
Polling (programmed I/O)
CPU continuously checks the status of a device to see if its ready for data transfer, CPU keeps waiting
Interrupts
Device signals to the CPU when it’s ready to transfer data, they introduce asynchrony and the simplest way to avoid race conditions is to disable interrupts
I/O calls
In unique systems input output operations would block the process until the operation could be completed. This means the process would be idol and enable to perform any other tasks.
Asynchronous I/O calls: these allow process initiate a I/O operation and continue executive other tasks without waiting for the operation to complete.
Solution 1: non blocking I/O calls: the process repeatedly checks if data is available by calling read( ) in a loop. If no data is found, read( ) returns immediately without blocking.
Solution 2: simultaneous blocking: use select system calls, they allow the process to block until one of the monitored file descriptors become ready for the op. This is better than polling.
Single I/O buffering
Read: used to transfer data from an I/O device to a process of mem buffer. Read specifies the file to read from and the buffer to store the data in. Once the data is in the buffer, the process accesses it. 2 types of reading:
- synchronous which is blocking, processes blocks until the reading op is finished
- asynchronous which is non-blocking: process starts reading and continue executing other tasks without waiting for read data
Since data is in the buffer, the process can be swapped out while waiting for I/O ops to complete.
Write: transfer data from a process or buffer to I/O device. Also has same 2 types as reading
Double I/O buffering
Read: while data is being transferred from I/O to buffer, the content of the second buffer can be copied to the process @ space, its like one buffer is one step ahead than the other.
Write: while data from one buffer is being transferred to I/O device, the other buffer can already be filled with new data from the process
Circular I/O buffering
Read: allows data to be buffered even if the reading process is slow and doesn’t make read calls frequently enough. The buffer can store data until the process is ready for it.
Write: process can make multiple write calls without being blocked because data is stored in the buffer.
Buffers
Buffer separate the I/O operations of processes from the actual device drivers