SlideShare una empresa de Scribd logo
1 de 37
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

Más contenido relacionado

La actualidad más candente

Slides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And GagneSlides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And Gagnesarankumar4445
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architectureSHAJANA BASHEER
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structuresMukesh Chinta
 
6 cpu scheduling
6 cpu scheduling6 cpu scheduling
6 cpu schedulingBaliThorat1
 
Distributed Operating System
Distributed Operating SystemDistributed Operating System
Distributed Operating SystemSanthiNivas
 
Operating system notes
Operating system notesOperating system notes
Operating system notesSANTOSH RATH
 
Operating System - Unit I - Introduction
Operating System - Unit I - IntroductionOperating System - Unit I - Introduction
Operating System - Unit I - Introductioncscarcas
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OSMsAnita2
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Conceptssgpraju
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsAJAL A J
 
Input output systems ppt - cs2411
Input output systems ppt - cs2411Input output systems ppt - cs2411
Input output systems ppt - cs2411Geerthik Varun
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Schedulingvampugani
 
Multiprocessor architecture
Multiprocessor architectureMultiprocessor architecture
Multiprocessor architectureArpan Baishya
 

La actualidad más candente (20)

Slides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And GagneSlides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structures
 
6 cpu scheduling
6 cpu scheduling6 cpu scheduling
6 cpu scheduling
 
Distributed Operating System
Distributed Operating SystemDistributed Operating System
Distributed Operating System
 
Operating system notes pdf
Operating system notes pdfOperating system notes pdf
Operating system notes pdf
 
Operating system notes
Operating system notesOperating system notes
Operating system notes
 
Bankers
BankersBankers
Bankers
 
Operating System - Unit I - Introduction
Operating System - Unit I - IntroductionOperating System - Unit I - Introduction
Operating System - Unit I - Introduction
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling Algorithms
 
Input output systems ppt - cs2411
Input output systems ppt - cs2411Input output systems ppt - cs2411
Input output systems ppt - cs2411
 
Vx works RTOS
Vx works RTOSVx works RTOS
Vx works RTOS
 
Ch1
Ch1Ch1
Ch1
 
Multi processing
Multi processingMulti processing
Multi processing
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Multiprocessor architecture
Multiprocessor architectureMultiprocessor architecture
Multiprocessor architecture
 

Similar a Lecture 4 process cpu scheduling

operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdfAliyanAbbas1
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingVaibhav Khanna
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptxDivyaKS18
 
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).pptxTSha7
 
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).pptxAmanuelmergia
 
Schudling os presentaion
Schudling os presentaionSchudling os presentaion
Schudling os presentaioninayat khan
 
Lecture 4 - Process Scheduling.pptx
Lecture 4 - Process Scheduling.pptxLecture 4 - Process Scheduling.pptx
Lecture 4 - Process Scheduling.pptxAmanuelmergia
 
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 processesmanideepakc
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentationusmankiyani1
 
CPU Scheduling.pptx
CPU Scheduling.pptxCPU Scheduling.pptx
CPU Scheduling.pptxyashu23
 
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.pptxCHANDRUG31
 
L6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxL6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxSeniorGaming
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxansariparveen06
 
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 a 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 .
 

Último

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 

Último (20)

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 

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.