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.

Terminal 1
Terminal
Loading...

The possible operations are:

  • mkdir() - creates a new directory
  • creat() - creates a new (empty) file
  • open(), write(), close() - appends a block to a file
  • link() - creates a hard link to a file
  • unlink() - unlinks a file (removing it if linkcnt==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:

  1. inode bitmap - indicates which inodes are allocated

  2. inodes - table of inodes and their contents

  3. data bitmap - indicates which data blocks are allocated

  4. data - indicates contents of data blocks

The bitmaps should be fairly straightforward to understand, with a 11 indicating that the corresponding inode or data block is allocated, and a 00 ...