click below
click below
Normal Size Small Size show me how
CECS 326 I/O Prep
| Question | Answer |
|---|---|
| Block Device | Block devices (HDDs, SSDs) store data in fixed-size blocks and support seeking/random access |
| Character Device | Character devices (keyboard, serial port) send/receive data as a stream of characters rather than fixed blocks |
| Seek time | On HDDs, the read/write arm physically moves to the desired track before reading data |
| Elevator algorithm | SCAN/elevator scheduling minimizes disk arm movement by sweeping back and forth like an elevator |
| Memory-mapped I/O | Device registers are mapped into the CPU's address space so they can be accessed like memory |
| DMA allows... | Direct Memory Access lets devices transfer data directly to RAM without CPU copying every byte |
| IOMMU primarily protects... | The IOMMU controls and translates device DMA accesses similarly to how the MMU protects CPU memory accesses |
| NVMe | NVMe is a modern SSD communication/storage protocol optimized for parallelism and low latency |
| Precise interrupt ensures... | The CPU can safely resume execution because the interrupt occurs at a well-defined instruction boundary |
| io_uring improves performance using... | Applications and the kernel communicate through shared submission/completion queues, reducing syscall overhead |
| Device driver responsibility... | Drivers translate generic OS requests into hardware-specific commands |
| Y2038 refers to... | A signed 32-bit time_t overflows on January 19, 2038 |
| TRIM is used to... | The OS informs the SSD which logical blocks are unused so garbage collection works efficiently |
| Device-independent I/O means... | Applications use the same interface regardless of hardware differences |
| Spooling is used when devices are... | Spooling queues jobs for devices like printers so multiple users can safely share them |
| Monotonic clock | A monotonic clock only moves forward and is ideal for measuring elapsed time/timeout |
| Kernel-mode driver privileges... | Kernel-mode drivers run inside the OS kernel, so they have the same high-level privileges as the kernel itself |
| Bug in kernel-mode driver can crash... | Because drivers in kernel space, a bad memory access or bug can crash the whole OS (kernel panic/BSOD) |
| CrowdStrike outage affected | The July 2024 outage impacted 8.5 millions of Windows systems worldwide due to a faulty kernel driver update |
| CrowdStrike outage occurred because a driver... | The fault driver accessed invalid memory in kernel mode, causing widespread crashes/blue screens |
| Kernel-mode drivers are dangerous because... | Drivers can directly access memory and hardware, so bugs are extremely dangerous (share full kernel privileges) |
| "Blast radius" | A failure inside kernel code spreads system-wide rather than staying isolated to one application |
| macOS DriverKit improves stability by... | Apple moved many drivers out of the kernel so crashes are isolated and safe (moved into user space) |
| Moving drivers to user space helps because... | If a user-space driver crashes, usually only that driver/process fails instead of the whole OS |
| Design choice reducing buggy-driver impact... | Reducing kernel exposure lowers the damage caused by driver bugs (moving drivers to user space) |
| CrowdStrike outage example... | The outage showed how one faulty kernel driver can disable millions of machines (danger of kernel mode code) |
| Why I/O is the "blast-radius layer"? | I/O interacts directly with hardware and privileged kernel code, making failures extremely dangerous system-wide |
| Examples of block devices: | HDD, SSD, NVMe |
| Examples of character devices: | Keyboard, UART, TCP |
| SSDs | Storage devices accessed in blocks and support random access |
| Keyboard | Sends characters/events as a stream rather than block storage |
| IOMMU is to DMA what the ______ is to CPU memory access... | The MMU protects/translates CPU memory access |
| Purpose of the IOMMU | The IOMMU protects/translates device DMA access |
| Memory-mapped I/O means registers are located in... | Device registers appear at physical memory addresses so the CPU can access them directly |
| MMIO allows registers to be accessed like... | The CPU uses normal load/store memory instructions to communicate with devices |
| Main distinction between block and character devices... | Blocks are seekable and use fixed-size blocks; character devices are stream-based and usually not seekable (seekability and fixed-size transfer units) |
| Why MMIO is useful... | Devices can be controlled using normal memory instruction. MMIO simplifies hardware communication because devices behave like memory addresses from the CPU's perspective |
| Precise interrupt guarantees the _____ is saved correctly. | The Program Counter (PC) must be saved correctly so execution can resume at the proper instruction |
| In a precise interrupt, prior instructions must be... | All earlier instructions must fully finish before the interrupt occurs |
| Later instructions must NOT be... | Future instructions may be fetched or decoded, but they cannot change architectural state yet. (committed) |
| Precise interrupt requires CPU state to be... | The CPU must be in a clean, consistent state so execution can safely continue afterward (known and restartable) |
| MSI-X improves interrupt handling using... | Devices can use multiple interrupt vectors instead of sharing one line |
| MSI-X supports approximately... | MSI-X can support up to around 2048 interrupt vectors per device |
| MSI-X interrupts can be steered toward different... | CPUs. Interrupts can be distributed across multiple processor cores for better scalability |
| Correct interrupt handling sequence... | The device raises an intterupt, the controller signals the CPU, the CPU saves execution state, then the ISR executes |
| ISR stands for... | Interrupt service routine. An ISR is the code that runs in response to an interrupt |
| 8259 PIC interrupt lines... | The classic dual 8259 Programmable Interrupt Controller supported about 15 usable interrupt lines |
| 8259 PIC responsibility... | The PIC coordinated and prioritized hardware interrupts |
| Precise interrupt description... | The key feature is reliable recovery/resume after the interrupt finishes (CPU can safely resume execution) |
| Why precise interrupts matter... | Without precise interrupts, restarting execution correctly would be unreliable or impossible (they allow correct program recover/resume) |
| Major goal of I/O software | Device independence means applications can use devices without knowing hardware-specific details |
| Uniform naming means | Devices should be accessed in a standard, predicable way (a consistent naming scheme) |
| Error handling should occur | Lower layers understand the hardware best and can response appropriately to failures (as close to the hardware as possible) |
| Synchronous and _____ operation. | Asynchronous; I/O systems support both blocking (sync) and non-blocking/background (async) operations |
| Buffering primarily | Buffers temporarily store data so fast CPUs and slower devices can work efficiently together |
| Some devices are sharable while others are | Dedicated; some hardware (like printers) can usually only serve on job at a time |
| Device independence allows | Programs can interact with different hardware through a common OS interface |
| Device-Independent I/O | Applications do not need to know low-level hardware details, OS hides hardware-specific differences |
| Uniform naming helps because | Consistent naming simplifies programming and system administration (all devices can be accessed consistently) |
| Unix/Linux uniform naming example | Unix exposes devices using standardized paths like /dev/sda or /dex/tty0 |
| Why handle I/O errors near hardware | Drivers and low-level code better understand retry behavior and hardware conditions (lower software layers know device-specific details) |
| Best example of I/O error handling | Retrying a failed disk operation; Retrying is a common strategy for transient hardware failures |
| Goal focused on hiding hardware differences | Device independence; This abstraction allows portability across hardware |
| Opposite I/O operation styles | Synchronous waits for completion; asynchronous continues execution while I/O happens in the background |
| True statement about sharable vs dedicated devices | Only one print job can physically use the printer hardware at a time, so printers are treated as a dedicated device |
| Three major I/O paths | Polling, interrupt-driven, DMA; main methods used to move data between devices and memory |
| Programmed I/O is also called | Polling; the CPU repeatedly checks device status instead of being notified automatically |
| CPU repeatedly checking device status | Polling/programmed I/O wastes cycles constantly checking readiness |
| Interrupt-driven I/O works by | Waking the CPU when the device is ready |
| DMA is best for | Large transfers directly between device and RAM with low CPU overhead |
| Linux divides interrupt work into | Top half and bottom half; interrupt handling is split into urgent and deferred work |
| Top half usually runs with | interrupts disabled; this prevents nested interrupt problems during critical handling |
| Bottom half usually runs with | tiny and fast critical section; longer processing is deferred until interrupts can safely enable again |
| Top half description | tiny and fast critical section; does minimal urgent work and returns quickly |
| Bottom half exists to | perform longer work outside the critical interrupt-disabled section; improves system responsiveness and reduces interrupt latency |
| Programmed I/O wastes CPU time because | continuously polls device status; CPU spends cycles waiting instead of doing useful work |
| Highest CPU overhead | programmed I/O; polling consumed the most CPU resource |
| Interrupt-driven I/O improves efficiency because | sleeps until notified by interrupt |
| Interrupt-driven I/O generates interrupts | when device becomes ready |
| DMA transfers data between | device and main memory |
| DMA reduces CPU overhead because | devices access memory directly |
| DMA usually generates | one per transfer |
| Most efficient for large transfers | DMA |
| Most likely to waste CPU cycles | Programmed I/O |
| Linux separates top/bottom halves | to minimize time spent with interrupts disabled |
| Best description of top and bottom halves | the top half is tiny and fast, bottom half performs the longer work with interrupts enabled |
| New devices without recompiling kernel | interface |
| Linux kernel modules loaded using | insmod or modprobe |
| Windows relies on signed _____ through callback tables | drivers |
| Device driver translates | generic OS requests into hardware-specific operations |
| file_operations and block_device_operartions are | driver operation interfaces/tables |
| windows WDM/WDF provide | driver frameworks using callback tables |
| Uniform driver interface means | kernel interacts with drivers through a standard contract |
| Important of uniform driver interface | it allows new hardware support without changing kernel design |
| Component performing device-specific register writes | driver |
| Callback tables TRUE statement | They allow the OS to invoke driver-specific functions through a common interface |
| Role of a driver interface | acting as the contract between the kernel and driver code |
| Key idea of this section (drivers and uniform interface) | A uniform driver interface standardizes communication between the kernel and drivers |
| Printers are commonly spooled because they are | dedicated devices |
| Spooling primarily helps by | serializing access to shared devices |
| Correct buffering progression | unbuffered -> user -> kernel -> double |
| Double buffering is used to | overlap computation and I/O |
| Example of uniform naming in Linux | /dev/sda1 |
| /dev/null and /dev/tty0 are example of | uniform device naming |
| Printers are considered dedicated because | Only one job can use the printer hardware at a time |
| Spooling stores print jobs temporarily on | disk |
| Greatest overlap between processing and I/O | double buffering |
| Best description of spooling | buffering jobs on disk before device access |
| Uniform naming means | devices are accessed through a consistent namespace/interface |
| More buffering generally improves | I/O efficiency |
| Key idea behind spooling | Dedicated devices must often be shared safely through queued access |
| Correct order of I/O layers | interrupt handler -> device driver -> device-independent I/O -> user-space I/O |
| Lowest I/O software layer | interrupt handler |
| Device independent I/O exists to | hide hardware differences from applications |
| io_uring improves performance using | shared ring buffers |
| Main advantage of io_uring | reduced syscall overhead |
| stdio in C provides | formatted I/O and user-space buffering |
| Examples of a FUSE filesystem | NTFS-3G |
| FUSE allows file systems to run in | user space |
| DPDK/SPDK improve performance by | allowing direct user-space device access |
| VFIO + IOMMU are used to | isolate and safely expose devices to user-space programs |
| Layer directly interacting with hardware interrupts | interrupt handler |
| Device-independent I/O means | the OS provides a common interface across device |
| io_uring description | a Linux asynchronous I/O mechanism using shared rings |
| TRUE statement about FUSE | FUSE allows filesystems to be implemented in user space |
| Key idea of DPDK/SPDK | performance can improve by reducing kernel involvement in device access |
| Disk access time | seek + rotational latency + transfer time |
| Seek time | time to move disk head to correct track |
| Rotational latency | disk platter rotation |
| Transfer time | read/write data once positioned |
| SCAN (elevator algorithm) | sweeping in one direction then reversing |
| Elevator algorithm improves performance by reducing | disk head movement |
| FCFS suffers mainly from | unbounded seek time due to random ordering |
| FCFS stands for | First Come First Serve |
| SSF chooses request that is | closest to seek distance |
| SSF disadvantage | starvation of far requests |
| Algorithm that can cause starvation | SSF |
| Real-world elevator analogy | SCAN (elevator) |
| NOT affected by scheduling | transfer time |
| Why disk scheduling is needed | because mechanical seek is slow |
| FTL purpose | translate logical addresses to physical flash locations |
| OS view of SSD | flat logical block device |
| NVMe improves performance using | multiple queue pairs |
| NMVe queue pairs mapped per | CPU core |
| Disk scheduling reduced in NVMe because | SSDs have no mechanical seek cost |
| SSDs have no seek time because | use electronic flash memory |
| Main difference SSD vs HDD performance | absence of mechanical movement |
| FTL wear leveling | distribute writes evenly across flash |
| Garbage collection needed because | flash memory must create before rewriting |
| TRIM allows OS to | notify SSD which blocks are no longer in use |
| TRIM improves performance by | helping garbage collection efficiency |
| Disk scheduling less important for SSDs because | SSDs have no mechanical seek cost |
| NVMe design philosophy | parallel queueing per CPU core |
| Component replacing physical disk layout abstraction | FTL |
| SSD vs HDD summary | SSDs eliminate mechanical delays entirely |
| RAID 5 rebuild requires reading from | all remaining drives |
| Major RAID 5 rebuild risk | second disk failure |
| GPT supports how many partitions | 128 |
| GPT uses what LBA size | 64-bit |
| RAID 0 provides | stripping only (no redunancy) |
| RAID 1 is based on | mirroring |
| RAID 5 uses | striping with single parity |
| RAID 6 improves over RAID 5 by | adding double parity |
| RAID 10 combines | striping + mirroring |
| RAID 5 becomes unreliable with large disks because | higher unrecoverable read error probability |
| URE stands for | unrecoverable read error |
| ZFS improves reliability via | end-to-end checksumming |
| Erasure coding improves reliability by | distributing parity information mathematically across data blocks |
| RAID with no redunancy | RAID 0 |
| RAID that survives two disk failures | RAID 6 |
| RAID 5 main disadvantage at scale | rebuild risk due to large disk size |
| ZFS is best described as | redundancy + integrity checking |
| Y2038 problem | 32-bit signed time_t overflow |
| Overlfow time occurs at | 19 Jan 2038, 3:14:00 UTC |
| Linux fix for Y2038 | switching to 64-bit time_t |
| CLOCK_MONOTONIC best used for | measuring elapsed time |
| CLOCK_REALTIME best used for | actual wall-clock dates |
| Monotonic vs real difference | is unaffected by system clock adjustments |
| Clock drivers are responsible for | system timing services like alarms and scheduler ticks |
| Relies heavily on clock interrupts | scheduler quanta |
| Why CLOCK_MONOTONIC is preferred | it is not affected by system time changes |
| Why CLOCK_REALTIME is not ideal for elapsed time | it can jump due to manual or NTP adjustments |
| Y2038 represents conceptually | integer overflow in time representation |
| Linux Y2038 fix approach | switch to 64-biy time representation |