CEG 433/633: Operating Systems

P1: Links and Medium Size Files

   

This is Part 1 of the project for this term.  This part deals with only one file volume at a time.  We still do not have subdirectories.  No mounting is involved.  Our goals in this part of the project is  to (i) add the ability to store and retrieve medium  files, and (ii) to add hard and soft links in a file volume built on the simulated disk of P0. Large files are not necessary in this part.

You are expected to build on your own work of P0.   Do not use source code files of others or even those of mine but from prior terms.  The Project Expectations are all still applicable.

Be Considerate. Do make sure that you are not using up too much space (say > 10 MB) in your home directory.  The following will show your disk space usage:  du -s ~

 

1. Medium Size Files

We define medium  files as those using an i-node's (i) direct block number entries, and (ii) requiring single-indirect blocks.

Large files are those using an i-node's (i) direct block number entries, and (ii) requiring single-indirect blocks, and (iii) requiring double-indirect blocks  For bonus points, implement large files also.

2. Hard and Soft Links

From the lectures, you should know the definitions of hard and soft links. Resolve any missing detail in the semantics of links so that it matches with that in Unix. (E.g., if you cd via a soft-link to directory D, where should you be after a cd .. ?)

  1. The i-nodes now need to have a link count field.
  2. The i-node types are now: ordinary-file, directory, soft-link.

DO's and DONT's:

  1. Do not permit hard links to directories.
  2. Do permit soft links to directories.

3. Shell Enhancements

Implement the commands described below. All the commands of the project so far should be working as they did before, but now also should work for links and medium files;  so only the additional elements are described below.    In your testscript.txt, demonstrate that each new command and all the old commands work with links and medium files. Note that the addition of medium files does not bring in any "new" commands.

fs33% mkfs disknm
creates an initially empty file volume, as before, on the simulated disk named disknm.dsk.  Note that the i-node height now includes not only the fileSize field, but also the link count.
fs33% findfs disknm
re-creates the previously created file volume object on the simulated disk named disknm.dsk.  All files etc. that were created in previous sessions on this volume remain intact.   The file volume so re-constructed is the current file volume as used in later commands.  If disknm.dsk is not already created, do so now, making this then equivalent to mkfs disknm.
fs33% ln opnm npnm
creates npnm  as a new hard link to  opnm, and prints its i-node number.  It creates nothing new and returns 0 in the following "abnormal" cases: a) opnm is a directory; b) no ordinary file with opnm as its path name exists; c)  npnm already exists; d) npnm is an invalid pathname.
fs33% ln opnm .
creates a hard link named the same as the leaf name of opnm in the current directory and prints its i-node number.  Abnormal cases similar to the above apply.  For bonus points, add the flexibility that this command may omit the dot.
fs33% ln -s opnm npnm
creates npnm as a soft link to opnm, and prints its i-node number.  It creates nothing new and returns 0 in the following "abnormal" cases: a) opnm does not exist; b) npnm already exists; c) npnm is an invalid pathname.
fs33% rm pnm
removes the pathname pnm, which may or may not be a link, and prints the resulting link count.

4. Compiling and Linking

Compile, link and make P1 as implied by a decent extension of the Makefile given in P0.tbz.  As you make P1, collect the following information in a file called answers.txt.

  1. Collect all the symbols imported by shell.cpp.  And, for each imported symbol, note which source code file is exporting the corresponding item.
  2. Note the names of libraries needed by the P1.
  3. List the file sizes of all the object code files, and compare the sum-total with the size of the P1 executable.  Explain why the sum of files sizes does not equal the file size of P1.
  4. List the numbers produced by the command named size on the object code files, and P1.  Explain why the sum of corresponding numbers of individual files do/do-not equal those of P1 as given by size.

5. Submissions

All submissions must be done in the OSIS Lab using the turnin program. We will be running your programs on the machines in OSIS Lab only.  The command to use for this part looks like this:

/home/ceg433/ceg43300/bin/turnin P1 names-of-files-you-wish-to-submit


Grading Sheet for P1:  Links and Medium Size Files
CEG 433/633: Operating Systems

Instructor = Prabhaker Mateti
Grader = Greg Aselage
Weight 5%
Extra credit points are awarded in recognition of good work and extra work, in addition to the max possible points.  Quality is subjectively judged.  Merely turning in a file will not receive full score.  Some items have a cascading effect.
Student OSIS Login ID Bonus Points
Item description Max Points
Your testscript.txt should be designed so that all the P0-functionality in the context of the new links and medium sized files can be demonstrated, including robustness. 5  
Your P1 successfully navigates your own testscript.txt. ( If yours is too simple, we may run it through our script that you will get to see only after the due date.) 5  
cp works with medium size files 10  
mv works with medium size files 10  
rm works with medium size files 10  
ln opnm npnm 10  
ln opnm . (dot at the end) 5  
ln -s opnm npnm 5  
cp hard-link-pnm pnm 5  
cp soft-link-pnm pnm 5  
rm hard-or-soft-link-pnm 5  
mv soft-link-pnm pnm 5  
mv hard-link-pnm pnm 5  
inode updated to show all i-node fields 5  
answers.txt 10  
ln opnm no-dot (bonus points) B10  
Large files (bonus points) B50  
Late submission: minus 2% per day late; Not accepted at all after 4 days -8  
Files were not submitted using turnin program = minus 10 points -10  
Total 100  
 
Copyright © 2009 pmateti@wright.edu