SlideShare ist ein Scribd-Unternehmen logo
1 von 14
INTRODUCTION
o The CPU scheduling is used to improve its
efficiency.
o It is used to allocate resources among competing
processes.
o Maximum CPU utilization is obtained with
multiprogramming.
• The processes which are to be executed are in ready queue.
• Every time the running process is blocked , the process in the
ready queue takes over the CPU.
o A process may be
• I/O BOUND: Involves more I/O operation. Ex : reading from
disk.
• CPU BOUND: Involves more computation. Ex : calculating the
sum of 2 numbers from memory.
PROCESS STATES
o The 3 states of a process are ready , running and
wait states.
o CPU scheduling is affected by the following set
of circumstances:
• A process switches from running to waiting state.
• A process switches from running to ready state .
• A process switches from waiting to ready state .
• A processes switches from running to terminated state.
CPU SCHEDULING CRITERIA
o CPU Utilization: Percent of time that the CPU is
busy executing a process.
o Throughput: Number of processes executed per
unit time.
o Turnaround Time: The interval of time between
submission of a process and its completion.
o Waiting Time: The amount of time the process
spends in the ready queue waiting for the CPU.
o Response Time: The time between submission
of requests and first response to the request.
First Come First Served(FCFS)
o The process which enters the queue first is
executed first.
o It is non-preemptive.
Process Arrival Service TT NTT
P1 0 6 6 1
P2 2 4 8 2
P3 4 1 7 7
P1 P2 P3
0 6 10 11
FCFS
o Advantages:
It is simple and easy to understand.
o Disadvantages:
The process with less execution time suffer.
Favours CPU bound process then I/O bound
process.
Shortest Job First(SJF)
o The process with the lowest execution time is
executed first.
o It can be either preemptive or non preemptive.
Process Arrival Service TT NTT
P1 0 6 6 1
P2 2 4 9 2.2
P3 4 1 3 3
P1 P3 P2
0 6 7 11
SJF
o Advantages:
Shortest jobs are favoured.
o Disadvantages:
When there are more number of shorter jobs,
longer jobs starve.
Priority Scheduling(PS)
o Each process is associated with priority and the
CPU is allocated to each of them based on their
priorities.
o Multiple process with same priority are dealt
using FCFS.
Process Arrival Service TT NTT
P1 0 6 6 1
P2 2 4 8 2
P3 4 1 7 7
P1 P2 P3
0 6 10 11
PS
o Advantages:
Priority scheduling provides a good mechanism
where the relative importance of each process may be
precisely defined.
o Disadvantages:
• If high priority processes use up a lot of CPU
time, lower priority processes may starve and be
postponed indefinitely.
• The situation where a process never gets
scheduled to run is called starvation.
• Another problem with priority scheduling is
deciding which process gets which priority level
assigned to it.
Round Robin(RR)
o Each process is allotted a time slot(q). After this
time has elapsed, the process is pre-empted and
added to the end of the ready queue.
o Performance of the round robin algorithm
◦ q large  FCFS
◦ q small  q must be greater than the context
switch time; otherwise, the overhead is too high
RR
Process Arrival Service TT NTT
P1 0 6 12 2
P2 2 4 8 2
P3 4 2 2 1
q=2
o Advantages:
Round robin scheduling is fair in that every process
gets an equal share of the CPU.
P1
0 62
P2
4
P3 P1
8
P2
10
P1
12
RR
o Disadvantages:
Setting the quantum too short, increases the overhead
and lowers the CPU efficiency, but setting it too long
may cause poor response to short processes.
ANALYSIS AND RESULTS
o Comparing the average turnaround time and
waiting time, the algorithms are ranked as
SJF,FCFS and PS.
o Based on average CPU utilization the algorithms
are ranked as FC,PS and SJF.
o In terms of execution speed, FCFS was found to
be consistently faster than PS and SJF.
Thus according to the performance
measure the corresponding scheduling algorithm
is recommended to the CPU.

