Beruflich Dokumente
Kultur Dokumente
Objectives
The purpose of this programming project is to gain some experience involving the design of a
few OS components by simulation. These components include CPU management and
scheduling, process management, system queues, system statistics gathering and reporting.
Project Summary
Students work in groups of two or three, to write a simulation program in Java for testing the
performance of their designs of a few CPU scheduling algorithms for a simple computer with
limited HW / SW system, then report their findings, conclusions, and suggest improvements.
System Description
1. The Available Hardware
a. A single CPU.
b. One I/O Device.
c. Unlimited amount of Main and Secondary storage.
d. System Timer and all necessary support.
Any one of the types above can be created at any time. Type-4 has a maximum of N
instances. No new processes of this type can be created after this limit. Processes of Type-1
to Type-3 terminate after executing their last CPU burst, while processes of Type-4 never
terminate, they cycle through their pattern forever. Assume that a process in its think period
stays out of the Ready Queue, say in a special list.
em = Math.exp(-v);
x = rand(); // returns 0 < x < 1
n = 0;
while (x > em) {
n++;
x *= rand();
}
return n;
}
4. Assumptions
a) The CPU context-switching time takes 0.1 Time Units. i.e. each 10 take 1 time uint.
b) The SVC-start-I/O-interrupt takes 2 Time Units.
c) I/O-completion-interrupt takes 3 Time Units.
d) Job-scheduling overhead takes 1 Time Unit.
e) All other supervisor activities take 1 Time Unit per call.
f) The time-quantum of RR is left for each group to decide.
g) The MLFQ design parameters as given in class are left for each group to decide.
h) When the MLFQ is used, all processes are initially entered into the first level queue.
i) The response-time is defined for Type-4 jobs only, as the total time period spent from
the end of I/O2 operation to the start of I/O1 operation. This includes the CPU-burst time,
CPU-overhead and all queue delays during this period.
What to do
Write a Java program to simulate the above system. The input to the program should be
through command-line parameters as follows:
1. The total number of time steps for the run, S, integer > 100; default = 100.
2. The ready queue type, integer, 1:FCFS, 2:SJF, 3:RR, 4:MLFQ, 5:lottery; default = 1.
3. The minimum quantum size, Q, to use as a basis of RR and MLFQ, integer > 0; default = 1.
4. The maximum number of Type-4 jobs, N, integer [0 .. 100]; default = 5.
5. The expected number of new jobs arriving per time unit, v, double [0 .. 1]; default = 0.5.
6. If implemented, the minimum number of tickets, t, integer > 0; default = 5.
7. If implemented, the maximum number of tickets, T, integer > t; default = 100.
8. If implemented, the speed of giving/taking tickets, c , multiple of Q, integer > 0; default = 0.
Choose an appropriate value for Q and v, Let N=20 and S=100,000 and run your program 5
times using the same values of Q, v, N, and S but each time with a different Queue type. Also, if
implemented, choose suitable values for lottery parameters, t, T and c. Show the contents of all
system queues, only for the first 20 time steps. After each run, your output should also show all
your input values, the queue type used, and all the statistics reported by the statistics-collecting
module.
What to turn in
Your project shall be submitted through Moodle in two parts:
• A progress report is due on Monday 09/04/2018, at 11:59 pm sharp.
• A final full report is due on Monday 30/04/2018, at 11:59 pm sharp.
Your first submittal shall include the following items:
1. Your design document for the simulator. This is an important project document. It shall
include your overall system design, architecture and queuing diagram(s), your design
decisions with justification, all non-trivial algorithms and formulas, all required data
structures, and a detailed description of each function / method, that includes: its
purpose, inputs, outputs, preconditions, author and the date of last modification.
2. A project assignment schedule showing which part(s) of the project is/are assigned to
which team member and for what period of time.
3. A brief, two-page memo, summarizing the current state of the project, including: finished
parts, parts you are still working on, parts not started yet and any difficulties or problems
still not resolved (other than the usual excuses like, we had exams, computer problems,
…etc.).
Your final report shall be in one .zip file as described in item 7 below. The final report shall
include the following items:
1. The final updated version of your design document, including any critical changes you
have made since the first report and the reason(s) for the change.
2. The revised project assignment schedule showing which part(s) of the project is/are
done by which team member.
3. The program outputs of the five runs.
4. A discussion of the results of your simulation including your observations, your
conclusions and your suggestions of any possible improvements.
5. A PowerPoint presentation for your part of the project – One presentation per student.
6. A README .txt file that describes:
a. What are the difficulties, if any, that negatively affected your project outcome.
b. What requirements that you designed and realized.
c. What requirements that you designed but failed to realize, and why.
7. One .zip file containing the compressed files of your project as follows:
a. Source programs: Only .java file(s), fully documented and commented. No
executable or .class files. You must submit a clean set of files, no messy files in the
.zip file please! I will copy them to my computer and build the executables using your
source files only and run them there. So, please test your files thoroughly before you
submit them. Please note that I use Java JDK 8.
b. Your cover-page and all the documents from items 1 to 4 in .pdf form.
c. Your project presentation in .ppt form.
8. You will be asked to present your work in the project in class. To be scheduled later.
Important
1. We have given you a relatively long time period to complete your project. Should any
group submit a broken program or a non-working implementation, and no sensible
design, this will only show that the whole group is incompetent, careless or did not work
hard enough to successfully complete their project. Therefore, their entire project is
worthless and will not be evaluated. Such a group (if any) will receive zero (0) for the
project.
Please … Do not be that kind of a group.
2. All requirements must be submitted on the due dates. No late submittals will be
accepted at all.
Do not worry too much. Start working early and Enjoy. Good Luck.