chapter 11 - i/o management and disk scheduling Flashcards
categories of i/o devices
human readable device (printers, screens), machine readable (disk drives, sensors), communications (modems)
differences among i/o devices
Data rate: rate of data transfer.
Application: how the device is being used. Ex. disk drive for file storage or for swap space
Complexity of control: some devices are much more complex than others (disk more complex than printer).
Unit of transfer: one character at a time or blocks.
Data representation: data is represented different ways on different devices.
Error conditions: the kind of errors and their handling can be different among different devices.
techniques for performing i/o
Programmed I/O: CPU issues I/O and busy waits for it to complete.
Interrupt-driven I/O: CPU issues I/O and continues, is interrupted when I/O completes.
DMA: Direct memory access. CPU issues I/O and DMA module takes over, freeing the CPU.
what is DMA?
direct memory access
occurs when processor send command to the DMA module. DMA module performs data transfer without processor assistance. when completed, DMA module interrupts the processor
what information is in the command send to the DMA module?
Whether it wants to read or write
The address of the I/O device
The starting memory address to read or write to
The number of words to read or write
what are the OS design objectives for I/O?
efficiency and generality
what are the I/O layers?
logical layer, device layer, scheduling & control layer
what is the logical I/O layer?
provides simple high-level interface to user with generic commands like open, close, read, write.
what is the device I/O layer?
converts requested operations into appropriate sequences of I/O instructions.
what is the scheduling and control I/O layer?
low-level layer that interacts directly with the I/O module, including interrupts
what is I/O buffering? what problems does it solve?
lets the OS read/write data using buffers it owns, and managing the I/O to try to maximize efficiency (for example, by reading ahead).
the problems is solves are:
process can’t swap out and interferes with the OS, I/O is slow compared to the speed of the system
types of I/O devices?
block-oriented, stream-oriented
what are block oriented I/O devices?
Information is stored in fixed sized blocks.
Transfers are made a block at a time.
Used for disks and tapes.
what are stream-oriented I/O devices?
Transfers information as a stream of bytes (no block structure).
Used for terminals, printers, communication ports, mouse, and most other devices that are not secondary storage.
what is a single buffer (i/o management)?
Operating system assigns a buffer in main memory for an I/O request.
Transfers made to buffer.
Buffer copied to user space when needed.
Next unit is read into the buffer (read ahead, in anticipation of next request).
block oriented: holds a block
stream oriented: byte of data or an entire line of data
what are the advantages of a single buffer (i/o)
Allows next unit to be read while previous is processed.
Process can be swapped since I/O is using OS buffer.
what is a double buffer? (i/o)
use of 2 system buffers instead of 1
A process can transfer data to or from one buffer while the operating system empties or fills the other buffer.
what is circular buffering? (i/o)
use more than 2 buffers arranged in circular queue
no amount of buffering allows an I/O device to keep up with process requests if average demand is greater than the I/O device can service
why do we need disk scheduling?
processor and memory speed are much faster than disk devices
what are the 4 disk performance parameters?
Access time: sum of seek time and rotational delay.
Seek time: time it takes to position the head at the desired track
Rotational delay: time its takes for the beginning of the sector to reach the head
Data transfer time: occurs as the sector moves under the head.
why do we need disk scheduling policies?
Seek time is the primary reason for differences in performance.
By scheduling the accesses, we can improve performance.
If accesses are made at random (rather than scheduled), the performance will be very poor.
Therefore, we can use a random scheduling policy for comparison against other policies.
what are the 6 disk scheduling policies/algorithms?
FIFO, shortest service time first, SCAN, C-SCAN, N-step-SCAN, FSCAN
What is RAID? Why is it important?
Redundant Array of Independent Disks
has 7 levels, 0-6
Since disk devices are slow, one possible way to improve performance is to use several devices in parallel, servicing multiple requests at the same time.
Can also use multiple disk devices to improve reliability
more disk devices = higher risk of disk failure
Combat this with redundancy
3 characteristics each RAID level has?
Multiple physical drives viewed by the OS as a single drive.
Data distributed across the drives.
Redundancy to ensure recoverability if a drive fails
which RAID levels aren’t commercially available?
RAID levels 2 and 4
RAID level 0
Not a true RAID member bc it doesn’t have redundancy
each disk divided into strips
The strips are sequenced across each disk, so strip 0 is on disk 0, strip 1 is on disk 1, etc.
If there are n disks, then the first n strips form the first “stripe”, the second n strips form the second stripe, etc.
So, if a read or write consists of n strips, these can be handled in parallel, one strip per disk.
RAID level 1
Duplicates all data for redundancy.
Every disk has a mirror disk.
Simple recovery but higher cost (you need double the disks = double the $)
RAID level 2
Strips very small, may be only a single byte.
All disks participate in each read or write.
Uses parity disks for recovery.
Hamming code can correct single-bit errors or detect double-bit errors.
Only useful if lots of disk errors occur, which is not common today.
RAID level 3
Like RAID 2 but only uses a single additional parity disk.
Uses parity bit instead of an error-correcting code.
RAID level 4
Disks operate independently, so separate requests can be processed in parallel.
Strips are blocks.
Parity strip stores parity information for blocks.
RAID level 5
Like RAID 4 but distributes parity strips across all disks.
Keeps parity disk from being a performance bottleneck.
RAID level 6
Uses two parity strips on different disks instead of just one.
Requires N+2 disks.
Can recover even if two disks fail.
Three disks must fail to be unavailable.