Key Points: Disk Storage, Scheduling, Flash Storage, and Other Block Devices
Disk Storage Fundamentals
- Basic Geometry:
- Disks organized into tracks, sectors, and platters
- Multiple platters share head assembly (stack of tracks = a cylinder)
- Outer tracks have more physical space than inner tracks
- Zone Bit Recording exploits this space for higher capacity
- Access Timing:
- Seek time for head movement between tracks
- Rotational latency waiting for sector to arrive
- Transfer time to read/write data
- Head acceleration/deceleration affects seek patterns
- Physical Considerations:
- Inner tracks more error-prone due to density (unless we use ZBR)
- Multiple platters increase failure probability
- Need to balance capacity vs. reliability
- Logical Block Addressing (LBA):
- Maps logical block numbers to physical disk locations
- Facilitates more complex disk geometries
- Even allows the mapping to change over time (e.g., remapping bad sectors)
- Simplifies disk access for OS and applications
- Obscures physical disk layout from software
- Maps logical block numbers to physical disk locations
Disk Scheduling Algorithms
- First Come, First Served (FCFS):
- Simple but inefficient
- Can cause excessive head movement
- No optimization for seek or rotation time
- Shortest Seek Time First (SSTF):
- Minimizes head movement
- Better overall throughput
- Can lead to request starvation
- Elevator Algorithms:
- SCAN (full traversal) and LOOK (partial traversal)
- Prevents starvation
- Middle tracks get preferential service
- Circular Variants:
- C-SCAN and C-LOOK avoid middle track bias
- Better for sequential access patterns
- More compatible with LBA addressing
Modern Disk Controllers
- Command Queuing:
- Native/Tagged Command Queuing (NCQ/TCQ)
- Controllers reorder requests internally
- OS and controller work in partnership
- Disk Caching:
- Read-ahead for sequential access
- Write buffering for performance
- Must consider power failure implications
- Health Monitoring:
- SMART attributes track disk health
- Reallocated sectors and error rates
- Temperature and performance metrics
Flash Memory Fundamentals
- Physical Structure:
- Flash cells are transistors with floating gates that trap electrons
- Pages are the smallest writable units (typically 4–8 KB)
- Blocks contain multiple pages (typically 64–256 pages)
- Different cell types (SLC/MLC/TLC/QLC) store different numbers of bits
- Basic Constraints:
- Pages must be erased before rewriting
- Can only erase entire blocks, not individual pages
- High-voltage erase operations gradually damage cells
- Limited number of erase cycles per block
- Cell Types and Endurance:
- SLC (1 bit): ~100,000 erase cycles
- MLC (2 bits): ~10,000 erase cycles
- TLC (3 bits): ~3,000 erase cycles
- QLC (4 bits): ~1,000 erase cycles
- More bits per cell means higher density but lower endurance
Flash Translation Layer (FTL)
- Basic Functions:
- Maps logical addresses to physical locations
- Handles wear leveling
- Manages garbage collection
- Tracks block health and wear
- Key Concepts:
- Write amplification: when one logical write causes multiple physical writes
- Overprovisioning: reserving space for management
- Trim: marking pages as no longer needed
- Garbage collection: reclaiming space from invalid pages
- Management Strategies:
- Block-level remapping
- Page-level remapping within blocks
- Random remapping to prevent targeted wear
- More sophisticated strategies for better performance and endurance
- Pedagogical example: LBA permutation for wear distribution
- Real-world: hybrid FTLs with DRAM caches and other optimizations
Other Block Devices
- RAID:
- Combines multiple drives for performance and reliability
- Various levels (0, 1, 5, 6, 10, etc.) balance trade-offs
- Software RAID can be more flexible but slower
- Network Block Devices:
- Allow remote block storage over a network
- Used in cloud storage, virtualization, and other scenarios
- Must consider latency, reliability, and security
Remember
- Physical disk characteristics significantly impact performance
- Disks are a random-access medium, but unlike memory, position matters; it's not uniform cost!
- Different scheduling algorithms balance various trade-offs
- No single algorithm is perfect for all situations
- Modern controllers add complexity but improve performance
- Caching and command queuing require OS cooperation
- Must balance performance against reliability concerns
- Flash memory's write/erase asymmetry fundamentally affects SSD design
- The FTL provides the illusion of a simple block device despite complex physical constraints
- Different SSD designs balance capacity, performance, and endurance
- Modern SSDs are quite resilient when properly managed
- Overprovisioning and sophisticated FTLs are key to SSD longevity
(When logged in, completion status appears here.)