Simulating CPU scheduling
Next: Input
Up: No Title
Previous: Simulation
In order to simulate the scheduling of processes among CPUs,
one
would have to model things like
which CPUs are currently in use and
how many processes are waiting for a CPU.
In other words, one would create variables to store
this information.
Things that have no effect on CPU scheduling,
such as whether a particular process was generated by
user a148pita or user a108zeme,
need not be modelled.
The output from such a simulation
would include statistics
such as how long, on average, processes waited for a CPU.
Input to the simulation would allow one to
compare the system's performance in different situations.
For instance, we might run the simulation with different numbers of
CPUs
so that we could determine how many CPUs are required
in order for the average wait time to be within acceptable limits.
Attached to this handout are excerpts showing
what a single run of such a simulation
might look like.
Part A: Program
In this part of the assignment,
you will complete a program that performs the sort
of simulation described above.
You may want to look at section 6.5 of the text,
which contains a large example of a simulation program.
Be aware that
the textbook example
uses pointers, and differs from our simulation in two major ways:
- the items in the queue have no priorities - they are all
served
on a purely first-come first-served basis. In our simulation, the priority
of a process determines whether it gets a CPU before or after
other processes.
(If two processes have the same priority, they are served
on a first-come first-served basis.)
- the simulation is event-driven, meaning that the clock moves ahead
in leaps according to the time of the next event that will happen.
In our simulation, the clock moves ahead in equal, fixed-length ticks.
This is called a time-driven simulation.
Next: Input
Up: No Title
Previous: Simulation
Diane Horton
Mon Dec 11 15:56:16 EST 1995