Operating Systems--Spring 2005
Home | | Schedule | |
Assignments | | Lecture Notes
Project 3 Part 2: FCFS simulator
Part 2 Checkpoint (see below) due: Friday, April 8
Part 2: FCFS simulator (40 points) due: Friday, April 15
For information about the overview of the entire project and about input and output
formats, review the project description.
Part 2: Implement the FCFS 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 FCFS simulation code should be in one file, named "fcfs.cc", to be used in conjunction
with the driver contained in driver.cc
- All enum definitions and struct definitions should be in a file, "sim.h", that should
be included in both driver.cc and fcfs.cc
- The main( ) function will still be in driver.cc.
- Use #include "fcfs.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 fcfs( ) function should be short. It should initialize necessary variables, call a
function to initialize the event queue, and then enter the getNextEvent loop.
- You should include the following separate functions:
- simFCFS( )--the function called by the driver
- initEventQueue( )--Initialize the event queue at the start of the simulation function.
- handleEvent( )--Determine which event occured and call the appropriate function.
- handle_new_ready( )--Handle the transition from NEW to READY for a given process.
- handle_ready_run( )--Handle the transition from READY to RUNNING for a given process.
- handle_run_term( )--Handle the transition from RUNNING to TERMINATED for a given process.
- handle_run_block( )--Handle the transition from RUNNING to BLOCKED for a given process.
- handle_block_ready( )--Handle the transition from BLOCKED to READY for a given process.
- We discussed in class what needs to be accomplished in each of these functions. You should
write one at a time and test thoroughly before writing the next one. Use lots of cout statements
for testing purposes (you can remove them later).
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.)
- 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.
- The answers to the following four questions:
- Does your simulator include process switch overhead for the
first ready state to running state transition? Explain.
- Does your simulator include process switch overhead if a process
moves from ready state to running state and the CPU is idle? Explain.
- Does your simulator include process switch overhead if a process
moves from running state to blocked state? Explain.
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.
Project 3 part 2 checkpoint:
For the project 2 checkpoint, you must complete the following functions:
- simFCFS( )
- initEventQueue( )
- handleEvent( )
- handle_new_ready( )
- handle_ready_run( )
- handle_run_term( )
Your checkpoint code should run correctly for a list of processes for which each process
has only 1 CPU burst and no I/O bursts.
You do not have to collect the statistics for the checkpoint. You may add that code for the
final version. However, you would be wise to consider how you will collect the appropriate data
as you are writing the code.
On Friday, April 8, you will each have a short meeting with me (during the regular lecture time)
to present your progress so far.
You should be prepared to discuss how your program is working and any problems you have encountered.
Turning in your project:
Part 2, checkpoint:
- Turn a hard copy of your fcfs.cc and sim.h files.
by Friday, April 8 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, fcfs.cc and sim.h by typing:
~csci346/bin/submit csci346 proj3part2check
- If you used files other than those provided in the project3 directory, please email
the associated files to me at croyden@mathcs.holycross.edu before class on the due date.
- Be prepared to discuss your progress so far.
Part 2, final version:
- Turn a hard copy of your fcfs.cc and sim.h files.
by Friday, April 15 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, fcfs.cc and sim.h by typing:
~csci346/bin/submit csci346 proj3part2
- If you used files other than those provided in the project3 directory, please email
the associated files to me at croyden@mathcs.holycross.edu before class on the due date.
- Turn in the typed essay and answers to the four questions 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: February 10, 2005
Page Expires: January 8, 2006