Feedback on G5BADS coursework 2006-2007
Individual feedback will be sent by email. Please let me know if you
don't receive the feedback by the 2nd of February 2007.
Solution to the coursework
Generally, the best way to solve the problem was to store files and directories
is a tree-like structure. Then to create a file, one has to traverse the branch
of the tree leading to the file, which is O(p) where p is the length of the
file's path (rather than searching for the file is some list of all files and
directories). Another good idea is to store free blocks in a list and allocate
them as they are needed, not to search for free blocks linearly in the disk
array. Then space allocation is O(mf) where mf is the number of blocks a file
needs (rather than O(m) where m is the total number of blocks).
I like the program below better than my model solution, so with Iain's permission I publish his program.
Prize winner: Iain Lane
Here is his program:
FileSystem.java by Iain Lane
Other excellent programs were by:
Ian Eggleton, Marijus Kilmanas, Gerrit Kazmaier, Adam Rhodes
and others.
The test harness I used to run the programs for the prize is in
LargeTester.java (thanks to Marijus
Kilmanas for suggesting the idea of the testing program and contributing
some of the code).
To run the tester you may need to increase the heap size:
java -Xms1024m -Xmx1024m LargeTester