Question: Java Programming: Show the full code with its output. There must be no error at all. The FileManager class implemented in Part 2 directly accesses

Java Programming: Show the full code with its output. There must be no error at all.

The FileManager class implemented in Part 2 directly accesses data files (i.e., no buffering), causing disk seeks frequently. In this part, you need to implement the BufferedFileManager class so that it extends the functionalities of FileManager in a manner that benefits from buffering (i.e., frequently used pages are kept in memory, making fast read and write operations possible). Furthermore, you need to implement a page eviction policy for the cases where there are too many pages to keep in the main memory. The choice of eviction policy is up to you. It is not necessary to do something sophisticated. Describe your policy in the document that you submit. When BufferedFileManager is implemented correctly, BufferedFileManagerTest will produce some output as follows (the exact number of reads and writes may vary depending on the buffering strategy; however, there should in general be less reads and writes as the buffer size increases):

buffer size : 4 pages

1000 additions % [ { name : table0 . dat , reads : 0 , writes : 3 8 } ]

10 removals % [ { name : table0 . dat , reads : 1 0 , writes : 4 8 } ]

iteration over 990 elements % [ { name : table0 . dat , reads : 5 2 , writes : 5 2 } ]

shut down % [ { name : table0 . dat , reads : 5 2 , writes : 5 2 } ]

buffer size : 16 pages 1000 additions % [ { name : table0 . dat , reads : 0 , writes : 2 6 } ]

10 removals % [ { name : table0 . dat , reads : 9 , writes : 3 5 } ]

iteration over 990 elements % [ { name : table0 . dat , reads : 4 8 , writes : 5 1 } ]

shut down % [ { name : table0 . dat , reads : 4 8 , writes : 5 1 } ]

buffer size : 64 pages 1000 additions % [ { name : table0 . dat , reads : 0 , writes : 0 } ]

10 removals % [ { name : table0 . dat , reads : 0 , writes : 0 } ]

iteration over 990 elements % [ { name : table0 . dat , reads : 0 , writes : 0 } ]

shut down % [ { name : table0 . dat , reads : 0 , writes : 4 2 } ]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!