Implement a simple file system for the IAS machine.
Your file system will not actually execute on the IAS simulator. You will write your file system in C. Your code will interface with a simple emulation of an IAS-style magnetic drum. You will be given code for the emulation of the drum.
A magnetic drum has from 10 to 256 sectors. Sectors are numbered starting with 0. Each sector contains 32 40-bit words.
The emulation code includes the following routines:
The first word in a sector is a control word that the user of the file system should not see. The control word should be used by the file system to link together the sectors of a file.
Your file system should assume that IAS words are stored in Little Endian format in the memory of the C test programs. This means, in particular, when you write sector numbers in sector 0 or in word 0 of data sectors, you should write them in Little Endian format.
Your file system should support up to ten files. Files are simply referred to by number, 0 to 9. A file is a sequence of sectors.
A file can be empty. If a file is not empty, then it has a current sector. This is the sector that will be read next.
Your file system should support the following routines:
The next seven words in sector 0 should contain a bit vector indicating which sectors in the disk are in use (bit is 1) and which are free (bit is 0). Increasing sector numbers are tracked by increasing bit position and then increasing word position. So bit 0 of the first word corresponds to sector 0 of the disk. This bit is always set to 1 because sector 0 is always in use containing the control information. Bit 10 of the first word corresponds to sector 10 of the disk. Bit 0 of the second word corresponds to sector 40 of the disk. Bit 10 of the second word corresponds to sector 50 of the disk. And so on.
Bits in the seven words that do not have a corresponding sector (because the disk is smaller than 280 sectors) should be set to 1.
When you are searching for a free sector, you should choose the free sector with the smallest sector number.
The last five words of sector 0 should all contain 0.
Your implementation should be performed using C. Put all your C code in a file called fs.c. Use the keyword static to mark all routines other than the mandatory routines listed above. Your code should not use any global variables or any static local variables. All information to be remembered between calls to the file system must be stored only on the drum.
The four file system routines will each be worth 25 points.
The magnetic drum emulation code is available in ~cs611/public/prog7. This directory also contains a Makefile and some test programs that can be used to exercise your file system.
Your programs will be graded using a CIS Linux machine (e.g. turing.unh.edu) so be sure to test in that environment.
Your program will be graded primarily by testing it for correct functionality. However, you may lose points if your program is not properly structured or adequately documented.
Your assignment should be submitted for grading from a
CIS Linux machine (e.g. turing.unh.edu).
To turn in this assignment, type:
~cs611/bin/submit prog7 fs.c
Submissions can be checked from a CIS Linux machine by typing:
~cs611/bin/scheck prog7
To receive full credit for the assignment, you must turn in your files prior to 8am on Monday December 16. Late submissions will be accepted at the penalty of 5 points per day up to one week late.
Remember: as always you are expected to do your own work on this assignment. Copying code from another student or from sites on the internet is explicitly forbidden!
If you developed your code on a DOS/Windows system, be sure to appropriately transfer your files to a CIS Linux system before submitting them. You need to convert the DOS ASCII file format to UNIX format. If you need help with this, please see me.
Comments and questions should be directed to hatcher@unh.edu