We have nfiles that we need to store on disk. Each file is longer than bytes, where bytes are stored on the disk page . We can store each file as a whole on a page or split it between two consecutive pages. Serial files must be stored on one or subsequent pages. We will access the files in order and perform calculations on each of them. Each time we turn to a new file, which is not completely on the same page as the previous file, we have service data for reading the page in main memory. In addition, if the file is split between two pages, we have overheadf1...fnfisi <= BBTpagefiTsplit * sifor cache misses during calculation. We want to find an efficient algorithm for storing files in memory that minimizes overall overhead.
Algorithms for this task are considered effective if they work in time O(nB).
MY APPROACH:
Reinstalling the files seems to minimize misses. However, the statement says that sequential files should be stored on the same or sequential pages. This means that we cannot reorder to best fit the available pages. However, since the files are read sequentially, when reading data, we can “look ahead” to see if the current page we read contains the next file or not. Maintaining the index of the start and end points of a file can help so that when reading a file we can check whether it contains the next file.
Can someone suggest a dynamic programming algorithm for this problem?
source
share