SlideShare a Scribd company logo
Process Scheduling/
CPU Scheduling
Process Scheduling
• The act of determining which process in the ready state should be moved
to the running state is known as Process Scheduling.
• The prime aim of the process scheduling system is to keep the CPU busy all
the time and to deliver minimum response time for all programs.
• CPU scheduling is a process which allows one process to use the CPU while
the execution of another process is on hold(in waiting state) due to
unavailability of any resource like I/O etc, thereby making full use of CPU.
• The aim of CPU scheduling is to make the system efficient, fast and fair.
• Process scheduling is an essential part of a Multiprogramming operating
systems. Such operating systems allow more than one process to be loaded
into the executable memory at a time and the loaded process shares the
CPU using time multiplexing.
• For achieving this, the scheduler must apply appropriate rules for swapping
processes IN and OUT of CPU.
Process Scheduling Queues
• The OS maintains all PCBs in Process Scheduling Queues.
• The OS maintains a separate queue for each of the process states and PCBs of
all processes in the same execution state are placed in the same queue.
• When the state of a process is changed, its PCB is unlinked from its current
queue and moved to its new state queue.
• The Operating System maintains the following important process scheduling
queues:
oAll processes when enters into the system are stored in the job queue.
oProcesses in the Ready state are placed in the ready queue. This queue keeps a
set of all processes residing in main memory, ready and waiting to execute. A
new process is always put in this queue.
oProcesses waiting for a device to become available are placed in device queues.
There are unique device queues for each I/O device available.
Process Scheduling Queues
Two-State Process Model
• Two-state process model refers to running and non-running states.
Schedulers
• Schedulers are special system software which handle process scheduling in
various ways.
• Their main task is to select the jobs to be submitted into the system and to decide
which process to run.
• Schedulers fell into one of the two general categories :
• Non pre-emptive scheduling. When the currently executing process gives up the
CPU voluntarily.
• Pre-emptive scheduling. When the operating system decides to favor another
process, pre-empting the currently executing process.
• Schedulers are of three types:
o Long-Term Scheduler
o Short-Term Scheduler
o Medium-Term Scheduler
Long-Term Scheduler
• It is also called a job scheduler.
• A long-term scheduler determines which programs are admitted to the
system for processing. It selects processes from the queue and loads them
into memory for execution.
• Process loads into the memory for CPU scheduling.
• The primary objective of the job scheduler is to provide a balanced mix of
jobs, such as I/O bound and processor bound.
• It also controls the degree of multiprogramming. If the degree of
multiprogramming is stable, then the average rate of process creation must
be equal to the average departure rate of processes leaving the system.
• On some systems, the long-term scheduler may not be available or minimal.
Time-sharing operating systems have no long term scheduler.
• When a process changes the state from new to ready, then there is use of
long-term scheduler.
Short Term Scheduler
• It is also called as CPU scheduler and runs very frequently.
• Its main objective is to increase system performance in accordance
with the chosen set of criteria and increase process execution rate.
• It is the change of ready state to running state of the process.
• CPU scheduler selects a process among the processes that are ready
to execute and allocates CPU to one of them.
• Short-term schedulers, also known as dispatchers, make the decision
of which process to execute next.
• Short-term schedulers are faster than long-term schedulers.
Medium Term Scheduler
• Medium-term scheduling is a part of swapping.
• It removes the processes from the memory. It reduces the degree of
multiprogramming.
• The medium-term scheduler is in charge of handling the swapped out-
processes.
• A running process may become suspended if it makes an I/O request.
• A suspended processes cannot make any progress towards completion.
• In this condition, to remove the process from memory and make space for
other processes, the suspended process is moved to the secondary storage.
• This process is called swapping, and the process is said to be swapped out or
rolled out.
• Swapping may be necessary to improve the process mix.
Context Switch
• A context switch is the mechanism to store and restore the state or context of
a CPU in Process Control block so that a process execution can be resumed
from the same point at a later time.
• Using this technique, a context switcher enables multiple processes to share a
single CPU.
• Context switching is an essential part of a multitasking operating system
features.
• When the scheduler switches the CPU from executing one process to execute
another, the state from the current running process is stored into the process
control block.
• After this, the state for the process to run next is loaded from its own PCB and
used to set the PC, registers, etc.
• At that point, the second process can start executing.
Context switching diagram
Scheduling Algorithms
• A Process Scheduler schedules different processes to be assigned to
the CPU based on particular scheduling algorithms.
First-Come, First-Served (FCFS) Scheduling
Shortest-Job-Next (SJN) Scheduling
Priority Scheduling
Shortest Remaining Time
Round Robin(RR) Scheduling
Multiple-Level Queues Scheduling
Multilevel Feedback Queue Scheduling
Scheduling Criteria
• There are many different criterias to check when considering the "best"
scheduling algorithm :
CPU utilization -To make out the best use of CPU and not to waste any
CPU cycle, CPU would be working most of the time(Ideally 100% of the
time). Considering a real system, CPU usage should range from 40%
(lightly loaded) to 90% (heavily loaded.)
Throughput - It is the total number of processes completed per unit time
or rather say total amount of work done in a unit of time. This may range
from 10/second to 1/hour depending on the specific processes.
Turnaround time - It is the amount of time taken to execute a particular
process, i.e. The interval from time of submission of the process to the
time of completion of the process(Wall clock time).
• Waiting time - The sum of the periods spent waiting in the ready queue
amount of time a process has been waiting in the ready queue to
acquire get control on the CPU.
• Load average - It is the average number of processes residing in the
ready queue waiting for their turn to get into the CPU.
• Response time - Amount of time it takes from when a request was
submitted until the first response is produced. Remember, it is the time
till the first response and not the completion of process execution(final
response).
• In general CPU utilization and Throughput are maximized and other
factors are reduced for proper optimization.
• The Algorithms
First Come, First Served (FCFS)
• Jobs are executed on first come, first served basis.
• It is a non-preemptive scheduling algorithm.
• Easy to understand and implement.
• Its implementation is based on FIFO queue.
• Poor in performance, as average wait time is high.
Round Robin Scheduling
• Round Robin is a preemptive process scheduling algorithm.
• Each process is provided a fix time to execute; it is called a
quantum.
• Once a process is executed for a given time period, it is
preempted and other process executes for a given time period.
• Context switching is used to save states of preempted
processes.
Shortest Job Next (SJN)
• This is also known as shortest job first, or SJF.
• This is a non-preemptive scheduling algorithm.
• Best approach to minimize waiting time.
• Easy to implement in Batch systems where required CPU time is known in
advance.
• Impossible to implement in interactive systems where the required CPU
time is not known.
• The processer should know in advance how much time a process will take.
Shortest Remaining Time
• Shortest remaining time (SRT) is the preemptive version of the SJN
algorithm.
• The processor is allocated to the job closest to completion but it can
be preempted by a newer ready job with shorter time to completion.
• Impossible to implement in interactive systems where required CPU
time is not known.
• It is often used in batch environments where short jobs need to be
given preference.
Priority Based Scheduling Algorithm
• Priority is assigned for each process.
• Process with highest priority is executed first and so on.
• Processes with same priority are executed in FCFS manner.
• Priority can be decided based on memory requirements, time
requirements or any other resource requirement.
Multilevel Queue Scheduling
• Multiple-level queues are not an independent scheduling algorithm.
• They make use of other existing algorithms to group and schedule
jobs with common characteristics.
 Multiple queues are maintained for processes with common
