Sub topic 9
SSDs and Files: Access, Attributes, and Operations
Assume you know processes, system calls, kernel mode, interrupts, binary units, and basic averages and ratios. This chapter connects storage hardware to the file-system interface used by programs.
SSDs and why seek-based scheduling matters less
A hard disk drive (HDD) stores data on rotating magnetic platters. Reading a block requires moving a disk arm to the correct track and waiting for the platter to rotate. These delays are called seek time and rotational latency.
A solid-state drive (SSD) stores data in flash memory. It has no moving arm and no rotating platter. Its controller reads data through electronic memory channels. Therefore, an SSD does not have the same physical head movement that FCFS, SSTF, or SCAN tries to reduce.
An SSD access still has several components:
- Controller and queueing delay: time spent waiting for the SSD controller to process the request.
- Flash translation delay: time used to map a logical block address to physical flash cells.
- Read time: time needed to transfer the requested data.
- Bus transfer time: time used to move data over SATA, NVMe, or another interface.
A scheduler can still improve SSD performance by reducing queueing, combining adjacent requests, or giving priority to urgent requests. However, choosing the request with the smallest logical block distance usually gives little benefit. Logical addresses do not represent physical distance in the same way they do on a hard disk.
| Property | HDD | SSD |
|---|---|---|
| Mechanical seek | Important | Absent |
| Rotational latency | Present | Absent |
| Useful scheduling goal | Reduce head movement | Reduce queueing and improve fairness |
| Main endurance concern | Mechanical wear | Limited flash write cycles |
A simple model can estimate the difference:
def hdd_access_ms(seek, rotation, transfer):
return seek + rotation + transfer
def ssd_access_ms(queue, translation, transfer):
return queue + translation + transfer
print(hdd_access_ms(8.0, 4.2, 0.3)) # 12.5
print(ssd_access_ms(0.05, 0.02, 0.3)) # 0.37Files: attributes and operations
A file is a named collection of persistent data managed by the operating system. The operating system hides the device-specific block layout and gives programs a file abstraction.
Common file attributes include:
- Name: the human-readable name in a directory.
- Identifier: a file-system-specific value that identifies the file.
- Type: information such as regular file, directory, device file, or symbolic link.
- Location: pointers to the data blocks containing the file.
- Size: the logical length of the file in bytes.
- Protection: permissions or access-control rules.
- Timestamps: creation, modification, and last-access times.
- Owner: the user or group associated with the file.
Common file operations are create, open, read, write, seek, close, delete, and truncate. The open operation checks permissions and returns a file descriptor, which is a small process-local integer. Later operations use this descriptor instead of repeatedly supplying the file name.
The kernel stores an open-file entry containing the current file offset, access mode, and other state. Two descriptors can refer to the same open-file entry, so they can share a file offset.
Exercise
Why does SSTF provide less physical benefit on an SSD than on an HDD, and what does open return to a process?
Show answer
An SSD has no moving disk head, so logical block distance does not directly represent mechanical movement. SSTF may still affect queueing but does not remove seek time. The open operation returns a file descriptor.