CMSC 341 Project 1
|Assigned||Feb 15, 2012|
|Due||11:59pm Feb 28, 2012|
BackgroundLists are one of the fundamental abstract data types. This project will give you experience in using List operations, writing or modifying List code and using List iteratators in the context of a dynamic disk file allocation system.
DescriptionOne of the fundamental tasks of every operating system is the management of the disk blocks used to store data in files. In this project you will implement a very rudimentary disk file manager. In our hypothetical operating system, the disk is divided into disk blocks. Each disk block is divided into bytes. The file manager is responsible for keeping track of unused (free) disk blocks and all necessary information about every file. The file manager supports the following operations for files
- Create a new file with a specified name and size in bytes
- Delete an existing file, freeing all disk blocks allocated to the file
- Extend an existing file by a specified size in bytes, allocating new disk blocks if necessary
- Shorten (truncate) an existing file by a specified size in bytes, freeing any disk blocks if possible
You will implement the classes necessary to implement this project following acceptable OO design principles.
The number of disk blocks in our system and the number of bytes per disk block will be specified as command line arguments.
- Use CVS to checkout your repository for this project. Your repository will contain a generic build.xml file that you must modify for this project.
- Implement a linked list class, list node class and list iterator class.
No Java classes that implement the List interface (LinkedList, ArrayList, etc) may be used. The latest version of the author's code found in Mr. Frey's public directory
/afs/umbc.edu/users/f/r/frey/pub/341/Project1/MyLinkedList.javamay be used as a starting point, but be advised that it may require editting before it works perfectly. See the textbook errata sheet.
- Implement a class that contains main( ) and its supporting methods.
- Implement the classes necessary to support the file manager's functionality.
- Create command file(s) to test your code. Feel free to post your command files and resulting output on blackboard to share with other students.
- Use CVS to commit all of your source files and your build.xml file. DO NOT commit your .class files.
- Use the course cvs utilities to verify that your project will be built and executed correctly by the project grading scripts.
linux3> java Project1 -Dargs="20000 1024 /path/to/the/command/file"The format of the command file is described in the command file section below.
The command file format follows. Note that command names are in UPPERCASE, filenames will not contain spaces and all sizes will be positive.
- CREATE <filename> <size in bytes> — creates a new file with the specified name and size in bytes
- DELETE <filename> — deletes the specified file
- EXTEND <filename> <number of bytes> — increases the size of the file by the specified number of bytes.
- TRUNCATE <filename> <number of bytes> decreases the size of the file by "removing" the specified number of bytes from the end of the file. If the size of the file is zero after truncating, the file should be deleted.
- PRINT -- Prints the state of the file manager and all existing files
The following information is required for PRINT
- The disk block size in bytes (from the command line)
- The total number of disk blocks (from the command line)
- The number of allocated blocks
- The number of free blocks
- The list of free blocks printed as ranges in sorted order by disk block number (see the sample output)
- All relevant information about each file in sorted order by filename
- Actual size in bytes
- Allocated size in bytes
- Number of disk blocks allocated
- List of blocks allocated to the file as ranges in sorted order by disk block number
here. The sample output was created by this command file.
Project Notes, Hints and Requirements
- Insufficient disk space when an request to allocate disk blocks cannot be fulfilled because there are not enough free blocks. In this case the file is unchanged and no blocks are allocated.
- No such file whenever an attempt is made to extend, truncate, or delete a non-existing file.
- Duplicate file whenever an attempt is made to create a file that already exists.
- File Underflow whenever an attempt is made to truncate a file by more bytes than are in the file. In this case, the file should remain unchanged and no disk blocks are freed.
Project grading is described in the
Project Policy handout. Note that proper class and method documentation
via javadoc is required.
Cheating in any form will not be tolerated. Please re-read the Project Policy handout for further details on honesty in doing projects for this course.