You are on page 1of 16

CPU Scheduling Algorithm

(Part 3)
DR. NELSON C. RODELAS
Round Robin
• It is simple, easy to implement, and starvation-free as all processes
get fair share of CPU.
• One of the most commonly used technique in CPU scheduling as a
core.
• It is preemptive as processes are assigned CPU only for a fixed slice of
time at most.
• The disadvantage of it is more overhead of context switching.
Round Robin
Example:In this Example, there are six jobs A, B, C, D, E and F. Their
arrival time and burst time are given below in the table. q=4

Process ID Arrival Time Burst Time

A 0 5
B 1 6
C 2 3
D 3 1
E 4 5
F 6 4
Process Arrival Burst
ID Time Time
Timeline:
A 0 5
B 1 6
C 2 3
D 3 1
E 4 5

Gantt F 6 4

Chart
Round Robin
Example:In this Example, there are five jobs A, B, C, D, E and F. Their
arrival time and burst time are given below in the table. q=2

Process ID Arrival Time Burst Time

A 0 5
B 1 3
C 2 1
D 3 2
E 4 3
Process Arrival Burst
Timeline: ID Time Time

A 0 5
B 1 3
C 2 1
D 3 2

Gantt E 4 3

Chart
Multilevel Queue Scheduling Algorithm
• Processes are easily classified into different groups
• It partitions the ready queue into several separate queues
• Each queues has its own scheduling algorithm
• Example Queues:
• System Processes
• Interactive Processes
• Interactive Editing Processes
• Batch Processes
• Student Processes
Multilevel Queue Scheduling Algorithm
Example: Consider the table below of four processes under MLQ.
Queues number denotes the queue of the process.
Q1: RR (q=2)
Q2: FCFS
Process ID Queue Arrival Time Burst Time

A 1 0 4
B 1 0 3
C 2 0 8
D 1 10 5
Process Queue Arrival Burst
Timeline: ID Time Time

A 1 0 4
B 1 0 3
C 2 0 8
D 1 10 5
Gantt
Chart
Multilevel Queue Scheduling Algorithm
Example: Consider the table below of five processes under MLQ.
Queues number denotes the queue of the process.
Q1: RR (q=4)
Q2: RR (q=3)
Process ID Queue Arrival Time Burst Time

A 2 0 10
B 1 3 7
C 2 4 6
D 1 12 5
E 1 18 8
Process Queue Arrival Burst
ID Time Time
Timeline:
A 2 0 10
B 1 3 7
C 2 4 6
D 1 12 5
E 1 18 8

Gantt
Chart
Multilevel Feedback Queue Scheduling
Algorithm
• Allows a process to move between queues
• It is used to separate processes with different CPU burst
characteristics
Multilevel Feedback Queue Scheduling
Algorithm
Example: Consider the table below of five processes under MLQ.
Queues number denotes the queue of the process.
Q1: RR (q=17)
Q2: RR (q=25)
Q3: FCFS
Process ID Arrival Time Burst Time

A 0 53
B 0 17
C 0 68
D 0 24
Process ID Arrival Time Burst Time

A 0 53
B 0 17
C 0 68
D 0 24

Gantt
Chart
Multilevel Feedback Queue Scheduling
Algorithm
Example: Consider the table below of five processes under MLQ.
Queues number denotes the queue of the process.
Q1: RR (q=10)
Q2: RR (q=20)
Q3: FCFS
Process ID Arrival Time Burst Time

A 0 12
B 8 25
C 21 33
D 30 2
Process ID Arrival Time Burst Time

A 0 12
B 8 25
C 21 33
D 30 2

Gantt
Chart

You might also like