Tutorial 1 5
Tutorial 1 5
Tutorial 1 5
1
(g) Calculate the average time it would take to transfer 20
random blocks and compare it with the time it would take
to transfer 20 consecutive blocks using double buffering to
save seek time and rotational delay.
Answer:
(e) Transfer rate tr= (total track size in bytes)/(time for one disk
revolution in msec)
2
time to transfer 20 consecutive blocks using double buffering = s + rd +
20*btt = 30 + 12.5 + (20*1) = 62.5 msec
(a more accurate estimate of the latter can be calculated using the bulk
transfer rate as follows: time to transfer 20 consecutive blocks using double
buffering = s+rd+((20*B)/btr) = 30+12.5+ (10240/409.6) = 42.5+ 25 = 67.5
msec)
3
(d) Assume the file is ordered by SSN; calculate the time it
takes to search for a record given its SSN value by doing a
binary search.
Answer:
(c) For linear search we search on average half the file blocks= 5000/2=
2500 blocks.
i. If the blocks are stored consecutively, and double buffering is used, the
time to read 2500 consecutive blocks = s+rd+(2500*(B/btr))=
30+12.5+(2500*(512/409.6)) = 3167.5 msec = 3.1675 sec (a less accurate
estimate is = s+rd+(2500*btt)= 30+12.5+2500*1= 2542.5 msec)
ii. If the blocks are scattered over the disk, a seek is needed for each block,
so the time is: 2500 * (s + rd + btt) = 2500 * (30 + 12.5 + 1) = 108750 msec =
108.75 sec
(d) For binary search, the time to search for a record is estimated as:
ceiling(log 2 b) * (s +rd + btt) = ceiling(log 2 5000) * (30 + 12.5 + 1) = 13 *
43.5 = 565.5 msec = 0.5655 sec