characteristics.
 Each queue can have its own scheduling algorithms.
 Priorities are assigned to each queue.
• For example, CPU-bound jobs can be scheduled in one queue and all
I/O-bound jobs in another queue.
• The Process Scheduler then alternately selects jobs from each.
• NB: under this algorithm jobs cannot switch from queue to queue -
Once they are assigned a queue, that is their queue until they finish.
Multilevel feedback queue scheduling
• Multilevel feedback queue scheduling is similar to the ordinary multilevel
queue scheduling described above, except jobs may be moved from one
queue to another for a variety of reasons:
o If the characteristics of a job change between CPU-intensive and I/O intensive, then it
may be appropriate to switch a job from one queue to another.
o Aging can also be incorporated, so that a job that has waited for a long time can get
bumped up into a higher priority queue for a while.
• Multilevel feedback queue scheduling is the most flexible, because it can be
tuned for any situation. But it is also the most complex to implement because
of all the adjustable parameters. Some of the parameters which define one of
these systems include:
o The number of queues.
o The scheduling algorithm for each queue.
o The methods used to upgrade or demote processes from one queue to another. ( Which
may be different. )
o The method used to determine which queue a process enters initially.
The algorithm

More Related Content

What's hot

Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
vampugani
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
Dr. Loganathan R
 
