================ Start Lecture #9 ================
Processor Sharing (PS, **, PS, PS)
Merge the ready and running states and permit all ready jobs to be run
at once. However, the processor slows down so that when n jobs are
running at once, each progresses at a speed 1/n as fast as it would if
it were running alone.
Clearly impossible as stated due to the overhead of process
Of theoretical interest (easy to analyze).
Approximated by RR when the quantum is small. Make
sure you understand this last point. For example,
consider the last homework assignment (with zero context switch
time and no blocking)
and consider q=1, q=.1, q=.01, etc.
Show what happens for 3 processes, A, B, C, each requiring 3
seconds of CPU time. A starts at time 0, B at 1 second, C at 2.
Also do three processes all starting at 0. One requires 1ms, one
100ms and one 10 seconds.
Redo this for FCFS and RR with quantum 1 ms and 10 ms.
Note that this depends on the order the processes happen to be
The effect is huge for FCFS, modest for RR with modest quantum,
and non-existent for PS.
We will do this again for PSJF so please remember the answers we
Variants of Round Robin
- State dependent RR
- Same as RR but q is varied dynamically depending on the state
of the system.
- Favor processes holding important resources.
- For example, non-swappable memory.
- Perhaps this should be considered medium term scheduling
since you probably do not recalculate q each time.
External priorities: RR but a user can pay more and get
bigger q. That is one process can be given a higher priority than
another. But this is not an absolute priority: the lower priority
(i.e., less important) process does get to run, but not as much as
the higher priority process.
Each job is assigned a priority (externally, perhaps by charging
more for higher priority) and the highest priority ready job is run.
Similar to “External priorities” above
If many processes have the highest priority, use RR among them.
Can easily starve processes (see aging below for fix).
Can have the priorities changed dynamically to favor processes
holding important resources (similar to state dependent RR).
Many policies can be thought of as priority scheduling in which we
run the job with the highest priority (with different notions of
priority for different policies).
For example, FIFO and RR are priority scheduling where the
priority is the time spent on the ready list/queue.
As a job is waiting, raise its priority so eventually it will have the
This prevents starvation (assuming all jobs terminate or the
policy is preemptive).
Starvation means that some process is never run, because it
never has the highest priority. It is also starvation, if process
A runs for a while, but then is never able to run again, even
though it is ready.
The formal way to say this is “No job can remain in the ready
There may be many processes with the maximum priority.
If so, can use FIFO among those with max priority (risks
starvation if a job doesn't terminate) or can use RR.
Can apply priority aging to many policies, in particular to priority
scheduling described above.