Book Reference: Operating system concepts by Galvin
Storage systems that are used in computers to store bulk and long term data are
- HDD (Hard Disk Drive)
- NVM (Non-Volatile Memory)
The hard disk contains multiple platters (a shape similar to CD) mounted over a spindle (rod which helps in rotation). Platters generally have storage surfaces on both of its side.
A surface consisting of multiple tracks
Each track is divided into track sectors. Each track sector is the actual single physical storage for a block of data. The atomic unit of the data transfer is the track sector. The track sector size is generally 512 B is size though some manufacturers produce HDD with a track sector size of 4 KB
Data from the disk is read the read-write head. There is a read-write head for each surface. Disk speed is measured in RPM. The speed of common HDD is 5.4K, 7.2K, 10K, 15K RPM.
- Transfer Rate: Amount of data transferred between HDD and Computer per unit of time.
- Random access Time: Seek Time + Rotation Latency. This is also known as positioning time.
- Seek Time: Time required to move the head to the targeted track.
- Rotational Latency: Time required to move the head to the targeted sector track.
Disk header moves close to the disk surface but it doesn’t touch the disk surface. HDD surfaces are protected with a thin layer. Head crash is a problem when the disk surface is damaged by the disk head.
The NVM storage stands for Non-Volatile Memory. HDD is mechanical in nature on the other hands NVM is electric. There are numerous techniques to build NVM devices but the most common one is to build with a controller and flash-based semiconductor chip.
SSD (Solid State Drives) = Flash-based NVM in Disk container
USB is also an NVM device.
Qualities of NVM
- Reliable as they don’t have moving parts.
- Faster as no seek time and rotation latency involved.
- Consume less energy
- Smaller in size
Drawbacks of NVM
- Expensive ( Although getting cheaper with time )
- Less capacity than HDD
STRUCTURE OF NVM Memory
An SSD drive consists of multiple die. Each die has multiple planes. A plane has multiple blocks. Block consists of pages.
Page is the smallest unit of the NAND semiconductor (NVM) memory. Page is similar to the sector track in the HDD.
Challenge with NVM that there is no update operation. Only the following operations are supported:
- Read a page
- Write a page (only if it’s empty)
- Erase a block
Also, semiconductor performance decreases with every erases cycle. Generally, each page support 1L erase cycle and after that, it no longer can store the data. Because of the above limitation, the NVM controller distributes the data uniformly across all the pages so that number of erase cycles will be uniform.
Secondary Storage Connections
We have talked about the popular drives used for secondary storage. Now they are connected to the computer either by a system bus or I/O bus.
- ATA: Advanced Technology Attachment
- SATA: Serial ATA
- SAS: Serial Attached SCSI
- USB: Universal Serial Bus
- FC: Fiber Channel
The most common mechanism to connect the storage devices is SATA. Although NVM requires a fast mechanism for the connection they use the method NVMe which is developed for NVM devices.
Data transferred between the storage device and the computer over the bus is controlled by the controllers. There are two controllers one at each end of the bus.
- Host controller (Controller in the computer)
- Device controller (Controller in a storage device)
Whenever a computer has to read the data from the storage device it first gives the instruction to the Host controller. The host controller sends the instruction device controller. Device controller reads the data from the storage device and puts the data in a cache. The host controller reads the data from the cache at a fast speed.
The operating system refers to storage devices as the logical blocks irrespective of the physical storage being used underneath. OS considers storage as a 1D array. Logical Block is the atomic unit of data transfer for OS and maps to physical smallest unit eg. track sector (in case of HDD) and to page (in case of NVM).
Now algorithms can be built on LBA (Logical address block) agnostic to the physical disk being used.
In practice translation of LBA to the physical address block is difficult because
- Disk many have defective sectors but mapping doesn’t address it.
- Physical address space is not sequential which is assumed by the logical addresses.
- The disk manufacturer also uses the LBA concept to internally map to the physical address space. Hence OS LBA is not directly pointing to the physical address space
CLV stands for Constant Linear Velocity
Concept: The density of each track is the same.
As we know if we go far from the center track length increases. It means the farthest track has more track sectors. As disk transfer rate remains constant it means it needs to slow down its speed for inner tracks.
DVD and CD uses the concept of CLV.
CAV stands for Constant Angular Velocity
Concept: Head speed should remain constant.
To maintain the transfer rate constant, the density of bits in the outer track has been reduced.