SlideShare ist ein Scribd-Unternehmen logo
1 von 41
What is CPU Scheduling…?
It decides which processes will run when there are
multiple runnable processes.
Why CPU Scheduling is used…?
In General term the aim of CPU Scheduling is to
make the System efficient, fast and fair.
The I/O will take a long time, and we never want to
leave the CPU idle, while waiting for the I/O to finish.
Basic assumption behind the Scheduling Algorithms:-
 There is a pool of runnable processes contending for
the CPU.
The OS is a multitasking, but not a multiprocessor
 The processes are independent and compete for
resources.
 The job of the Scheduler is to distribute the scarce
resource of the CPU to the different processes ‘fairly’.
Long-term scheduler:
admits new processes to
the system;
required because each
process needs a portion of
the available memory for its
code and data.
Short-term scheduler:
determines the assignment
of the CPU to ready
processes;
required because of IO
requests and completions.
Hard Disk RAM CPU
Scheduling Management
Processes are managed through the use of multiple
queues of PCB's.
The job queue contains all jobs submitted to the
system, but not yet in main memory.
The ready queue contains all jobs in main memory
ready to execute.
Each I/O device has a queue of jobs waiting for
various I/O operations.
A process is then dispatched from the ready queue to
the CPU.
Some terms related to Scheduling…
3.Waiting Time:- Waiting time is the sum of the periods spent
waiting in the ready queue.
2.Throughput:- The number of processes that are
completed per time unit, called throughput.
1. CPU Utilization :- Conceptually, CPU utilization can range
from 0 to 100 percent. In a real system, it should range from 40
percent (for a lightly loaded system) to 90 percent (for a heavily
used system).
6.Burst Cycle :- Process cycles between CPU processing
and I/O activity. The cycles are of two types:-
- CPU Burst Cycle
- I/O Burst Cycle
5.Respond Time :- The measure of the time from the
submission of a request until the first response is
produced.
4 .Turn-around Time :- Turnaround time is the sum of
the time spent waiting to get into memory, waiting in the
ready queue, executing on the CPU, and doing I/O.
8.CPU Bound Processes :- Processes that perform lots of
computation and do little IO.
7. IO Bound Processes :- Processes that perform lots of IO
operations.
Ex. Calculator
- Ready
9. Process States :-
- Running
- Waiting
10. PCB :- Process Control Block is a data structure in
the OS containing the information needed to manage a
particular process. The PCB is "the expression of a
process in an operating system.”
11. Pre-emptive & Non Pre-emptive
When a process switches from the
Running waiting
Running ready
Waiting ready
When a process terminates
Non Pre-
emptive
Pre-emptive
FCFS
Shortest Job First
Multi-Level Scheduling
Round Robin
Priority Queue
Multi-level Feedback Queue Scheduling
First Come First Serve
- Jobs are executed on first come, first serve basis.
- Easy to understand and implement.
- Poor in performance as average wait time is high.
Thus, it is rarely used in modern operating systems, but
is sometimes used inside of other scheduling systems.
Ex.:-
Process Process Time (ms)
P1 24
P2 3
P3 3
P1 P2 P3
Time 0 24 27
Average waiting time= (0+24+27)/3 17 ms
Advantage:-
Simple
Easy to implement
Dis-advantage:-
This scheduling method is non-preemptive.
 Because of this non-preemptive scheduling, short
processes which are at the back of the queue have to
wait for the long process at the front to finish
FCFS
Shortest Job First
Multi-Level Scheduling
Round Robin
Priority Queue
Multi-level Feedback Queue Scheduling
Shortest Job First
 It works, when the CPU is available, it is assigned to the
process that has the smallest next CPU burst.
- If the next CPU bursts of two processes are the same,
FCFS scheduling is used.
- Impossible to implement as we cannot always predict the
future (i.e., we do not know the next burst length)
Shortest Job First
decreases the waiting time of the short process more than it
increases the waiting time of the long process.
 Consequently, the average waiting time decreases.
 SJF scheduling is used frequently in long-term scheduling.
 Moving a short process before a long one………
