SlideShare a Scribd company logo
OPERATING SYSTEM
CPU Scheduling
Algorithm
SCHEDULING CRITERIA
There are many scheduling algorithms and various
criteria to judge their performance some criteria are
as follows:
o CPU Utilization: CPU should be busy (from 0 to
100%)
o Throughput: the number of process executed in a
specified time period
o Turnaround time: needed to execute a process
o Waiting Time: amount of time a process has
waited
o Response Time: between request and response
A CPU SCHEDULING ALGORITHM
MUST MAXIMIZE THE FOLLOWING
CPU utilization should maximum
Throughput should maximum
A CPU SCHEDULING ALGORITHM MUST
MINIMIZE THE FOLLOWING:
 Waiting Time should minimum
 Response Time should minimum
 Turnaround Time should minimum
SCHEDULING ALGORITHMS:
Below is the list of some well known
algorithms
First Come First Served (FCFS)
scheduling- non preemptive
Shortest job First(SJF) scheduling
preemptive non preemptive
Priority Scheduling preemptive non
preemptive
Round robin scheduling preemptive
TIMELINES:
Scheduling is based on the information
that is available at the give time. we
need some ways to represent the state
of the system and any process in it
and how it change over time.
Gantt chart are used for this purpose
to present them in graphical way.
GANTT CHART
1st Process 2nd Process More Processes
1st process end time 2nd Process end time…… End time.
Start time p1 end time p2end time……End time.
First come First Served (FCFS)
•Simplest
•Similar to queue
Operating system
Process Name Start Time Burst Time
Process 1 0 24
Process 2 0 3
Process3 0 3
Example 1
Process1 Process2 Process3
0 24 27 30
FCFS
 The following table shows the waiting time for each
