Scheduling

Tenets: Coordination and Synchronization

Mechanism Algorithms:

Round Robin

A | B | C | D | ...
  ^
  delta context switch
Arrival Run Wait
A 0 5 0
B 1 2 $\delta$
C 2 9 2$\delta$
D 3 4 3$\delta$

Average wait: 0.75 $\delta\quad \checkmark$ (fastest)

However, throughput is decreased: $\dfrac{1-\delta}{1}$

What about Round Robin + new processes at start of line?

However, unfair—new processes will always be scheduled, but long processes may never finish.

Instead, put arrivals at the end of the queue

This avoids starvation (process never gets resources required)

Priority Scheduling

What if you have certain events:

A: garbage scheduling

B: real-time interrupt

Some events need to be dealt with more quickly. One approach: highest priority first.

Note: Linux processes have a “niceness” factor. [-20, 20].

A process with niceness 20 is very nice: will let anyone run

A process with niceness -20 is very mean: is very greedy and will want to run as soon as possible

There is a concept of static vs dynamic priorities: