CEG 433/633: Operating Systems

P3: Subdirectories and Process simDisk

Weight 10%

   

This is Part 3 of the project for this term. You are expected to build on your own work of previous parts. The Project Expectations are all still applicable. Do not use source code files of others or even those of mine but from prior terms.

Our goals in this part of the project are (1) to add sub directories, and (2) to turn simDisk into a separate process.  We continue to assume that we have just one disk partition.

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. SimDisk as a Process

The simulated disk should now become a process separate from our shell process. The code of simDisk.cpp and an additional source code file named simDiskMain.cpp that you will develop will now become the simDisk process, named SD.  P3 is the name of the enhanced shell process of this part of the project.

Create two shared memory segments that P3 and SD share.  Let us call them RDSHM and WRSHM.  These are arrays of "items", each item being a pair:  a number (NX), followed by sector-sized byte array (BA). Both of these are bounded buffers.  Create also a pipe that P3 writes into and SD reads from. 

P3 is the consumer, SD is the producer for RDSHM.  SD reads a simDisk sector, and deposits the content into the next item of RDSHM.  P3 consumes this content.  P3 sends read requests to the SD process through the pipe;  each read request is just the number nSector, that is to be read.  A method in simDiskMain.cpp would read this request from the pipe and invoke uint SimDisk::readSector(uint nSector, void *p). Note that P3 must wait until the sector is read and placed fully in BA. Suppose the latest request was to read a sector numbered 153.  SD sets NX (of the next item) to 0 first. When SD is done reading this sector of the simDisk, it places the content of the sector into BA, and sets NX to 153. 

P3 is the producer, SD is the consumer for WRSHM.  SD removes an (NX, BA)-item, and writes BA as simDisk sector numbered NX.  P3 produces this content. Suppose P3 wishes to write a sector numbered 187.  P3 copies the sector content into BA of the next (NX,BA)-item, and  sets NX to 187.  SD "consumes" it by writing the BA as sector numbered 187 on the simDisk.

2. Enhancements

P1's functionality is expected, so only the additional elements are described below, with the SD now a separate process. In the following, all symbolic names that contain nm are pathnames that are either relative to the current directory or are full (i.e., absolute) pathnames. Also, the dot and the dot-dot are not permissible as arguments in some contexts below. In all cases where additional semantic details are needed, note that the our shell command names used below are standard commands in Linux/Unix, and so mimick Unix-like behavior.

fs33% mkdir dnm
creates a new empty directory named dnm in the current directory, and prints its i-node number.  If a file or directory named dnm already exists in the current directory, it creates nothing new and returns 0.
fs33% rmdir dnm
If the directory dnm is empty, deletes it.  If dnm is non-empty, no change is made in the file system. In either case, print its i-node number.
fs33% mv pnma pnmb
Note that pnma and pnmb are both pathnames within our file volume.
fs33% chdir pnm
changes the current directory to pnm. Print the i-number of the (new) current directory.
fs33% pwd
prints the i-number followed by the full path name of current directory.
fs33% lslong dnm
prints the contents of dnm directory always in the "long" format as in Unix ls -l.

3. 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. For P3, the command to use looks like this:

/home/ceg433/ceg43300/bin/turnin P3 *.cpp *.hpp Makefile *.txt



CEG 433/633: Operating Systems
Grading Sheet for

P3: Subdirectories and Process simDisk

Weight 10%
Instructor = Prabhaker Mateti
Grader = Greg Aselage
Bonus 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. Bonus points are extra credit points.
Student OSIS Login ID Bonus Points
Item description Max Points
Makefile successfully builds P3 and SD 10  
Shared mem segments corresponding to RDSHM and WRSHM coexist with P3 and SD 10  
Your P3 successfully navigates your own testscript.txt, designed so that all the P3-and-earlier functionality in the context of process SD can be demonstrated. ( If yours is too simple, we may run it through our script that you will get to see only after the due date.) 10 .
mkdir dnm 10  
chdir dnm 10  
rmdir dnm 10  
mv pnma pnmb (pnmb may not exist, but if it does, it is an ordinary file) 10  
mv pnma pnmb (pnmb exists, and is a directory; pnma may or may not exist inside pnmb) 10  
lslong 10  
pwd 10 .
Late submission: minus 2% per day late; Not accepted at all after 4 days -2% .
Files were not submitted using turnin program = minus 10 points -10 .
Total 100 .
Copyright © 2009 pmateti@wright.edu
.