Ex:-
Process Process Time
P1 6
P2 8
P3 7
P4 3
P4 P1 P3 P2
Time 0 3 9 16 24
Average Waiting Time = (0+3+9+16)/4 7 ms
Ex:-
Process Arrival Time Process Time
P1 0 8
P2 1 4
P3 2 9
P4 3 5
P1 P2 P4 P1 P3
Time 0 1 5 10 17
Average Waiting Time = [(10-1)+(1-1)+(17-2)+(5-3)]/4
6.5 ms
SJF is sometimes called shortest-remaining-time-first-
scheduling
FCFS
Shortest Job First
Multi-Level Scheduling
Round Robin
Priority Queue
Multi-level Feedback Queue Scheduling
Priority Queue
The basic idea is straightforward: each process is assigned a
priority, and highest priority is allowed to run.
 Equal-Priority processes are scheduled in FCFS order.
 The shortest-Job-First (SJF) algorithm is a special case of
general priority scheduling algorithm.
Priorities can be defined either internally or externally
Internally defined priorities use some measurable
quantities to compute the priority of a process, such as
 time limits  memory requirements  the number of open files
 the ratio of average I/O burst to average CPU burst
External priorities are set by criteria outside the OS,
such as
 the amount of funds being paid for computer use
 such as the importance of the process
 other, political factors.
 Priority scheduling can suffer from a major problem known
as indefinite blocking, or starvation.
 Priority scheduling can be either preemptive or non-
preemptive.
 In which a low-priority task can wait forever because there
are always some other jobs around that have higher priority.
 A solution to the problem of indefinite blockage of the low-
priority process is Aging.
 Aging is a technique of gradually increasing the priority of
processes that wait in the system for a long period of time.
Ex:-
Process Process Time Priority
P1 10 3
P2 1 1
P3 2 4
P4 1 5
P5 5 2
Time
P2 P5 P1 P3
0 1 6 16
Average Waiting Time = (0+1+6+16+18)/4 8.2 ms
P4
18
FCFS
Shortest Job First
Multi-Level Scheduling
Round Robin
Priority Queue
Multi-level Feedback Queue Scheduling
Round Robin
It is specially designed for Time-Sharing System
 It is similar to FCFS scheduling, but preemption is
added to switch between processes.
 Each process is provided a fix time to execute called
quantum.
 Once a process is executed for given time period.
Process is preempted and other process executes for
given time period.
sets a timer to interrupt after 1
time quantum
 The CPU scheduler picks the first process
from the ready queue
and dispatches the process.
 Therefore, one of two things will then happen.
 The process may have a CPU burst of less than 1
time quantum.
 Otherwise, a context switch will be executed, and
the process will be put at the tail of the ready
queue.
If there are n process in the ready Queue and the
time quantum is q, then each process must wait no
longer then…
(n-1) x q time units (until its next time quantum)
For Ex.:-
n=4 And q=10ms
Time till second chance
(4-1) x 10 =30 ms
Now, the choice of how big to make the time
quantum(q) is extremely important
If q is very large then,
Round Robin degenerates into FCFS
If q is very small,
the context switch overhead defeats
the benefits, & the RR approach is called
processor sharing.
Example:
Process Process Time
P1 24
P2 3
P3 3
Time
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26
Average Waiting Time = (0+4+7+(10-4))/3 5.6 ms
FCFS
Shortest Job First
Multi-Level Scheduling
Round Robin
Priority Queue
Multi-level Feedback Queue Scheduling
Multi-level Scheduling
Multiple queues are maintained for processes.
Each queue can have its own scheduling algorithms.
Priorities are assigned to each queue.
The processes are permanently assigned to one queue,
generally based on some property of the process, such as
memory size, process priority, or process type.
Ex. of a Ready queue of multi-queue algorithm:
Scheduling must be done between queues, because:
 fixed priority (may lead to starvation) (e.g.,
foreground jobs have absolute priority over
background jobs)
 time slice per queue
