Download presentation
Presentation is loading. Please wait.
1
Process Control Management
Operating Systems Process Control Management Prepared by: Dhason
2
Topic & Structure of the lesson
CPU scheduling Preemptive scheduling algorithms Non-preemptive scheduling algorithms Calculations using preemptive scheduling algorithms
3
Learning Outcomes At the end of this lecture YOU should be able to:
- explain the importance of CPU scheduling - distinguish between preemptive and non-preemptive algorithms - calculate waiting time and turnaround time
4
CPU Scheduling process to run first from the ready queue
a CPU scheduler is tasked with choosing which process to run first from the ready queue a scheduling algorithm is used to choose the next process scheduling is a fundamental function of an operating system scheduling is done to ensure that the CPU is not idle
5
Aims of CPU Scheduling fairness
- to make sure all processes get a fair share of the CPU time - to avoid starvation efficiency - to maximize CPU utilization and keep the CPU busy close to 100% of the time response time to provide consistent response time to minimize response time
6
Aims of Scheduling turnaround time
- to minimize time between submission and job completion throughput - to maximize the number of jobs completed within a given time period
7
Types of CPU scheduling
preemptive and non-preemptive scheduling: preemptive scheduling: - allows for processes running to be temporarily suspended processes releases CPU upon receiving a command from the operating system - preemptive scheduling algorithm: - round robin
8
Non-preemptive Scheduling
- processes releases the CPU only after completion - processes releases CPU voluntarily - non-preemptive scheduling algorithms: - first come first serve or first in first out (FCFS), ( FIFO) - shortest job first - priority
9
Quick Review Questions
Why is CPU scheduling important? What is the difference between preemptive and non-preemptive scheduling? Give 1 example each for a preemptive and non-preemptive scheduling algorithm
10
Calculation Keywords CPU utilization / burst time throughput
turnaround time - average turnaround time waiting time average waiting time
11
Round Robin the oldest, simplest, fairest and most widely used algorithm designed for time-sharing systems a time quantum / time slice is defined for each process the ready queue is treated as a circular queue to implement round robin, the ready queue is kept as a first in first out queue
12
Step1:- Draw a Gantt Chart to represent timings for all processes
Round Robin Step1:- Draw a Gantt Chart to represent timings for all processes P1 P2 P3 P4 P5 Step2:- Calculate waiting time and average value TW(P1) = ( )=9 TW(P2) = 2 TW(P3) = 3 Tw(P4) = 5 Tw(P5) = (6+2+2)=10 TW(average)=( )/5 =5.8 Milliseconds 2 3 5 6 8 10 12 14 15 17 19 Time Slice = 2 Milliseconds Process Burst Time (Milliseconds) P1 10 P2 1 P3 2 P4 P5 5
13
Round Robin Step-3: Calculate turn-around time and average value P1 P2 P3 P4 P5 2 3 5 6 8 10 12 14 15 17 19 TT = Tw+TB Time Slice = 2 Milliseconds TT(P1)=(9+10)=19 Process Burst Time (Milliseconds) P1 10 P2 1 P3 2 P4 P5 5 TT(P2)=(2+1) = 3 TT(P3)=(3+2) = 5 TT(P4)=(5+1) = 6 TT(P5)=(10+5)=15 Average turn around time is ( )/5 = (48/5)=9.6 Milliseconds
14
Round Robin the average waiting time is usually long
performance depends on the size of the time quantum (10 – 100 milliseconds) process switching requires time; the time quantum clock is already running time quantum which is set to short would result in too many process switches and this reduces CPU efficiency time quantum which is too long would cause poor response to short interactive request (would result to FIFO)
15
Question and Answer Session
Q & A
16
Next Session CPU Scheduling Non-preemptive Algorithms
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.