Simulator
This lesson explains how to interact with the simulator for the exercise presented in the next lesson.
We'll cover the following...
In this exercise, you will use the simulator, vsfs.py
, to study how file system state changes as various
operations take place. The file system begins in an empty state, with just a
root directory. As the simulation takes place, various operations are
performed, thus slowly changing the on-disk state of the file system.
The possible operations are:
mkdir()
- creates a new directorycreat()
- creates a new (empty) fileopen()
,write(
),close()
- appends a block to a filelink()
- creates a hard link to a fileunlink()
- unlinks a file (removing it iflinkcnt==0
)
To understand how this exercise functions, you must first understand how the on-disk state of this file system is represented. The state of the file system is shown by printing the contents of four different data structures:
-
inode bitmap - indicates which inodes are allocated
-
inodes - table of inodes and their contents
-
data bitmap - indicates which data blocks are allocated
-
data - indicates contents of data blocks
The bitmaps should be fairly straightforward to understand, with a indicating that the corresponding inode or data block is allocated, and a ...