Operating System Overview
Operating System OverviewOperating System Overview
Operating System Overview
Anas Ebrahim
 
Multiprocessor system
Multiprocessor system Multiprocessor system
Multiprocessor system
Mr. Vikram Singh Slathia
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
Dhaval Sakhiya
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
Ravi Kumar Patel
 
interprocessor arbitration
interprocessor arbitrationinterprocessor arbitration
interprocessor arbitration
Aditya Mishra
 
Critical section operating system
Critical section  operating systemCritical section  operating system
Critical section operating system
Muhammad Baqar Kazmi
 
Computer architecture, a quantitative approach (solution for 5th edition)
Computer architecture, a quantitative approach (solution for 5th edition)Computer architecture, a quantitative approach (solution for 5th edition)
Computer architecture, a quantitative approach (solution for 5th edition)
Zohaib Ali
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Operating system architecture
Operating system architectureOperating system architecture
Operating system architecture
Sabin dumre
 
Process management in operating system | process states | PCB | FORK() | Zomb...
Process management in operating system | process states | PCB | FORK() | Zomb...Process management in operating system | process states | PCB | FORK() | Zomb...
Process management in operating system | process states | PCB | FORK() | Zomb...
Shivam Mitra
 
12 process control blocks
12 process control blocks12 process control blocks
12 process control blocksmyrajendra
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatz
GiulianoRanauro
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
Chankey Pathak
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structures
Mukesh Chinta
 
Input output hardware of operating system
Input output hardware of operating systemInput output hardware of operating system
Input output hardware of operating system
RohitYadav633
 
34 single partition allocation
34 single partition allocation34 single partition allocation
34 single partition allocationmyrajendra
 

What's hot (20)

Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Scheduling
SchedulingScheduling
Scheduling
 
Operating System Overview
Operating System OverviewOperating System Overview
Operating System Overview
 
Multiprocessor system
Multiprocessor system Multiprocessor system
Multiprocessor system
 
Array Processor
Array ProcessorArray Processor
Array Processor
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
interprocessor arbitration
interprocessor arbitrationinterprocessor arbitration
interprocessor arbitration
 
Critical section operating system
Critical section  operating systemCritical section  operating system
Critical section operating system
 
Computer architecture, a quantitative approach (solution for 5th edition)
Computer architecture, a quantitative approach (solution for 5th edition)Computer architecture, a quantitative approach (solution for 5th edition)
Computer architecture, a quantitative approach (solution for 5th edition)
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Operating system architecture
Operating system architectureOperating system architecture
Operating system architecture
 
Process management in operating system | process states | PCB | FORK() | Zomb...
Process management in operating system | process states | PCB | FORK() | Zomb...Process management in operating system | process states | PCB | FORK() | Zomb...
Process management in operating system | process states | PCB | FORK() | Zomb...
 
12 process control blocks
12 process control blocks12 process control blocks
12 process control blocks
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatz
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structures
 