process:
Average Waiting time is(0+24+27)/3=17
Process
name
Arrival
time
Burst time Finish time Waiting
time
Process1 0 24 24 0
Process2 0 3 27 24
Process3 0 3 30 27
Gantt chart
P1 P2 P3
0 3 6
30
Process Name Start Time Burst Time
Process 2 0 3
Process 3 0 3
Process1 0 24
Example 2
Process
name
Arrival time Burst time Finish time Waiting
time
Process2 0 3 3 0
Process3 0 3 6 3
Process1 0 24 30 6
Average Waiting time is (0+3+6)/3= 3
Shortest Job First:
Another way to scheduling jobs is
to pick the job that will take least
amount of time to complete, based
on burst size. In this way the
average waiting time reduced.
•Normal SJF
•Non preemptive
• Preemptive
Operating system
Operating system
Non preemptive SJF Example:
Process name Arrival time Burst time
Process1 0 7
Process2 2 4
Process3 4 2
Process4 5 4
Process name Arrival time Burst time Finish time Waiting time
Process1 0 7 7 0
Process2 2 4 13 7
Process3 4 2 9 3
Process4 5 4 17 8
Process name Arrival time Burst time
Process1 0 7
Process2 2 4
Process3 4 1
Process4 5 4
Preemptive SJF Example 2
Process name Arrival time Burst time Finish time Waiting time
Process1 0 7 16 9
Process2 2 4 7 1
Process3 4 1 5 0
Process4 5 4 11 2
Requires that each process should
have priority associated with it.
Priority scheduling:
Priority scheduling Example for Non Preemptive
Process name Burst Time Priority
Process1 10 3
Process2 1 1
Process3 2 3
Process4 1 4
Process5 5 2
Process2 Process5 Process1 Process3 Process4
Priority scheduling Example Preemptive
Process name Arrival time Burst time Priority
Process1 0 10 3
Process2 2 1 1
Process3 4 2 2
Process4 6 1 4
Process5 8 5 5
Gantt Chart
0 1 6 16 18 ` 19
P1 P2 P1 P3 P1 P2 P5
Round robin scheduling
Gantt Chart
0 2 3 4 6 13 14
19
Another way to schedule jobs is to assign a small amount of
time to each process in which it executes. This time the unite
is called time quantum or tie slice, the job is allocated to CPU
for the quantum. when the time quantum expires, the process
preempted from CPU and replaced by next process in the
circle queue.
Operating system
Process name Burst time
Process1 24
Process2 3
Process3 3
Gantt Chart
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
(10+7+30)/3=16
THANKS…..
DO YOU HAVE
ANY QUESTION?

More Related Content

PPT
Ch6
 
PPTX
Round Robin Scheduling Algorithm
PPTX
CPU Scheduling Algorithms
PPTX
Presentation assembly
PPTX
First Come First Serve & Shortest Job First-(FCFS & SJF)
PPTX
CPU Scheduling
PPTX
SCHEDULING ALGORITHMS
PDF
Cpu Schedule Algorithm
Ch6
 
Round Robin Scheduling Algorithm
CPU Scheduling Algorithms
Presentation assembly
First Come First Serve & Shortest Job First-(FCFS & SJF)
CPU Scheduling
SCHEDULING ALGORITHMS
Cpu Schedule Algorithm

What's hot (10)

PPTX
Operating systems-presentation
DOC
Operating Systems Third Unit - Fourth Semester - Engineering
PDF
Cpu scheduling
PPTX
Operating Systems - Process Scheduling
PPTX
CPU Sheduling
PPTX
Dbms recovering from a system crash
Operating systems-presentation
Operating Systems Third Unit - Fourth Semester - Engineering
Cpu scheduling
Operating Systems - Process Scheduling
CPU Sheduling
Dbms recovering from a system crash
Ad

Similar to Operating system (20)

PPTX
Operating system
PDF
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
PPTX
CPU scheduling
PPT
Cpu scheduling
PPT
OS-operating systems- ch05 (CPU Scheduling) ...
PPTX
Operating systems - Processes Scheduling
PPTX
3Chapter Three- CPU Scheduling this is the best.pptx
PDF
PPTX
Cpu scheduling
PPTX
Week 5a.pptx of cpu scheduling operating system class
PPT
Operating System Scheduling
PPT
Process management in os
PPT
Window scheduling algorithm
PPT
operating system Scheduling process unit 3.ppt
PPTX
CPU Scheduling Lecture 5 - 6.pptx
PDF
cpu schduling ppt.pdf
PDF
Unit iios process scheduling and synchronization
PPTX
Chapter 3 - Operating System Scheduling.pptx
PDF
CH06.pdf
Operating system
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
CPU scheduling
Cpu scheduling
OS-operating systems- ch05 (CPU Scheduling) ...
Operating systems - Processes Scheduling
3Chapter Three- CPU Scheduling this is the best.pptx
Cpu scheduling
Week 5a.pptx of cpu scheduling operating system class
Operating System Scheduling
Process management in os
Window scheduling algorithm
operating system Scheduling process unit 3.ppt
CPU Scheduling Lecture 5 - 6.pptx
cpu schduling ppt.pdf
Unit iios process scheduling and synchronization
Chapter 3 - Operating System Scheduling.pptx
CH06.pdf
Ad

Recently uploaded (20)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
01-Introduction-to-Information-Management.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Pre independence Education in Inndia.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Institutional Correction lecture only . . .
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
master seminar digital applications in india
PPTX
Pharma ospi slides which help in ospi learning
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Basic Mud Logging Guide for educational purpose
O7-L3 Supply Chain Operations - ICLT Program
01-Introduction-to-Information-Management.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Pre independence Education in Inndia.pdf
Sports Quiz easy sports quiz sports quiz
Institutional Correction lecture only . . .
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
master seminar digital applications in india
Pharma ospi slides which help in ospi learning
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Supply Chain Operations Speaking Notes -ICLT Program
Final Presentation General Medicine 03-08-2024.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Basic Mud Logging Guide for educational purpose

Operating system

  • 2. SCHEDULING CRITERIA There are many scheduling algorithms and various criteria to judge their performance some criteria are as follows: o CPU Utilization: CPU should be busy (from 0 to 100%) o Throughput: the number of process executed in a specified time period o Turnaround time: needed to execute a process o Waiting Time: amount of time a process has waited o Response Time: between request and response
  • 3. A CPU SCHEDULING ALGORITHM MUST MAXIMIZE THE FOLLOWING CPU utilization should maximum Throughput should maximum
  • 4. A CPU SCHEDULING ALGORITHM MUST MINIMIZE THE FOLLOWING:  Waiting Time should minimum  Response Time should minimum  Turnaround Time should minimum
  • 5. SCHEDULING ALGORITHMS: Below is the list of some well known algorithms First Come First Served (FCFS) scheduling- non preemptive Shortest job First(SJF) scheduling preemptive non preemptive Priority Scheduling preemptive non preemptive Round robin scheduling preemptive
  • 6. TIMELINES: Scheduling is based on the information that is available at the give time. we need some ways to represent the state of the system and any process in it and how it change over time. Gantt chart are used for this purpose to present them in graphical way.
  • 7. GANTT CHART 1st Process 2nd Process More Processes 1st process end time 2nd Process end time…… End time. Start time p1 end time p2end time……End time. First come First Served (FCFS) •Simplest •Similar to queue
  • 9. Process Name Start Time Burst Time Process 1 0 24 Process 2 0 3 Process3 0 3 Example 1 Process1 Process2 Process3 0 24 27 30
  • 10. FCFS  The following table shows the waiting time for each process: Average Waiting time is(0+24+27)/3=17 Process name Arrival time Burst time Finish time Waiting time Process1 0 24 24 0 Process2 0 3 27 24 Process3 0 3 30 27
  • 11. Gantt chart P1 P2 P3 0 3 6 30 Process Name Start Time Burst Time Process 2 0 3 Process 3 0 3 Process1 0 24 Example 2
  • 12. Process name Arrival time Burst time Finish time Waiting time Process2 0 3 3 0 Process3 0 3 6 3 Process1 0 24 30 6 Average Waiting time is (0+3+6)/3= 3
  • 13. Shortest Job First: Another way to scheduling jobs is to pick the job that will take least amount of time to complete, based on burst size. In this way the average waiting time reduced. •Normal SJF •Non preemptive • Preemptive
  • 16. Non preemptive SJF Example: Process name Arrival time Burst time Process1 0 7 Process2 2 4 Process3 4 2 Process4 5 4
  • 17. Process name Arrival time Burst time Finish time Waiting time Process1 0 7 7 0 Process2 2 4 13 7 Process3 4 2 9 3 Process4 5 4 17 8
  • 18. Process name Arrival time Burst time Process1 0 7 Process2 2 4 Process3 4 1 Process4 5 4 Preemptive SJF Example 2
  • 19. Process name Arrival time Burst time Finish time Waiting time Process1 0 7 16 9 Process2 2 4 7 1 Process3 4 1 5 0 Process4 5 4 11 2
  • 20. Requires that each process should have priority associated with it. Priority scheduling: Priority scheduling Example for Non Preemptive Process name Burst Time Priority Process1 10 3 Process2 1 1 Process3 2 3 Process4 1 4 Process5 5 2
  • 21. Process2 Process5 Process1 Process3 Process4 Priority scheduling Example Preemptive Process name Arrival time Burst time Priority Process1 0 10 3 Process2 2 1 1 Process3 4 2 2 Process4 6 1 4 Process5 8 5 5 Gantt Chart 0 1 6 16 18 ` 19
  • 22. P1 P2 P1 P3 P1 P2 P5 Round robin scheduling Gantt Chart 0 2 3 4 6 13 14 19 Another way to schedule jobs is to assign a small amount of time to each process in which it executes. This time the unite is called time quantum or tie slice, the job is allocated to CPU for the quantum. when the time quantum expires, the process preempted from CPU and replaced by next process in the circle queue.
  • 24. Process name Burst time Process1 24 Process2 3 Process3 3 Gantt Chart P1 P2 P3 P1 P1 P1 P1 P1 0 4 7 10 14 18 22 26 30 (10+7+30)/3=16

Editor's Notes

  • #2: Raeesa imtiaz