Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
What we cover:
Basic concepts
Scheduling Criteria
Scheduling Algorithms
Multiple-Processor Scheduling
Real-Time Scheduling
Algorithm Evaluation
Max throughput
FCFS is non-preemptive.
P1 P2 P3
0 24 27 30
P2 P3 P1
0 3 6 30
α =0
τn+1 = τn
Recent history does not count.
α =1
τn+1 = tn
Only the actual last CPU burst counts.
Two schemes:
nonpreemptive – once CPU given to the process it cannot be
preempted until completes its CPU burst.
preemptive – if a new process arrives with CPU burst length less
than remaining time of current executing process, preempt. This
scheme is known as the Shortest-Remaining-Time-First (SRTF).
SJF (non-preemptive)
P1 P3 P2 P4
0 3 7 8 12 16
P1 P2 P3 P2 P4 P1
0 2 4 5 7 11 16
P2 P5 P1 P3 P4
0 1 6 16 18 19
CSC 4103: Operating System 6.19 BB Karki, LSU
Priority Scheduling
Problem ≡ Starvation
Low priority processes may never be executed.
e.g., a low-priority process submitted in 1967 never ran until
the shutdown of IBM 7094 at MIT in 1973.
Solution ≡ Aging
As time progresses, increase the priority of the process.
Performance
q large ⇒ FIFO
q small ⇒ q must be large with respect to context switch, otherwise
overhead is too high.
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
Time quantum needs to be large enough with respect to the context switch time.
Context switch increases the waiting and turnaround time.
Different methods:
Deterministic modeling
Queuing models
Simulations
Implementation.
Queuing models
CPU burst distribution
Arrival time distribution
Little’s formula:
average queue length = average arrival rate X
average waiting time in the queue.
Compute one variable if you know the other two.
Priority-based
scheduling
Algorithm
Inverse relationship
between priorities
and time quanta.
Priority ranges
Real-time range (0 to 99)
Nice value range (100 to 140)
Priority arrays
Active array - tasks with time remaining in their time slices
Expired array - all expired tasks
Once active array is done, the expired array is changed to the
active array.
FCFS scheduling is the simplest approach but it can hurt short processes
SJF scheduling is optimal, providing shortest average waiting time. It suffers from
problems of predicting the length of the next CPU burst and starvation. SJF can be
preemptive or non-preemptive.
RR allocates the CPU to all processes in time slice so it is appropriate for time-sharing
system. RR is always preemptive.
Multilevel queue algorithms allow different algorithms in different queues (interactive and
background) and also allow processes to move from one queue to another.