Input output hardware of operating system
Input output hardware of operating systemInput output hardware of operating system
Input output hardware of operating system
 
34 single partition allocation
34 single partition allocation34 single partition allocation
34 single partition allocation
 

Similar to Lecture 4 process cpu scheduling

operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
AliyanAbbas1
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of scheduling
Vaibhav Khanna
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
DivyaKS18
 
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptxCPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
TSha7
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management
JayeshGadhave1
 
Scheduling Definition, objectives and types
Scheduling Definition, objectives and types Scheduling Definition, objectives and types
Scheduling Definition, objectives and types
Maitree Patel
 
Lecture 4 - Process Scheduling (1).pptx
Lecture 4 - Process Scheduling (1).pptxLecture 4 - Process Scheduling (1).pptx
Lecture 4 - Process Scheduling (1).pptx
Amanuelmergia
 
Schudling os presentaion
Schudling os presentaionSchudling os presentaion
Schudling os presentaion
inayat khan
 
Lecture 4 - Process Scheduling.pptx
Lecture 4 - Process Scheduling.pptxLecture 4 - Process Scheduling.pptx
Lecture 4 - Process Scheduling.pptx
Amanuelmergia
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
manideepakc
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
usmankiyani1
 
CPU Scheduling.pptx
CPU Scheduling.pptxCPU Scheduling.pptx
CPU Scheduling.pptx
yashu23
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
Farhanahmad540205
 
CPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdfCPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdf
Harika Pudugosula
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...
ApurvaLaddha
 
Multi-Threading.pptx
Multi-Threading.pptxMulti-Threading.pptx
Multi-Threading.pptx
CHANDRUG31
 
L6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxL6 CPU Scheduling.pptx
L6 CPU Scheduling.pptx
SeniorGaming
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
ansariparveen06
 
Operating System.pptx
Operating System.pptxOperating System.pptx
Operating System.pptx
VanshikaRajput33
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .
nathansel1
 

Similar to Lecture 4 process cpu scheduling (20)

operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of scheduling
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
 
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptxCPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management
 
Scheduling Definition, objectives and types
Scheduling Definition, objectives and types Scheduling Definition, objectives and types
Scheduling Definition, objectives and types
 
Lecture 4 - Process Scheduling (1).pptx
Lecture 4 - Process Scheduling (1).pptxLecture 4 - Process Scheduling (1).pptx
Lecture 4 - Process Scheduling (1).pptx
 
Schudling os presentaion
Schudling os presentaionSchudling os presentaion
Schudling os presentaion
 
Lecture 4 - Process Scheduling.pptx
Lecture 4 - Process Scheduling.pptxLecture 4 - Process Scheduling.pptx
Lecture 4 - Process Scheduling.pptx
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 
CPU Scheduling.pptx
CPU Scheduling.pptxCPU Scheduling.pptx
CPU Scheduling.pptx
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
 
CPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdfCPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdf
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...
 
Multi-Threading.pptx
Multi-Threading.pptxMulti-Threading.pptx
Multi-Threading.pptx
 
L6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxL6 CPU Scheduling.pptx
L6 CPU Scheduling.pptx
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 
Operating System.pptx
Operating System.pptxOperating System.pptx
Operating System.pptx
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .
 

Recently uploaded

GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 

Recently uploaded (20)

GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 

