SlideShare a Scribd company logo
CPU scheduling algorithms in OS
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.
Ad

More Related Content

What's hot (20)

Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
Sunita Sahu
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communication
AbDul ThaYyal
 
First Come First Serve
First Come First ServeFirst Come First Serve
First Come First Serve
Edwin Makeu
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
ManishaJha43
 
Memory Management
Memory ManagementMemory Management
Memory Management
DEDE IRYAWAN
 
Interprocess communication (IPC) IN O.S
Interprocess communication (IPC) IN O.SInterprocess communication (IPC) IN O.S
Interprocess communication (IPC) IN O.S
Hussain Ala'a Alkabi
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
usmankiyani1
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
sangrampatil81
 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"
Ra'Fat Al-Msie'deen
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
Punjab College Of Technical Education
 
Memory consistency models
Memory consistency modelsMemory consistency models
Memory consistency models
palani kumar
 
3 Pipelining
3 Pipelining3 Pipelining
3 Pipelining
fika sweety
 
Resource Management for Computer Operating Systems
Resource Management for Computer Operating SystemsResource Management for Computer Operating Systems
Resource Management for Computer Operating Systems
inside-BigData.com
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
Kumbirai Junior Muzavazi
 
Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
 
Multiprocessor Systems
Multiprocessor SystemsMultiprocessor Systems
Multiprocessor Systems
vampugani
 
Memory virtualization
Memory virtualizationMemory virtualization
Memory virtualization
Piyush Rochwani
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
Ritu Ranjan Shrivastwa
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Pipelining
PipeliningPipelining
Pipelining
sarith divakar
 
Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
Sunita Sahu
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communication
AbDul ThaYyal
 
First Come First Serve
First Come First ServeFirst Come First Serve
First Come First Serve
Edwin Makeu
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
ManishaJha43
 
Interprocess communication (IPC) IN O.S
Interprocess communication (IPC) IN O.SInterprocess communication (IPC) IN O.S
Interprocess communication (IPC) IN O.S
Hussain Ala'a Alkabi
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
usmankiyani1
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
sangrampatil81
 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"
Ra'Fat Al-Msie'deen
 
Memory consistency models
Memory consistency modelsMemory consistency models
Memory consistency models
palani kumar
 
Resource Management for Computer Operating Systems
Resource Management for Computer Operating SystemsResource Management for Computer Operating Systems
Resource Management for Computer Operating Systems
inside-BigData.com
 
Multiprocessor Systems
Multiprocessor SystemsMultiprocessor Systems
Multiprocessor Systems
vampugani
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
Ritu Ranjan Shrivastwa
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 

Viewers also liked (6)

Sstf scheduling.50
Sstf scheduling.50Sstf scheduling.50
Sstf scheduling.50
myrajendra
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
Shanu Kumar
 
OS - CPU Scheduling
OS - CPU SchedulingOS - CPU Scheduling
OS - CPU Scheduling
vinay arora
 
Scheduling Algorithms
Scheduling AlgorithmsScheduling Algorithms
Scheduling Algorithms
PT Mecoindo Itron
 
Page Replacement
Page ReplacementPage Replacement
Page Replacement
chandinisanz
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
Abhishek Nagar
 
Sstf scheduling.50
Sstf scheduling.50Sstf scheduling.50
Sstf scheduling.50
myrajendra
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
Shanu Kumar
 
OS - CPU Scheduling
OS - CPU SchedulingOS - CPU Scheduling
OS - CPU Scheduling
vinay arora
 
Ad

Similar to 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
mikeemukesh
 
Operating system
Operating systemOperating system
Operating system
devanshi_chowdhary
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
mohsinalilarik1
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
M. Abdullah Wasif
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
Paurav Shah
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
Harshit Jain
 
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptxCPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
Rajapriya82
 
3Chapter Three- CPU Scheduling this is the best.pptx
3Chapter Three- CPU Scheduling this is the best.pptx3Chapter Three- CPU Scheduling this is the best.pptx
3Chapter Three- CPU Scheduling this is the best.pptx
habtegebeyawu
 
Scheduling
SchedulingScheduling
Scheduling
Mustafa Ugur Oduncu
 
cpu scheduling.pdfoieheoirwuojorkjp;ooooo
cpu scheduling.pdfoieheoirwuojorkjp;ooooocpu scheduling.pdfoieheoirwuojorkjp;ooooo
cpu scheduling.pdfoieheoirwuojorkjp;ooooo
baijusurya7
 
operating system scheduling concept lec2
operating system scheduling concept lec2operating system scheduling concept lec2
operating system scheduling concept lec2
thakurnishant1903200
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
Kp Sharma
 
2_CPU Scheduling (2)beautifulgameyt.pptx
2_CPU Scheduling (2)beautifulgameyt.pptx2_CPU Scheduling (2)beautifulgameyt.pptx
2_CPU Scheduling (2)beautifulgameyt.pptx
adeljoby2004
 
Scheduling
SchedulingScheduling
Scheduling
Mohd Arif
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
KeyreSebre
 
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
Yogesh Santhan
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
sammerkhan1
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
AliyanAbbas1
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
ansariparveen06
 
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 algorithms
Paurav Shah
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
Harshit Jain
 
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptxCPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
CPU SCHEDULING ALGORITHMS-FCFS,SJF,RR.pptx
Rajapriya82
 
3Chapter Three- CPU Scheduling this is the best.pptx
3Chapter Three- CPU Scheduling this is the best.pptx3Chapter Three- CPU Scheduling this is the best.pptx
3Chapter Three- CPU Scheduling this is the best.pptx
habtegebeyawu
 
cpu scheduling.pdfoieheoirwuojorkjp;ooooo
cpu scheduling.pdfoieheoirwuojorkjp;ooooocpu scheduling.pdfoieheoirwuojorkjp;ooooo
cpu scheduling.pdfoieheoirwuojorkjp;ooooo
baijusurya7
 
operating system scheduling concept lec2
operating system scheduling concept lec2operating system scheduling concept lec2
operating system scheduling concept lec2
thakurnishant1903200
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
Kp Sharma
 
2_CPU Scheduling (2)beautifulgameyt.pptx
2_CPU Scheduling (2)beautifulgameyt.pptx2_CPU Scheduling (2)beautifulgameyt.pptx
2_CPU Scheduling (2)beautifulgameyt.pptx
adeljoby2004
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
KeyreSebre
 
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
Yogesh Santhan
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
AliyanAbbas1
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
ansariparveen06
 
Ad

Recently uploaded (20)

K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
National Information Standards Organization (NISO)
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 

CPU scheduling algorithms in OS

  • 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.