FCFS
Shortest Job First
Multi-Level Scheduling
Round Robin
Priority Queue
Multi-level Feedback Queue Scheduling
Multi-level Feedback Queue
Scheduling
In this Processor are permanently assigned to a
queue
The Multi-level Feedback Queue Scheduling,
algorithm, in contrast, allow a process to move
between queues.
If a process uses too much CPU time, it will be
moved to a lower-priority queue.
Multi-level Feedback Queue
Scheduling
This Scheme leaves I/O bound and interactive
process in the higher-priority queue.
In addition, a process waits too long in a lower –
priority queue may be moved into a higher-
priority queue.
The idea is to separate processes according to
the characteristics of their CPU bursts.
For example, consider a multilevel feedback-queue
scheduler with three queues, numbered from 0 to 2.
 The scheduler first executes all processes in queue
0.
 Only when queue 0 is empty will it execute
processes in queue 1.
 Similarly, processes in queue 2 will only be
executed if queues 0 and 1 are empty.
 While executing queue 1, if a process arrives in queue
0 – then pre-emption will take place
A process entering the ready Queue is put in queue 0.
A process in queue 0 is given a time quantum of 8
millisecond
If queue 0 is empty the process at the head of queue
1 is given a quantum of 16 millisecond.
Process in queue 2 are run on an FCFS basis but
are run only when queues o and 1 are empty
If it does not finish within this time, it is moved to the tail of queue 1.
If it does not complete, it is preempted and is put into queue 2
quantum = 8
quantum = 16
FCFS
This scheduling algorithm gives highest priority to
any process with a CPU burst of 8 millisecond or less
Processes that need more then 8 but less then 24
millisecond are also served quickly, although with lower
priority then shorter processes.
Long processes automatically sink to queue 2 and
served in FCFS order with any CPU cycles left over from
queues 0 and 1.
Scheduling algo(by HJ)

Weitere ähnliche Inhalte

Was ist angesagt?

Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithmsPaurav Shah
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentationusmankiyani1
 
17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria 17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria myrajendra
 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinShubham Singh
 
cpu scheduling by shivam singh
cpu scheduling by shivam singhcpu scheduling by shivam singh
cpu scheduling by shivam singhshivam71291
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSMargrat C R
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling AlgorithmsTayba Farooqui
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)nikeAthena
 

Was ist angesagt? (20)

Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Scheduling
SchedulingScheduling
Scheduling
 
OSCh6
OSCh6OSCh6
OSCh6
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
Os module 2 ba
Os module 2 baOs module 2 ba
Os module 2 ba
 
17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria 17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
CPU Sheduling
CPU Sheduling CPU Sheduling
CPU Sheduling
 
PPT CPU
PPT CPUPPT CPU
PPT CPU
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvin
 
cpu scheduling by shivam singh
cpu scheduling by shivam singhcpu scheduling by shivam singh
cpu scheduling by shivam singh
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
scheduling algorithm
scheduling algorithmscheduling algorithm
scheduling algorithm
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Algorithm o.s.
Algorithm o.s.Algorithm o.s.
Algorithm o.s.
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
 

Andere mochten auch

Link list(by harshit)
Link list(by harshit)Link list(by harshit)
Link list(by harshit)Harshit Jain
 
Operating System 5
Operating System 5Operating System 5
Operating System 5tech2click
 
CPU Scheduling - Part1
CPU Scheduling - Part1CPU Scheduling - Part1
CPU Scheduling - Part1Amir Payberah
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OSharini0810
 
Second Genetic algorithm and Job-shop scheduling presentation
Second Genetic algorithm and Job-shop scheduling presentationSecond Genetic algorithm and Job-shop scheduling presentation
Second Genetic algorithm and Job-shop scheduling presentationAccenture
 
0006.scheduling not-ilp-not-force
0006.scheduling not-ilp-not-force0006.scheduling not-ilp-not-force
0006.scheduling not-ilp-not-forcesean chen
 
CPU SCHEDULING AND DEADLOCK
CPU SCHEDULING AND	DEADLOCKCPU SCHEDULING AND	DEADLOCK
CPU SCHEDULING AND DEADLOCKVicky Kumar
 
Cpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using javaCpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using javajsivasrinivas
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDBDenny Lee
 
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three ProblemsIBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three ProblemsPhilippe Laborie
 

Andere mochten auch (20)

Link list(by harshit)
Link list(by harshit)Link list(by harshit)
Link list(by harshit)
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
CPU Scheduling - Part1
CPU Scheduling - Part1CPU Scheduling - Part1
CPU Scheduling - Part1
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OS
 
