Disk Abstraction & HDD Theory Flashcards
How are discs seen by a OS?
Disks can be seen by a OS as a collection of data blocks that can be read or written independently
How the management of the discs blocks are done
Each block is characterized by a unique numerical address called LBA (logical block address)
How does an operational system access the disk?
The OS groups blocks into clusters to simplify the access to the disk. Clusters are the minimal unit that a OS can read from or write to
What are the contents inside clusters
The disc can contain several types of clusters. Clusters could contain file data, which are the actual contents of the files, and meta data, which is the information requires to support the file system (it could be file names, directory structures, file size, or file type,…)
How does a reading and writing procedure occurs?
In a reading, first we need to access the meta data to locate its blocks. Then we access the blocks to read its content.
In a writing, otherwise, we access the Meta data to locate free space in order to be able to write the data in the assigned blocks
What are the impacts of the fact that the OS can only access clusters on the disks sizes, and how does this relation impact on the waste of space?
Since the file system can only access clusters, the occupation of space on a desk for a file is always a multiple of the cluster size
These multiplicity could cause some clusters to not be fully filled with data. What represents a waste of space which is called internal fragmentation.
Example:
filesize=27byte
cluster size = 8 byte
actual size on the disk
a = ceil(27 / 8) * 8 = ceil(3.375)*8 = 4 *8 = 32 byte
Wasteddiskspace=32–27=5byte
How does a deletion happens in a disk?
This procedure just requires an update in the metadata to say that the blocks where the file was stored are no longer in used by the OS.
Deleting a file never actually deletes the data on the disk, when the new file will be written on the same clusters, the old data will be replaced by the new one
What happens when there is not enough space to story file contiguously
In this case, the file is split into smaller chunks that are inserted into the free clusters spread over the disk.
The efect of splitting a file into non-contiguous clusters is called external fragmentation
What is a hard disk drive and how data is read from it?
It consists of one or more rigid rotating discs with magnetic heads, arranged on a moving actuator arm to read and write data to the surfaces.
Data is read in a random accesses manner, meaning individual blocks of data can be stored or retrieved in any order rather than sequentially.
What are the four types of delay in a HDD?
The rotational delay, which is the time to rotate the desired sector to the read head, and is related to the revolution per minute of the drive motor
The seek delay, which is the time to move the read head to a different track
The transfer time which is the time to read or write bites
And the controller overhead, which is the overhead for the request management
How is the seek time calculated?
It is calculated considering a linear dependency with the distance. The result is: a third of the maximum seek time
What is the transfer time?
It is the final phase of the I/O, and considers the time to either read from or right to the surface. It also includes the time for the head to pass on the sectors.
read/write of a sector of 512 Byte = 0.5 KB
data transfer rate: 50 MB/sec
rotation speed: 10000 RPM (round per minute)
mean seek time: 6ms
overhead controller: 0.2ms
mean latency: (60s/min)x1000/(2x10000 rpm) = 3.0ms (time for 1⁄2 round)
transfer time: (0.5KB)x1000 / (50x1024KB/s) = 0.01ms
Mean I/O service time = 6ms + 3ms + 0.01ms + 0.2ms = 9.21ms
How does data locality influences on the mean I/O service time calculation?
The original calculation considers only the very pessimistic case where sectors are fragmented on the disk in the worst possible way, in which each access to a sector requires to pay rotational agency and see time
In many circumstances, this is not the case, files are larger than one block, and they are stored in a contiguous way
Therefore, data locality reduces the rational and seek agencies
How can we measure the data locality of a disk?
We can measure the data locality of a disk as the percentage of blocks that do not need seek or rotational latency to be found