One way to use contiguous allocation of the disk and not suffer from holes is to compact the disk every time a file is removed. Since all files are contiguous, copying a
file squires a seek and rotational delay to read the file, followed by the transfer at full speed. Writing the file back requires the same work. Assuming a seek time of 5 msec, a rotational delay of 4 msec, a transfer rate of 8 MB/sec, and an average file size of 8 KB, how long does it take to read a file into main memory and then write it back to the disk at a new location? Using these numbers, how long would it take to compact half of a 16-GB disk?

Respuesta :

Answer:

The answer is below

Explanation:

a) Seek time = 5 msec, transfer time = 4 msec, transfer rate = 8 MB/sec = 8000 KB/sec, average file size = 8 KB

Transfer time = 8 KB ÷ 8000 KB/sec = 1 msec

The time required to read and write is twice the sum of the seek and transfer time.

Total time = (5 msec + 4 msec) * 2 + 1 msec = 19 msec

b) half of 16 GB = 8 GB = 8000000 KB

number of read and writes = (8000000 KB of total file size/ 8 KB of average file size) * 2 = 2000000

Transfer rate = 8 MB/sec = 0.008 GB/sec

Transfer time = 8 GB ÷ 0.008 GB/sec = 1000 sec

Total time = (5 msec + 4msec) * 2000000 + 1000 sec = 19000 sec