Nachos Phase 5
File System
The fifth phase of Nachos is to implement a file system. In previous phases the file system is implemented in the StubFileSystem
, which simply uses Java File IO methods to support the very fundamental operations of a file system. In this phase you are going to build a real file system of your own with minimum use of the file system of the host operating system. You are going to support some basic operations such as creating and deleting of files, accessing and organizing files hierarchically, as well as some advanced operations like symbolic link and hard link.
Originality is highly encouraged in this phase. Your work will be rewarded bonus regarding its performance, architecture, extensibility and any other features it presents. It is not required however recommended that you write a well organized report to demonstrate your innovation.
Table of Contents
|
Description
To help you better implementing your code in this phase, a basic framework is provided in nachos.filesys
for you to start with. You can feel free to delete them all and develop your own framework if you prefer. The underlying design and implementation of the file system is open to you, as long as the file system support all the functionality described in the task section below.
The classes provided in this phase are:
-
nachos.machine.Disk
– a simulation of the hard disk whose operations are asynchronous -
nachos.machine.SynchDisk
- provide synchronous accesses to the disk -
nachos.filesys
– a basic framework of nachos file systemwhere you can start from.
To fulfill the tasks of this phase, the classes in the basic framework nachos.filesys
are designed as follows:
-
INode.java
- The holder of all the basic information about a file, such as file size, file position, etc. In the provided framework, the Inodes of a file are organized into a list, each Inode occupies one segment. Note that unlimited size of a file is achieved by using the list organization.
-
File.java
- Extended from OpenFile. In previous phase you are using StubOpenFile, what you need to do is to turn them into a real file class, which supports basic I/O operations on the simulated disk.
-
Folder.java
- A special File which manages the structural organization of files. Therefore it contains each file’s name, location, etc. Since the file size is unlimited, each folder can potentially hold unlimited number of files, whose name length is also unlimited. The Inode of the root folder is stored in a predefined location.
-
FreeList.java
- A special File which manages the free space of the disk. The FreeList is stored as a bit map which indicates the allocation information of disk segments (so the size of the FreeList is constant). The Inode of the FreeList is also stored in a predefined location.
Initially your file system is empty with no files. You should import all the files in the stub file system (the test directory) into the root of your own file system when you see FilesysKernel.format = true
in the configure file.
Tasks
- Implement File that supports basic I/O operations
- Use
nachos.machine.SynchDisk
to read/write on the simulated disk
- Use
- Implement Inode that supports unlimited file size
- allow user to create files as large as the disk size
- allow the
write()
syscall to extend the size of a file
- Implement hierarchical directory structure
- support access of the files in the directory
- support hierarchical structure
- support unlimited filename length
- be consistent with Unix style (i.e. use / instead of \)
- Implement disk space allocation
- support reuse of space (i.e. when a portion of the space will not be used any longer, it should be collected by the file system for later use)
- Implement syscall
- support
mkdir
,rmdir
,chdir
,getcwd
- support
ls
(you may need two extra syscalls:readdir
andstat
) - support
link
,symlink
(notice: when unlink a linked file, the space will freed only when the number of links is zero) - you may refer to
syscall.h
for the definition of the above syscalls
- support
- Miscellaneous
- support absolute and relative path
- support "." and ".."
- support deletion of the current folder
- Support synchronizations (optional)
- guarantee the consistency of your file system
- support exclusive write and concurrent read