Unit 4 OS
Unit 4 OS
M.A. Zahed
Lecturer
Unit IV: Scheduling
CPU Scheduling
⚫Basic Concepts
⚫Scheduling Criteria
⚫Scheduling Algorithms
Objectives
⚫ Maximum CPU
utilization obtained
with
multiprogramming
⚫ CPU–I/O Burst Cycle –
Process execution
consists of a cycle of
CPU execution and
I/O wait
⚫ CPU burst followed
by I/O burst
⚫ CPU burst distribution
is of main concern
CPU Scheduler
Short-term scheduler selects from
among the processes in ready queue, and
allocates the CPU to one of them
Queue may be ordered in various ways
CPU scheduling decisions may take place
when a process:
1. Switches from running to waiting state
2. Switches from running to ready state
3. Switches from waiting to ready
4. Terminates
Dispatcher
P2 P3 P1
0 3 6 30
P1 P2 P4 P1 P3
0 1 5 10 17 26
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
● Pi requests instance of Rj
P
i
Rj
● Pi is holding an instance of Rj
P
i
Rj
● Detection algorithm
● Recovery scheme
● Rollback – return to some safe state, restart process for that state