Operating Systems--Spring 2011
Home | | Schedule | |
Assignments | | Lecture Notes
Project 3 Part 3: SRTN simulator
Part 3: SRTN simulator (30 points) due: Thursday, May 5
For information about the overview of the entire project and about input and output
formats, review the project description.
Part 3: Implement the SRTN simulator along with the appropriate output code (for
the appropriate flags) and the required statistics ( the CPU utilization (NOT CPU efficiency),
the total time required to execute the set of processes, and the service time (or CPU time),
I/O time, and turnaround time for each individual process.)
Your implementation should fulfill the following requirements:
- The SRTN simulation code should be in one file, named "srtn.cc", to be used in conjunction
with the driver contained in driver.cc. You may want to start with a copy of your fcfs.cc file.
Name the copied file, "srtn.cc" and modify it to implement the srtn scheduling algorithm instead
of the fcfs algorithm.
- Your srtn.cc file does not need to duplicate the functions that are the same for both
algorithms (and that you have defined in fcfs.cc). In fact, if you duplicate these functions
you will get compiler errors indicating there is a re-definition of the function. For example
the initEventQueue( ) function probably doesn't change for the two algorithms, so simSRTN can use the one
defined in fcfs.cc.
- Any functions that differ between the two algorithms you will need to include in your
srtn.cc code. You need to give these functions different names than you gave them in fcfs.cc.
For example, you may have handle_ready_run( ) in fcfs.cc, and a similar function named
handle_ready_run2( ) in srtn.cc. That way you can avoid compiler problems.
- All enum definitions and struct definitions should be in a file, "sim.h", that should
be included in both driver.cc and srtn.cc
- The main( ) function will still be in driver.cc.
- Use #include "srtn.cc" in your driver.cc file. You can then compile with a single command:
g++ driver.cc -o sim
This will put the executable code into a file named "sim".
- The srtn( ) function should be short. It should initialize necessary variables, call a
function to initialize the event queue, and then enter the getNextEvent loop.
- Your SRTN simulation will need to use the same functions as the FCFS simulation,
although some of them will be changed to run the SRTN algorithm. You need only include
the modified functions (with new names as described above) in the srtn.cc file. In addition, you will
need a function "handle_run_ready( )" to handle cases when a process is preempted.
- We discussed in class what needs to be modified in fcfs.cc to make srtn.cc run.
Use lots of cout statements for testing purposes (you can remove them later) and test each
modification as you write it.
In addition to your code, you must also turn in:
- A short essay (2-3 paragraphs) that explains how
your solution works and any assumptions you made.
(If you make any assumption because you think the problem is not
well specified, make sure to discuss these assumptions.) Be sure to
explain what does not work in your implementation.
- If the driver to your simulation does not function as the
specifications above request, then include
information to execute each individual scheduling algorithm
without using a driver.
You are encouraged to discuss the problem with fellow students.
You are not allowed to share code with any other student.
It would be wise to start early.
Turning in your project:
Part 3, final version:
- Turn a hard copy of your srtn.cc and sim.h files.
by Thursday, May 5 in class.
- If you use any associated files (e.g. list.h and list.cc), note that in the program
header of your printout. If the files are not the ones provided in the project3 directory,
include printouts of the files you used.
- Before class, submit a soft copy of driver.cc, srtn.cc, fcfs.cc and sim.h by typing:
~csci346/bin/submit csci346 proj3part3
- If you used files other than those provided in the project3 directory or the 4 files
listed above, check the submit instructions by typing:
~csci346/bin/submit -h
Make sure to submit all your extra files according to the instructions.
- Turn in the typed essay and explanation outlined above.
Home | | Schedule | |
Assignments | | Lecture Notes
Constance Royden--croyden@mathcs.holycross.edu
Computer Science 346--Operating Systems
Date Created: January 9, 2004
Last Modified: March 23, 2011
Page Expires: January 8, 2012