Storing Files on Tape
Understand the different techniques used to solve the storing files on tape problem efficiently.
Introduction to storing files
Suppose we have a set of files that we want to store on a magnetic tape. In the future, users will want to read those files from the tape. Reading a file from tape isn’t like reading a file from a disk; first, we have to fast-forward past all the other files, and that takes a significant amount of time. Let be an array listing the lengths of each file; specifically, file has length . If the files are stored in order from to , then the cost of accessing the th file is:
Expected cost of accessing a random file
The cost reflects the fact that before we read file , we must first scan past all the earlier files on the tape. If we assume for the moment that each file is equally likely to be accessed, then the expected cost of searching for a random file is:
...