In: Computer Science
Consider a hard disk drive that has 5 double-sided platters, each surface has 1000 tracks, each track has 256 sectors of size 512 bytes. Each block (disk page) comprises of 8 sectors. The seek time between adjacent tracks in 1ms and the average seek time between two random tracks is 25ms. The disk rotates at a speed of 7200 rpm (revolutions per minute).
Let’s say, we have a file of size 1 MB and it contains 2048
equal-sized records.
1. What is the size of a block? How many records fit in a block?
How many blocks are required to store the
entire file?
2. What is the capacity of each cylinder?
3. What is maximum time (worst case) to read two blocks from the disk (the blocks to be read are part of the same read request and no external factors affect the read latency)?
4. If the file is stored “sequentially”, how long will it take to read the whole file? Assume that for sequential writes data are written in adjacent tracks once a track is full.
5. If the blocks in the file are spread “randomly” across the disk, how long will it take to read the whole file?
Given:
5 platters, double sided ( 2 surfaces, (upper surface and lower surface))
Each surface has 1000 tracks;
Each track has 256 sectors;
Each sector has 512 bytes;
Each block contains 8 sectors = so size = 8 512 = 4096 bytes;
Seek time between adajacent tracks = 1 ms; (Seek time is time taken to move from one track to another);
Average seek time between two random tracks = 25 ms; worst case = 50 ms
Disk rotates at 7200 rpm = 7200/60 = 120 rps; so 1 rotation = 1/120 sec
in 1 sec disk rotates 120 times; so data it traverse = 120 track size = 120 256 512 = 15,728,640 bytes
so transfer rate = 15,728,640 Bps
File size: 1 MB; containing 2048 equal sized records; Each record size = 1 MB / 2048 = 512 bytes
1. Size of a block = number of sectors sector size = 8 512 = 4096 bytes;
each record size = 512 bytes; number of records fit in a block = block size/ record size = 4096/512 = 8 records;
number of blocks required to store 1MB = 1MB/4096 = 256 blocks
2. Capacity of cylinder;
(hierarchy is like: cyliinder -> platters -> surfaces -> tracks -> sectors ->size of data)
capacity = 1 5 2 1000 256 512 = 1,310,720,000 bytes = 1,310,720 Kbytes
3. Want to read 2 blocks, i.e 2 4096 = 8192 bytes ;
Disk access time = seek time + rotation time + rotaional latency + data trasfer time;
= 50 ms + 1/120 sec + 1/120 sec + 8192/15,728,640 sec
= 50 ms + 0.0083 sec + 0.0083 sec + 0.00052 sec
= 50 ms + 8.3 ms + 8.3 ms + 0.52 ms = 67.12 ms;
4. if file is stored sequentially, it covers = file size/track size = ceil[1000 000 bytes / (256 512) bytes ] = 8 tracks;
seek time of adjacent tracks = 1 ms; so 8 tracks sequentially need = 8 1 = 8 ms;
file access time = seek time + rotation time + rotational latency + data transfer time
= 8 1 ms + 8.3 ms + 8.3 ms + 1000 000 / 15, 728, 640
= 8 ms + 8.3 ms + 8.3 ms + 63.5 ms = 88.1 ms
5. if the blocks are spread randomly;
file access time = avg seek time + rotation time + avg rotational latency + data transfer time
= 25 ms + 8.3 ms + (1/2) 8.3 + 1000 000 / 15, 728,640
= 100.95 ms