CS 445/445G Project 1: A Simple File System
(due on the class on 03/03/17)
In this project, you will implement a simple simulated file system. This project will let you get
familiar with important data structures in a file system, including i) volume control block, ii) the directory
structure, iii) open file tables (system-wide and per-process), and iv) File Control Block (FCB). You will
also learn how basic file operations, such as open(), interact with these data structures.
Before we describe the tasks of this project, we make the following assumptions. The simulated file
system is implemented on main memory. More specifically, a slot of main memory of 1M is used to
simulate a disk. We assume that a data block is of 2K. Therefore, the disk has 512 blocks. In this
project, we assume the disk is a data disk, i.e., no OS installed. So the first data block is used as the
volume control block. We assume that the volume control block contains the following items:
number of blocks
size of block
a free-block count
a bit-map of free blocks
Table 1: Volume control block
We assume that the file allocation (i.e., data block allocation) is contiguous allocation. For simplicity,
our file system uses a flat directory structure to manage files. In other words, the directory contains no
subdirectories. With the assumption of contiguous allocations, the content of the directory of our file
the system can be organized as a table as follows:
file name start block number file size
file1 0 2
file3 6 3
Table 2: Flat directory structure.
To be consistent with the contiguous allocation, the FCB contains the following items:
pointer to the first data block
Table 3: File control block (FCB).
A system-wide open file table is a set of FCBs of open files. An example of a system-wide open file
table is shown in Table 4.
Given a specific process, its per-process open file table contains a set of file handles of files opened
by the process. For example, assume that a process has open files: f1 and f4, its per-process table will
be the one shown in Table 5.