Ch6
Ch6Ch6
Ch6
 
Second Genetic algorithm and Job-shop scheduling presentation
Second Genetic algorithm and Job-shop scheduling presentationSecond Genetic algorithm and Job-shop scheduling presentation
Second Genetic algorithm and Job-shop scheduling presentation
 
0006.scheduling not-ilp-not-force
0006.scheduling not-ilp-not-force0006.scheduling not-ilp-not-force
0006.scheduling not-ilp-not-force
 
CPU SCHEDULING AND DEADLOCK
CPU SCHEDULING AND	DEADLOCKCPU SCHEDULING AND	DEADLOCK
CPU SCHEDULING AND DEADLOCK
 
Akash
AkashAkash
Akash
 
Microsoft azure documentDB
Microsoft azure documentDBMicrosoft azure documentDB
Microsoft azure documentDB
 
Cpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using javaCpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using java
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
Azure document DB
Azure document DBAzure document DB
Azure document DB
 
Reviewer cpu scheduling
Reviewer cpu schedulingReviewer cpu scheduling
Reviewer cpu scheduling
 
Unit 2 notes
Unit 2 notesUnit 2 notes
Unit 2 notes
 
Scheduling
SchedulingScheduling
Scheduling
 
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three ProblemsIBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
 

Ähnlich wie Scheduling algo(by HJ)

Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2pri534
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Nagarajan
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - EngineeringYogesh Santhan
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.pptKeyreSebre
 
Preemptive process example.pptx
Preemptive process example.pptxPreemptive process example.pptx
Preemptive process example.pptxjamilaltiti1
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System SchedulingVishnu Prasad
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process SchedulingShipra Swati
 
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
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfRakibul Rakib
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Ch6
Ch6Ch6
Ch6C.U
 
CPU scheduling
CPU schedulingCPU scheduling
CPU schedulingAmir Khan
 

Ähnlich wie Scheduling algo(by HJ) (20)

Process management in os
Process management in osProcess management in os
Process management in os
 
Os..
Os..Os..
Os..
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
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
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
Preemptive process example.pptx
Preemptive process example.pptxPreemptive process example.pptx
Preemptive process example.pptx
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
 
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
Cpu schedulingCpu scheduling
Cpu scheduling
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdf
 
Ch5
Ch5Ch5
Ch5
 
Osy ppt - Copy.pptx
Osy ppt - Copy.pptxOsy ppt - Copy.pptx
Osy ppt - Copy.pptx
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Ch6
Ch6Ch6
Ch6
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 
Scheduling
SchedulingScheduling
Scheduling
 
OS_Ch6
OS_Ch6OS_Ch6
OS_Ch6
 

Kürzlich hochgeladen

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 

Kürzlich hochgeladen (20)

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 

