Chapter 03 CPU Scheduling New
Chapter 03 CPU Scheduling New
Introduction to scheduling
Process behavior
When to schedule
Categories of scheduling algorithms
Scheduling algorithms Goals (Criteria)
Scheduling Algorithms at a glimpse
Algorithms in Batch systems
Algorithms in interactive systems
Algorithms in Real-time systems
Intro… CPU scheduling
The aim of pro. Scheduling is to assign processes to be executed
by the processor or processors over time in a way that meets the
system objectives.
Fundamentally, scheduling is a matter of managing queues to
minimize delays and to optimize performance.
Scheduling in batch systems was simple.
But in time sharing - algorithms are becoming more and more
complex.
Some main frame- use both ways
◦ The scheduler decides whether a batch job or interactive user at
the terminal should go next.
Intro… CPU scheduling …
CPU was a scarce resources on these machines. Hence,
a good algorithm can make a huge difference.
But with the advent of personal computer
processes
The greater disadvantage is when executing I/O bound
processes.
First-Come-First-Served (FCFS)
0 5 10 15 20
1
2
3
4
5
FCFS Example with I/O brust
Calculate
1. CPU Utilization
2. throughput
3. Average around time
4. Average Waiting time
5. Average Response time
FCFS example’s answer
Short Job First
1
2
3
4
5
Shortest Remaining Time Next
Preemptive version of SJF.
The shortest new job has a great advantage over all processes.
Shortest remaining time first
0 5 10 15 20
1
2
3
4
5
Three Level Scheduling
Scheduling in interactive systems
Scheduling in interactive systems
◦ Round robin scheduling
◦ Priority scheduling
◦ Multiple queuing
◦ Shortest process next
◦ Guaranteed scheduling
Round- Robin scheduling
1
2
3
4
5
Round-Robin (q=4)
DO IT YOURSELF as an exercise!!
Individual Assignment…to be submitted
on date of the next class
dynamically
◦ Statically-Role and privilege assignment in MIS systems
◦ Dynamically- I/O bound processes should be given the highest
priority after waiting for I/O response and asks to run again.
This avoid unnecessary memory hold time
A simple algorithm for giving this service is to set the priority to
1/f where f is fraction of the last quantum that the process used.
For e.g a process that uses 1 msec of its 50 msec quantum then it
will be given priority level tantamount to 50.
priority defining function:
Algorithm evaluation ??
Scheduling in different OS
windows
Solaris
Unix
Mobile OS
*******End of Chapter 3*************
Your Real Assignment
Using FCFS, SJF, SRTF, RR scheduling techniques
Calculate
◦ the turn around time
◦ throughput
◦ CPU Utilization
◦ Average Waiting time
◦ Average Response time
Assume:
1 slice = 1 CPU time
each process will be given 3 slice at a time