In: Computer Science
Problem 1 [50 pts]
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?
Things given in the qn :
No of double sided platters ( 2 surfaces - upper surface and lower surface) = 5
Each surface contains 1000 tracks
Each track contains 256 sectors
Each sector contans 512 bytes
Each block contains 8 sectors => Block size = 8 * 512 = 4096 bytes
Seek time between adajacent tracks = 1 ms //Seek time is time taken to move from one track to another is called seek time
Avg seek time between two random tracks = 25 ms & worst case = 50 ms
Disk rotates at 7200 rpm = 7200/60 = 120 rps
=> 1 rotation = 1/120 sec
Disk rotates 120 times in 1 sec, so data it traverse = 120 times
the track size
= 120 * 256 * 512 = 15,728,640 bytes
=> transfer rate = 15,728,640 Bps
File size = 1 MB, which contains 2048 equal sized records
Size of one record = 1 MB / 2048 = 512 bytes
1.
Size of a block = number of sectors * sector size = 8 * 512 = 4096
bytes
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.
Hierarchically we can write :
cylinder -> platters -> surfaces -> tracks -> sectors
->size of data
Cylinder Capacity = 1 cylinder -> 5 platters -> 2 surfaces
-> 1000 tracks -> 256 sectors -> 512 bytes =
1 * 5 * 2 * 1000 * 256 * 512 = 1,310,720,000 bytes = 1,310,720
Kbytes
3.
To read 2 blocks, i.e 2 * 4096 = 8192 bytes
To read 8192 bytes
Disk access time = seek time + rotation time + rotational latency + data transfer 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 stored sequentially, it covers = file size/track size =
ceil[1000 000 bytes / (256 times 512) bytes ] = 8 tracks
Seek time of adjacent tracks = 1 ms
=> we need 8 tracks sequentially = 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 spread randomly
File access time = avg seek time + rotation time + avg rotational latency + data transfer time
= 25 ms + 8.3 ms + (1/2) times 8.3 + 1000 000 / 15,
728,640
= 100.95 ms