Weitere ähnliche Inhalte

Was ist angesagt?

Approaches to real time scheduling
Approaches to real time schedulingApproaches to real time scheduling
Approaches to real time schedulingKamal Acharya
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OSvampugani
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process SchedulingDamian T. Gordon
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Schedulingvampugani
 
Operating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatzOperating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatzGiulianoRanauro
 
cpu scheduling
cpu schedulingcpu scheduling
cpu schedulinghashim102
 
Difference Program vs Process vs Thread
Difference Program vs Process vs ThreadDifference Program vs Process vs Thread
Difference Program vs Process vs Threadjeetendra mandal
 
Process scheduling algorithms
Process scheduling algorithmsProcess scheduling algorithms
Process scheduling algorithmsShubham Sharma
 
6 multiprogramming & time sharing
6 multiprogramming & time sharing6 multiprogramming & time sharing
6 multiprogramming & time sharingmyrajendra
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process managementArnav Chowdhury
 
Real Time OS For Embedded Systems
Real Time OS For Embedded SystemsReal Time OS For Embedded Systems
Real Time OS For Embedded SystemsHimanshu Ghetia
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)nikeAthena
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process ConceptsMukesh Chinta
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process SchedulingShipra Swati
 
CPU scheduling
CPU schedulingCPU scheduling
CPU schedulingAmir Khan
 

Was ist angesagt? (20)

Approaches to real time scheduling
Approaches to real time schedulingApproaches to real time scheduling
Approaches to real time scheduling
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Operating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatzOperating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatz
 
cpu scheduling
cpu schedulingcpu scheduling
cpu scheduling
 
Difference Program vs Process vs Thread
Difference Program vs Process vs ThreadDifference Program vs Process vs Thread
Difference Program vs Process vs Thread
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Process scheduling algorithms
Process scheduling algorithmsProcess scheduling algorithms
Process scheduling algorithms
 
6 multiprogramming & time sharing
6 multiprogramming & time sharing6 multiprogramming & time sharing
6 multiprogramming & time sharing
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Real Time OS For Embedded Systems
Real Time OS For Embedded SystemsReal Time OS For Embedded Systems
Real Time OS For Embedded Systems
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
 
Rtos Concepts
Rtos ConceptsRtos Concepts
Rtos Concepts
 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 

Ähnlich wie CPU scheduling algorithms in OS

first come first serve scheduling in os
first come first serve scheduling in os first come first serve scheduling in os
first come first serve scheduling in os mikeemukesh
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithmsPaurav Shah
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)Harshit Jain
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdfKp Sharma
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.pptKeyreSebre
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - EngineeringYogesh Santhan
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdfAliyanAbbas1
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxansariparveen06
 
Scheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxScheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxRevathi Kmp
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Nagarajan
 
Window scheduling algorithm
Window scheduling algorithmWindow scheduling algorithm
Window scheduling algorithmBinal Parekh
 
Round-ribon algorithm presntation
Round-ribon algorithm presntationRound-ribon algorithm presntation
Round-ribon algorithm presntationJamsheed Ali
 

Ähnlich wie CPU scheduling algorithms in OS (20)

first come first serve scheduling in os
first come first serve scheduling in os first come first serve scheduling in os
first come first serve scheduling in os
 
Operating system
Operating systemOperating system
Operating system
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Scheduling
SchedulingScheduling
Scheduling
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
 
Scheduling
SchedulingScheduling
Scheduling
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
CPU Scheduling.pdf
CPU Scheduling.pdfCPU Scheduling.pdf
CPU Scheduling.pdf
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - Engineering
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 
Scheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxScheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptx
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)
 
Window scheduling algorithm
Window scheduling algorithmWindow scheduling algorithm
Window scheduling algorithm
 
Round-ribon algorithm presntation
Round-ribon algorithm presntationRound-ribon algorithm presntation
Round-ribon algorithm presntation
 

