State the properties that may differ between IO devices.
Data rate, Control complexity, Transfer unit (blocks vs characters) and direction, Data representation, Error handling.
State the commonalities between IO devices.
A device has at least one port (connection point). Devices interconnected via a bus. Each device has an integrated or separate controller.
What registers does an IO device have?
Data-in register, Data-out register, Status register, Control register.
Describe the two ways IO devices are accessed.
Direct IO instructions (privileged). Memory-managed IO where device registers are mapped into processor address space.
Describe an IO device running in polled mode operation.
Host repeatedly reads the device-busy register until it is clear. Host sets read/write bit in command register, puts data into data register. Host sets command-ready bit in status register. Device sees command-ready and sets device-busy. After operation, device clears command-ready and device-busy.
Describe the operation of an IO device based on interrupts.
Device triggers interrupt-request line, which is checked by the CPU after each instruction. Interrupt handler reads the data from the device register.
Compare the advantages of interrupts and polling-based IO devices.
Interrupts are more efficient than polling when device is relatively infrequently accessed.
In what scenario is direct memory access effective?
When the IO devices are able to transmit information close to memory speeds.
Describe the operation of a direct memory access IO device.
The device controller transfers blocks of data directly to main memory without CPU intervention. Generating one interrupt per block rather than one byte.
State the hardware requirement for direct memory access IO devices.
Requires the ability for devices to become a bus master - taking the bus away from the CPU.
What is scatter/gather DMA (direct memory access)?
Chaining multiple DMA requests as one request.
State the properties of block devices.
Commands include read/write/seek. Can have raw access, via file system or memory mapped.
Give examples of block devices.
Disk drives, CDs.
State the properties of character devices.
Commands include get, put.
Give examples of character devices.
Keyboards, Mice, Serial.
Describe blocking IO.
Process suspended until IO completed.
Describe non-blocking IO.
IO call returns a handle to the incomplete data immediately. The process is responsible for checking what has been returned so far.
Describe how synchronous IO works.
After IO starts, control returns to user program only upon IO completion. CPU idles until next interrupt. At most one IO request is outstanding at a time.
Describe how asynchronous IO works.
After IO starts, control returns to user process without waiting for completion. System call allows process to request wait for IO completion.
What data does the OS have to store to allow asynchronous IO?
The device-status table contains an entry for each IO device indicating type, address, and state.
Describe the lifecycle of an IO request.
Determine device holding the file. Translate file name to device representation. Physically read data into buffer. Make data available to requesting process. Return control to process.
State the kernel data structures for IO components.
Open file tables, Network connections, Character device states.
What is vector IO?
It allows one system call to perform multiple IO operations.
What is vector IO also called?
The scatter/gather method.