Scheduling algo(by HJ)

  • 1.
  • 2. What is CPU Scheduling…? It decides which processes will run when there are multiple runnable processes. Why CPU Scheduling is used…? In General term the aim of CPU Scheduling is to make the System efficient, fast and fair. The I/O will take a long time, and we never want to leave the CPU idle, while waiting for the I/O to finish.
  • 3. Basic assumption behind the Scheduling Algorithms:-  There is a pool of runnable processes contending for the CPU. The OS is a multitasking, but not a multiprocessor  The processes are independent and compete for resources.  The job of the Scheduler is to distribute the scarce resource of the CPU to the different processes ‘fairly’.
  • 4. Long-term scheduler: admits new processes to the system; required because each process needs a portion of the available memory for its code and data. Short-term scheduler: determines the assignment of the CPU to ready processes; required because of IO requests and completions. Hard Disk RAM CPU
  • 5. Scheduling Management Processes are managed through the use of multiple queues of PCB's. The job queue contains all jobs submitted to the system, but not yet in main memory. The ready queue contains all jobs in main memory ready to execute. Each I/O device has a queue of jobs waiting for various I/O operations. A process is then dispatched from the ready queue to the CPU.
  • 6. Some terms related to Scheduling… 3.Waiting Time:- Waiting time is the sum of the periods spent waiting in the ready queue. 2.Throughput:- The number of processes that are completed per time unit, called throughput. 1. CPU Utilization :- Conceptually, CPU utilization can range from 0 to 100 percent. In a real system, it should range from 40 percent (for a lightly loaded system) to 90 percent (for a heavily used system).
  • 7. 6.Burst Cycle :- Process cycles between CPU processing and I/O activity. The cycles are of two types:- - CPU Burst Cycle - I/O Burst Cycle 5.Respond Time :- The measure of the time from the submission of a request until the first response is produced. 4 .Turn-around Time :- Turnaround time is the sum of the time spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O.
  • 8. 8.CPU Bound Processes :- Processes that perform lots of computation and do little IO. 7. IO Bound Processes :- Processes that perform lots of IO operations. Ex. Calculator - Ready 9. Process States :- - Running - Waiting
  • 9. 10. PCB :- Process Control Block is a data structure in the OS containing the information needed to manage a particular process. The PCB is "the expression of a process in an operating system.” 11. Pre-emptive & Non Pre-emptive When a process switches from the Running waiting Running ready Waiting ready When a process terminates Non Pre- emptive Pre-emptive
  • 10. FCFS Shortest Job First Multi-Level Scheduling Round Robin Priority Queue Multi-level Feedback Queue Scheduling
  • 11. First Come First Serve - Jobs are executed on first come, first serve basis. - Easy to understand and implement. - Poor in performance as average wait time is high. Thus, it is rarely used in modern operating systems, but is sometimes used inside of other scheduling systems.
  • 12. Ex.:- Process Process Time (ms) P1 24 P2 3 P3 3 P1 P2 P3 Time 0 24 27 Average waiting time= (0+24+27)/3 17 ms
  • 13. Advantage:- Simple Easy to implement Dis-advantage:- This scheduling method is non-preemptive.  Because of this non-preemptive scheduling, short processes which are at the back of the queue have to wait for the long process at the front to finish
  • 14. FCFS Shortest Job First Multi-Level Scheduling Round Robin Priority Queue Multi-level Feedback Queue Scheduling
  • 15. Shortest Job First  It works, when the CPU is available, it is assigned to the process that has the smallest next CPU burst. - If the next CPU bursts of two processes are the same, FCFS scheduling is used. - Impossible to implement as we cannot always predict the future (i.e., we do not know the next burst length)
  • 16. Shortest Job First decreases the waiting time of the short process more than it increases the waiting time of the long process.  Consequently, the average waiting time decreases.  SJF scheduling is used frequently in long-term scheduling.  Moving a short process before a long one………
  • 17. Ex:- Process Process Time P1 6 P2 8 P3 7 P4 3 P4 P1 P3 P2 Time 0 3 9 16 24 Average Waiting Time = (0+3+9+16)/4 7 ms
  • 18. Ex:- Process Arrival Time Process Time P1 0 8 P2 1 4 P3 2 9 P4 3 5 P1 P2 P4 P1 P3 Time 0 1 5 10 17 Average Waiting Time = [(10-1)+(1-1)+(17-2)+(5-3)]/4 6.5 ms SJF is sometimes called shortest-remaining-time-first- scheduling
  • 19. FCFS Shortest Job First Multi-Level Scheduling Round Robin Priority Queue Multi-level Feedback Queue Scheduling
  • 20. Priority Queue The basic idea is straightforward: each process is assigned a priority, and highest priority is allowed to run.  Equal-Priority processes are scheduled in FCFS order.  The shortest-Job-First (SJF) algorithm is a special case of general priority scheduling algorithm.
  • 21. Priorities can be defined either internally or externally Internally defined priorities use some measurable quantities to compute the priority of a process, such as  time limits  memory requirements  the number of open files  the ratio of average I/O burst to average CPU burst External priorities are set by criteria outside the OS, such as  the amount of funds being paid for computer use  such as the importance of the process  other, political factors.
  • 22.  Priority scheduling can suffer from a major problem known as indefinite blocking, or starvation.  Priority scheduling can be either preemptive or non- preemptive.  In which a low-priority task can wait forever because there are always some other jobs around that have higher priority.  A solution to the problem of indefinite blockage of the low- priority process is Aging.  Aging is a technique of gradually increasing the priority of processes that wait in the system for a long period of time.
  • 23. Ex:- Process Process Time Priority P1 10 3 P2 1 1 P3 2 4 P4 1 5 P5 5 2 Time P2 P5 P1 P3 0 1 6 16 Average Waiting Time = (0+1+6+16+18)/4 8.2 ms P4 18
  • 24. FCFS Shortest Job First Multi-Level Scheduling Round Robin Priority Queue Multi-level Feedback Queue Scheduling
  • 25. Round Robin It is specially designed for Time-Sharing System  It is similar to FCFS scheduling, but preemption is added to switch between processes.  Each process is provided a fix time to execute called quantum.  Once a process is executed for given time period. Process is preempted and other process executes for given time period.
  • 26. sets a timer to interrupt after 1 time quantum  The CPU scheduler picks the first process from the ready queue and dispatches the process.  Therefore, one of two things will then happen.  The process may have a CPU burst of less than 1 time quantum.  Otherwise, a context switch will be executed, and the process will be put at the tail of the ready queue.
  • 27. If there are n process in the ready Queue and the time quantum is q, then each process must wait no longer then… (n-1) x q time units (until its next time quantum) For Ex.:- n=4 And q=10ms Time till second chance (4-1) x 10 =30 ms
  • 28. Now, the choice of how big to make the time quantum(q) is extremely important If q is very large then, Round Robin degenerates into FCFS If q is very small, the context switch overhead defeats the benefits, & the RR approach is called processor sharing.
  • 29. Example: Process Process Time P1 24 P2 3 P3 3 Time P1 P2 P3 P1 P1 P1 P1 P1 0 4 7 10 14 18 22 26 Average Waiting Time = (0+4+7+(10-4))/3 5.6 ms
  • 30. FCFS Shortest Job First Multi-Level Scheduling Round Robin Priority Queue Multi-level Feedback Queue Scheduling
  • 31. Multi-level Scheduling Multiple queues are maintained for processes. Each queue can have its own scheduling algorithms. Priorities are assigned to each queue. The processes are permanently assigned to one queue, generally based on some property of the process, such as memory size, process priority, or process type.
  • 32. Ex. of a Ready queue of multi-queue algorithm:
  • 33. Scheduling must be done between queues, because:  fixed priority (may lead to starvation) (e.g., foreground jobs have absolute priority over background jobs)  time slice per queue
  • 34. FCFS Shortest Job First Multi-Level Scheduling Round Robin Priority Queue Multi-level Feedback Queue Scheduling
  • 35. Multi-level Feedback Queue Scheduling In this Processor are permanently assigned to a queue The Multi-level Feedback Queue Scheduling, algorithm, in contrast, allow a process to move between queues. If a process uses too much CPU time, it will be moved to a lower-priority queue.
  • 36. Multi-level Feedback Queue Scheduling This Scheme leaves I/O bound and interactive process in the higher-priority queue. In addition, a process waits too long in a lower – priority queue may be moved into a higher- priority queue. The idea is to separate processes according to the characteristics of their CPU bursts.
  • 37. For example, consider a multilevel feedback-queue scheduler with three queues, numbered from 0 to 2.  The scheduler first executes all processes in queue 0.  Only when queue 0 is empty will it execute processes in queue 1.  Similarly, processes in queue 2 will only be executed if queues 0 and 1 are empty.  While executing queue 1, if a process arrives in queue 0 – then pre-emption will take place
  • 38. A process entering the ready Queue is put in queue 0. A process in queue 0 is given a time quantum of 8 millisecond If queue 0 is empty the process at the head of queue 1 is given a quantum of 16 millisecond. Process in queue 2 are run on an FCFS basis but are run only when queues o and 1 are empty If it does not finish within this time, it is moved to the tail of queue 1. If it does not complete, it is preempted and is put into queue 2
  • 39. quantum = 8 quantum = 16 FCFS
  • 40. This scheduling algorithm gives highest priority to any process with a CPU burst of 8 millisecond or less Processes that need more then 8 but less then 24 millisecond are also served quickly, although with lower priority then shorter processes. Long processes automatically sink to queue 2 and served in FCFS order with any CPU cycles left over from queues 0 and 1.