Device Management Flashcards
Device Management Objectives
- Abstraction from details of physical devices
- Uniform naming that doesn’t depend on hardware details
- Serialization of I/O operations by concurrent applications
- Protection of standard devices against unauthorized access
- Buffering, if data from.to a device can’t be stored in the final destination
- Error handling of device errors
- Virtualizing physical devices via memory and time multiplexing
types of I/O devices
- Block
- Character
- Network
Block devices examples & characteristics
-disk drives
-commands: read, write, seek
-raw I/O or file-system access
-memory-mapped file access possible
Character devices examples & characteristics
-keyboards, mice, serial ports
-commands: get, put
-libraries layered on top allow line editing
Programmed I/O characteristics (aka?)
-polling
-thread is busy waiting for the I/O operation
-kernel thread is polling the state of an I/O device
Interrupt-driven I/O characteristics
-I/O command is issued
- processor continues executing instructions
-I/O device sends an interrupt when I/O command is done
How is data on hard drives addressed?
CHS: Data is addressed by specifying its physical Cylinder, Head, and Sector. It is limited to just under 8 gb of data
LBA: Logical Block Addressing is a successor to CHS that allows addressing large hard drives. Using LBA only one is used to address data on the hard disk.
What is SMR? Explain.
Shingled Magnet Recording: it writes new tracks overlapping with previously written tracks. Consequently, SMR improves data density compared to Conventional Magnetic Recording.
A write to an SMR track destroys data on neighboring tracks. Thus, purely sequential writes are strongly preferred for SMR drives to avoid rewriting neighboring tracks.
Why is rewriting data on a flash-based solid-state drive an order of magnitude slower than writing?
NAND memory needs to be erased before it can be written again. Rewriting requires reading an entire block, erasing it and writing the modified pages and other pages which haven’t been modified back to the block. The erase cycle is very slow compared to reading.
What are spare blocks in SSDs used for?
When previously erased blocks (spare blocks) are available, erasure can be performed lazily when the disk is idle. This way, on a rewrite, the block is relocated to a spare block and the old block is marked for later erasure.
How does the trim command help with slow rewrites?
When a file is deleted, the underlying pages aren’t automatically freed. trim passes this information on the SSD, so that the pages can be cleared in advance for future (re)writes.
RAID vs SLED
SLED: single large expensive disk - a disk with large capacity, high read/write speeds, low latencies, low fault rates,… => almost impossible
RAID: redundant array of inexpensive disks - multiple drives working together with the same goal
Enumerate RAIDs and their characteristics
RAID 0: block-level striping, distributes the contents of each file among all drives in the set, failure of any drive causes entire files to be lost, higher throughput
RAID 1: data mirroring, data is written identically to two drives, improved performance, slower write throughput
RAID 2: bit-level striping with Hamming code parity, each sequential bit on a different drive
RAID 3: byte-level striping with dedicated parity, each sequential byte on a different drive
RAID 4: block-level striping with dedicated parity, I/O parallelism, improved performance
RAID 5: block-level striping with distributed parity, parity information Is distributed among the drives, upon failure of a single drive subsequent reads can be calculated from the distributed parity
Why does the OS have limited information about the layout of data on hard disks?
- logical block addressing abstracts away from disk layout
- sector sparing can cause blocks to be far apart on the disk, although their block numbers are close together
Why are SDDs much faster than hard disks for random access?
Randomly accessing flash chips/packages is faster than mechanically moving around a hard disk arm. With NCQ, requests to data in different flash chips can be handled in parallel, in contrast to a hard disk’s single arm.