Kürzlich hochgeladen

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 

Kürzlich hochgeladen (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 

CPU scheduling algorithms in OS

  • 1.
  • 2. INTRODUCTION o The CPU scheduling is used to improve its efficiency. o It is used to allocate resources among competing processes. o Maximum CPU utilization is obtained with multiprogramming. • The processes which are to be executed are in ready queue. • Every time the running process is blocked , the process in the ready queue takes over the CPU. o A process may be • I/O BOUND: Involves more I/O operation. Ex : reading from disk. • CPU BOUND: Involves more computation. Ex : calculating the sum of 2 numbers from memory.
  • 3. PROCESS STATES o The 3 states of a process are ready , running and wait states. o CPU scheduling is affected by the following set of circumstances: • A process switches from running to waiting state. • A process switches from running to ready state . • A process switches from waiting to ready state . • A processes switches from running to terminated state.
  • 4. CPU SCHEDULING CRITERIA o CPU Utilization: Percent of time that the CPU is busy executing a process. o Throughput: Number of processes executed per unit time. o Turnaround Time: The interval of time between submission of a process and its completion. o Waiting Time: The amount of time the process spends in the ready queue waiting for the CPU. o Response Time: The time between submission of requests and first response to the request.
  • 5. First Come First Served(FCFS) o The process which enters the queue first is executed first. o It is non-preemptive. Process Arrival Service TT NTT P1 0 6 6 1 P2 2 4 8 2 P3 4 1 7 7 P1 P2 P3 0 6 10 11
  • 6. FCFS o Advantages: It is simple and easy to understand. o Disadvantages: The process with less execution time suffer. Favours CPU bound process then I/O bound process.
  • 7. Shortest Job First(SJF) o The process with the lowest execution time is executed first. o It can be either preemptive or non preemptive. Process Arrival Service TT NTT P1 0 6 6 1 P2 2 4 9 2.2 P3 4 1 3 3 P1 P3 P2 0 6 7 11
  • 8. SJF o Advantages: Shortest jobs are favoured. o Disadvantages: When there are more number of shorter jobs, longer jobs starve.
  • 9. Priority Scheduling(PS) o Each process is associated with priority and the CPU is allocated to each of them based on their priorities. o Multiple process with same priority are dealt using FCFS. Process Arrival Service TT NTT P1 0 6 6 1 P2 2 4 8 2 P3 4 1 7 7 P1 P2 P3 0 6 10 11
  • 10. PS o Advantages: Priority scheduling provides a good mechanism where the relative importance of each process may be precisely defined. o Disadvantages: • If high priority processes use up a lot of CPU time, lower priority processes may starve and be postponed indefinitely. • The situation where a process never gets scheduled to run is called starvation. • Another problem with priority scheduling is deciding which process gets which priority level assigned to it.
  • 11. Round Robin(RR) o Each process is allotted a time slot(q). After this time has elapsed, the process is pre-empted and added to the end of the ready queue. o Performance of the round robin algorithm ◦ q large  FCFS ◦ q small  q must be greater than the context switch time; otherwise, the overhead is too high
  • 12. RR Process Arrival Service TT NTT P1 0 6 12 2 P2 2 4 8 2 P3 4 2 2 1 q=2 o Advantages: Round robin scheduling is fair in that every process gets an equal share of the CPU. P1 0 62 P2 4 P3 P1 8 P2 10 P1 12
  • 13. RR o Disadvantages: Setting the quantum too short, increases the overhead and lowers the CPU efficiency, but setting it too long may cause poor response to short processes.
  • 14. ANALYSIS AND RESULTS o Comparing the average turnaround time and waiting time, the algorithms are ranked as SJF,FCFS and PS. o Based on average CPU utilization the algorithms are ranked as FC,PS and SJF. o In terms of execution speed, FCFS was found to be consistently faster than PS and SJF. Thus according to the performance measure the corresponding scheduling algorithm is recommended to the CPU.