CS 3733 Operating Systems, Process Scheduling Simulator Notes
Some students are confused about the relationship between the duration
and the CPU burst parameters.
Here is how the simulator calculates the next CPU burst of a process:
- The simulator keeps track of the total CPU time used by a process.
- No process will ever use more CPU time than its duration parameter.
- The simulator calculates a new CPU burst for a process when the process
just starts out or when it finishes its I/O.
- It uses the CPU burst distribution, to get a new CPU burst.
- If the sum of this value and the CPU time used so far is greater than
the duration, the CPU burst value us decreased accordingly so that this
will be the last CPU burst of the process.
- This (possibly reduced) value is stored with the process when it enters
the ready queue and is used by some algorithms (such as SJF) to decide
which process to schedule next.
- A process terminates after using the CPU when the total CPU time used
is equal to the duration.
- If you set the duration to constant 10 and the
CPU burst distribution to
uniform 20 30,
the first and only CPU burst used by that process will
be 10 units and the process will not do any I/O.