Lecture 4 process cpu scheduling

  • 2. Process Scheduling • The act of determining which process in the ready state should be moved to the running state is known as Process Scheduling. • The prime aim of the process scheduling system is to keep the CPU busy all the time and to deliver minimum response time for all programs. • CPU scheduling is a process which allows one process to use the CPU while the execution of another process is on hold(in waiting state) due to unavailability of any resource like I/O etc, thereby making full use of CPU. • The aim of CPU scheduling is to make the system efficient, fast and fair. • Process scheduling is an essential part of a Multiprogramming operating systems. Such operating systems allow more than one process to be loaded into the executable memory at a time and the loaded process shares the CPU using time multiplexing. • For achieving this, the scheduler must apply appropriate rules for swapping processes IN and OUT of CPU.
  • 3. Process Scheduling Queues • The OS maintains all PCBs in Process Scheduling Queues. • The OS maintains a separate queue for each of the process states and PCBs of all processes in the same execution state are placed in the same queue. • When the state of a process is changed, its PCB is unlinked from its current queue and moved to its new state queue. • The Operating System maintains the following important process scheduling queues: oAll processes when enters into the system are stored in the job queue. oProcesses in the Ready state are placed in the ready queue. This queue keeps a set of all processes residing in main memory, ready and waiting to execute. A new process is always put in this queue. oProcesses waiting for a device to become available are placed in device queues. There are unique device queues for each I/O device available.
  • 5. Two-State Process Model • Two-state process model refers to running and non-running states.
  • 6. Schedulers • Schedulers are special system software which handle process scheduling in various ways. • Their main task is to select the jobs to be submitted into the system and to decide which process to run. • Schedulers fell into one of the two general categories : • Non pre-emptive scheduling. When the currently executing process gives up the CPU voluntarily. • Pre-emptive scheduling. When the operating system decides to favor another process, pre-empting the currently executing process. • Schedulers are of three types: o Long-Term Scheduler o Short-Term Scheduler o Medium-Term Scheduler
  • 7. Long-Term Scheduler • It is also called a job scheduler. • A long-term scheduler determines which programs are admitted to the system for processing. It selects processes from the queue and loads them into memory for execution. • Process loads into the memory for CPU scheduling. • The primary objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. • It also controls the degree of multiprogramming. If the degree of multiprogramming is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system. • On some systems, the long-term scheduler may not be available or minimal. Time-sharing operating systems have no long term scheduler. • When a process changes the state from new to ready, then there is use of long-term scheduler.
  • 8. Short Term Scheduler • It is also called as CPU scheduler and runs very frequently. • Its main objective is to increase system performance in accordance with the chosen set of criteria and increase process execution rate. • It is the change of ready state to running state of the process. • CPU scheduler selects a process among the processes that are ready to execute and allocates CPU to one of them. • Short-term schedulers, also known as dispatchers, make the decision of which process to execute next. • Short-term schedulers are faster than long-term schedulers.
  • 9. Medium Term Scheduler • Medium-term scheduling is a part of swapping. • It removes the processes from the memory. It reduces the degree of multiprogramming. • The medium-term scheduler is in charge of handling the swapped out- processes. • A running process may become suspended if it makes an I/O request. • A suspended processes cannot make any progress towards completion. • In this condition, to remove the process from memory and make space for other processes, the suspended process is moved to the secondary storage. • This process is called swapping, and the process is said to be swapped out or rolled out. • Swapping may be necessary to improve the process mix.
  • 10.
  • 11. Context Switch • A context switch is the mechanism to store and restore the state or context of a CPU in Process Control block so that a process execution can be resumed from the same point at a later time. • Using this technique, a context switcher enables multiple processes to share a single CPU. • Context switching is an essential part of a multitasking operating system features. • When the scheduler switches the CPU from executing one process to execute another, the state from the current running process is stored into the process control block. • After this, the state for the process to run next is loaded from its own PCB and used to set the PC, registers, etc. • At that point, the second process can start executing.
  • 13. Scheduling Algorithms • A Process Scheduler schedules different processes to be assigned to the CPU based on particular scheduling algorithms. First-Come, First-Served (FCFS) Scheduling Shortest-Job-Next (SJN) Scheduling Priority Scheduling Shortest Remaining Time Round Robin(RR) Scheduling Multiple-Level Queues Scheduling Multilevel Feedback Queue Scheduling
  • 14. Scheduling Criteria • There are many different criterias to check when considering the "best" scheduling algorithm : CPU utilization -To make out the best use of CPU and not to waste any CPU cycle, CPU would be working most of the time(Ideally 100% of the time). Considering a real system, CPU usage should range from 40% (lightly loaded) to 90% (heavily loaded.) Throughput - It is the total number of processes completed per unit time or rather say total amount of work done in a unit of time. This may range from 10/second to 1/hour depending on the specific processes. Turnaround time - It is the amount of time taken to execute a particular process, i.e. The interval from time of submission of the process to the time of completion of the process(Wall clock time).
  • 15. • Waiting time - The sum of the periods spent waiting in the ready queue amount of time a process has been waiting in the ready queue to acquire get control on the CPU. • Load average - It is the average number of processes residing in the ready queue waiting for their turn to get into the CPU. • Response time - Amount of time it takes from when a request was submitted until the first response is produced. Remember, it is the time till the first response and not the completion of process execution(final response). • In general CPU utilization and Throughput are maximized and other factors are reduced for proper optimization.
  • 17. First Come, First Served (FCFS) • Jobs are executed on first come, first served basis. • It is a non-preemptive scheduling algorithm. • Easy to understand and implement. • Its implementation is based on FIFO queue. • Poor in performance, as average wait time is high.
  • 18.
  • 19.
  • 20.
  • 21. Round Robin Scheduling • Round Robin is a preemptive process scheduling algorithm. • Each process is provided a fix time to execute; it is called a quantum. • Once a process is executed for a given time period, it is preempted and other process executes for a given time period. • Context switching is used to save states of preempted processes.
  • 22.
  • 23.
  • 24. Shortest Job Next (SJN) • This is also known as shortest job first, or SJF. • This is a non-preemptive scheduling algorithm. • Best approach to minimize waiting time. • Easy to implement in Batch systems where required CPU time is known in advance. • Impossible to implement in interactive systems where the required CPU time is not known. • The processer should know in advance how much time a process will take.
  • 25.
  • 26.
  • 27.
  • 28. Shortest Remaining Time • Shortest remaining time (SRT) is the preemptive version of the SJN algorithm. • The processor is allocated to the job closest to completion but it can be preempted by a newer ready job with shorter time to completion. • Impossible to implement in interactive systems where required CPU time is not known. • It is often used in batch environments where short jobs need to be given preference.
  • 29.
  • 30. Priority Based Scheduling Algorithm • Priority is assigned for each process. • Process with highest priority is executed first and so on. • Processes with same priority are executed in FCFS manner. • Priority can be decided based on memory requirements, time requirements or any other resource requirement.
  • 31.
  • 32.
  • 33.
  • 34. Multilevel Queue Scheduling • Multiple-level queues are not an independent scheduling algorithm. • They make use of other existing algorithms to group and schedule jobs with common characteristics.  Multiple queues are maintained for processes with common characteristics.  Each queue can have its own scheduling algorithms.  Priorities are assigned to each queue. • For example, CPU-bound jobs can be scheduled in one queue and all I/O-bound jobs in another queue. • The Process Scheduler then alternately selects jobs from each. • NB: under this algorithm jobs cannot switch from queue to queue - Once they are assigned a queue, that is their queue until they finish.
  • 35.
  • 36. Multilevel feedback queue scheduling • Multilevel feedback queue scheduling is similar to the ordinary multilevel queue scheduling described above, except jobs may be moved from one queue to another for a variety of reasons: o If the characteristics of a job change between CPU-intensive and I/O intensive, then it may be appropriate to switch a job from one queue to another. o Aging can also be incorporated, so that a job that has waited for a long time can get bumped up into a higher priority queue for a while. • Multilevel feedback queue scheduling is the most flexible, because it can be tuned for any situation. But it is also the most complex to implement because of all the adjustable parameters. Some of the parameters which define one of these systems include: o The number of queues. o The scheduling algorithm for each queue. o The methods used to upgrade or demote processes from one queue to another. ( Which may be different. ) o The method used to determine which queue a process enters initially.