Operating Systems Lab3: File Systems.

Due: Friday Dec 15th at 11:59pm


In this lab you will have the opportunity to work with a simulation of an early UNIX file system. Once again we will use the MOSS simulator kit. The filesystem simulator is a more complete-feeling simulator than the memory management simulator. You will have the opportunity to dig into the system calls and the guts of the file system to gain a better understanding of file systems.


First get the simulator package. I've already created a sample file system and added two files to it in this setup. copy
~jsantore/OSlab3.zip to your directory and unzip it to work. This will create a folder called lab3 containing the MOSS filesystem simulator and the starter filesysystem.

After copying the file, you may need to recompile it. Move into the directory and do a javac *.java.

Next you should read the MOSS filesystem user manual for a better understanding of what the simulator does and how to use it. There is some additional information about setting up filesystems in the instillation manual webpage linked from the user manual. You should read both and try several of the program out to see how they work. Try out the ls, and dump programs at very least.

For your labwork you will do two of the exercises suggested for use with this simulator. All of the exercises would be very useful to help you learn more about how a file system is implemented. However, given the limited time remaining in the semester, we will implement two of the easier exercises.

  1. Enhance the file system simulator to include a new method, Kernel.chown(), which, given the name of a file, a uid, and a gid, sets the file's uid and gid to the values given. Note that only the owner of a file (or the super-user) may change the gid of a file. Only the super-user may change the uid of a file. To test your new method, write two new programs chown.java and chgrp.java which accept a uid or gid (respectively) and a list of file or directory names.
  1. Enhance the file system simulator to include a new method, Kernel.link(), which, given two path names, creates the second path as a (hard) link to the first path. link() should find the inode number for the first file, and then write a directory entry for the second path which references the same index node. Don't forget to increment nlink on the index node. To test your new method, write a new program, ln.java, which, given two path names, performs the link() operation. Assume that creating a link to a directory is not allowed.
The uid and gid are the numeric identifiers for a user and a group respectively. The super-user and UID 0 in UNIX.

Develop a readme file with the following information:
  1. Your name
  2. A short set of instructions for running your two programs
  3. A 2-3 paragraph discussion of what you did for each program and the decisions you made.
  4. As always, if there is anything not quite finished, let me know in this part of the readme.


Zip up your entire lab3 folder as before

Then attach it to an email in pine and send it to me.