edited by
973 views
1 votes
1 votes
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 requires 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 $80\: 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?
edited by

1 Answer

0 votes
0 votes
It takes 9msec to start the transfer (due to 5msec seek and 4msec rotation delay).

To read 8KB at the transfer rate of 223 bytes/sec (8MB/sec) requires 2^−10 sec (0.977msec). Hence the total time to seek, rotate and transfer is 9.977msec.

Writing back takes another 9.977msec. Thus copying an average file takes 19.954msec.

To compact half of a 16GB disk would involve copying 8GB of storage, which is 2^20 files. At 19.954 msec per file, this takes 20,923 seconds, which is 5.8 hours. Clearly, compacting the disk after every file removal is not a great idea.

Related questions

0 votes
0 votes
0 answers
1
admin asked Oct 26, 2019
222 views
Some digital consumer devices need to store data, for example as files. Name a modern device that requires file storage and for which contiguous allocation would be a fin...
0 votes
0 votes
0 answers
2
admin asked Oct 26, 2019
187 views
In light of the answer to the previous question, does compacting the disk ever make any sense?
0 votes
0 votes
0 answers
3