SlideShare a Scribd company logo
Scheduling
Basic concept
In a single-processor system only one process can run at a
time. Other active processes wait their turn until the CPU is
free.
●
The main purpose of the multiprogramming is to have
process running at all times, in order to maximize CPU
utilization.
●
Maximization is achieved by reducing the idle time of a
process while waits for the completion of some I/O request
●

Operating System 2011/2012
CPU – I/O Burst Cycle
●

●

●

The process execution
process execution consists of a
cycle of CPU execution and
I/O wait.
The duration of the CPU
execution and the I/O wait
depend on the process type.
Processes are divided in
●
CPU bounded
●
I/O bounded

Operating System 2011/2012
CPU Scheduler
A new process is scheduled by the CPU when the previous one:
1. switches from the running state to the waiting state,
2. switches from the running state to the ready state
3. switches from the waiting state to the ready state
4. terminates
●

●

●

When scheduling takes place only under circumstances 1 and 4,
we say that the scheduling scheme is nonpreemptive or
cooperative, otherwise, it is preemptive.
At the nonpreemptive scheduling is the process that
autonomously releases the resource.
At the preemptive scheduling is the scheduler that forces the
process to interrupt and release the resource.

Operating System 2011/2012
Dispatcher
The dispatcher is the module that gives the control of the
CPU to the process selected by the short-term scheduler.
This module is responsible of the process switch:
●
collects the information of one process to stop
●
store the process stack
●
load the next process stack
●
give control to the CPU
The time the dispatcher takes to stop one process and
start another process of the queue is called dispatch latency.
Operating System 2011/2012
Scheduling Criteria
The criteria used by the algorithms to evaluate the efficiency are:
●
●

●

●

●

CPU utilization: % of time where the CPU is busy.
Throughput: number of processes that are completed per time
unit (from mm to h).
Turnaround time: is the sum of the periods spent waiting to get
into memory, waiting in the ready queue, executing on the CPU,
and doing I/O.
Waiting time: is the sum of the periods spent waiting in the ready
queue.
Response time: is the time from the submission of a request until
the first response is produced.

Operating System 2011/2012
Scheduling Algorithms
●

First-Come, First-Served (FCFS)

●

Shortest-Job-First (SJF)

●

Priority Scheduling

●

Round-Robin Scheduling

●

Multilevel Queue Scheduling

●

Multilevel Feedback Queue Scheduling

Operating System 2011/2012
First-Come, First-Served (FCFS)
●

Simplest CPU-scheduling algorithm.

●

The process that requests the CPU first is allocated the CPU
first (managed by the FIFO queue) .

●

( + ) The code for FCFS scheduling is simple to write and
understand.

●

( - ) The average waiting time under the FCFS policy is often
quite long.

Operating System 2011/2012
First-Come, First-Served (FCFS)
Suppose that the processes arrive in the order: P1 , P2 , P3,
with the respective computation time: 24, 3, 3.

Waiting time for:
●
P1 = 0 – no process to wait;
●
P2 = 24 – starts after P1;
●
P3 = 27 – starts after P1 and P2;
Average waiting time: (0 + 24 + 27)/3 = 17

Operating System 2011/2012
First-Come, First-Served (FCFS)
Suppose that the processes arrive in the order P2 , P3 , P1 with
the respective computation time: 3, 3, 24.

Waiting time for:
●
P2 = 0 – no process to wait;
●
P3 = 3 – starts after P2;
●
P1 = 6 – starts after P2 and P3;
Average waiting time: (0 + 3 + 6) / 3 = 3

Operating System 2011/2012
First-Come, First-Served (FCFS)
FCFS is non-preemptive
●
Not good for time sharing systems where where each user
needs to get a share of the CPU at regular intervals.
●
Convoy effect short process(I/O bound) wait for one long
CPU-bound process to complete a CPU burst before they get
a turn
●

➢
➢

➢
➢

➢

lowers CPU and device utilization
I/O bound processes complete their burst and enter ready queue –
I/O devices idle and I/O bound processes waiting
CPU bound process completes CPU burst and moves to I/O device
I/O bound processes all quickly complete their CPU bursts and enter
I/O queue – now CPU is idle
CPU bound completes I/O and executes on CPU; back to step 1

Operating System 2011/2012
Shortest-Job-First (SJF)
Shortest-Next-CPU-Burst algorithm.
●
This algorithm associates with each process the length of the
process’s next CPU burst.
●
If the next CPU bursts of two processes are the same, FCFS
scheduling is used.
●
Two schemes:
●

●

●

●

nonpreemptive – once CPU given to the process it cannot be
preempted until completes its CPU burst.
preemptive – if a new process arrives with CPU burst length
less than remaining time of current executing process,
preempt. This scheme is know as the Shortest-RemainingTime-First (SRTF).

SJF is optimal – gives minimum average waiting time for a
given set of processes.

Operating System 2011/2012
Shortest-Job-First (SJF)
Suppose that the processes arrive in the order: P1 , P2 , P3, P4
with the respective computation time: 6, 8, 7, 3.

Waiting time for:
●
P4 = 0 – no process to wait;
●
P1 = 3 – starts after P4;
●
P3 = 9 – starts after P4 and P1;
●
P2 = 16 – starts after P4, P1 and P3;
Average waiting time: (3 + 16 + 9 + 0)/4 = 7
Operating System 2011/2012
Shortest-Job-First (SJF)
Suppose that the processes arrive in the order: P1 , P2 , P3, P4
with the respective computation time: 8, 4, 9, 3.

Waiting time for:
●
P4 = 0 – no process to wait;
●
P2 = 3 – starts after P4;
●
P3 = 9 – starts after P4 and P1;
●
P2 = 16 – starts after P4, P1 and P3;
Average waiting time: (3 + 16 + 9 + 0)/4 = 7
Operating System 2011/2012
Priority Scheduling
A priority number (integer) is associated with each process
●
The CPU is allocated to the process with the highest priority
(smallest integer – highest priority).
●
Can be preemptive (compares priority of process that has
arrived at the ready queue with priority of currently running
process) or nonpreemptive (put at the head of the ready
queue).
●
SJF is a priority scheduling where priority is the predicted
next CPU burst time.
●
Problem Starvation – low priority processes may never
execute.
●
Solution Aging – as time progresses increase the priority of
the process.
●

Operating System 2011/2012
Priority Scheduling
Process

Burst Time

Priority

P1

10

3

P2

1

1

P3

2

4

P4

1

5

P5

5

2

Operating System 2011/2012
Round-Robin Scheduling
Each process gets a small unit of CPU time (time quantum),
usually 10-100 milliseconds. After this time has elapsed, the
process is preempted and added to the end of the ready
queue.
●
If there are n processes in the ready queue and the time
quantum is q, then each process gets 1/n of the CPU time in
chunks of at most q time units at once. No process waits
more than (n-1)q time units.
●
Performance
●
q large -> FIFO
●
q small -> q must be large with respect to context switch,
otherwise overhead is too high.
●

Operating System 2011/2012
Multilevel Queue Scheduling
Ready queue is partitioned into separate queues:
➢
foreground (interactive)
➢
background (batch)
●
Each queue has its own scheduling algorithm,
➢
foreground – RR
➢
background – FCFS
●
Scheduling must be done between the queues.
➢
Fixed priority scheduling; (i.e., serve all from foreground
then from background). Possibility of starvation.
➢
Time slice – each queue gets a certain amount of CPU
time which it can schedule amongst its processes; i.e.,
80% to foreground in RR, 20% to background in FCFS
●

Operating System 2011/2012
Multilevel Feedback Queue
A process can move between the various queues; aging can be
implemented this way.
Multilevel-feedback-queue scheduler defined by the following
parameters:
●
number of queues
●
scheduling algorithms for each queue
●
method used to determine when to upgrade a process
●
method used to determine when to demote a process
●
method used to determine which queue a process will enter
when that process needs service

Operating System 2011/2012
Multilevel Feedback Queue
Three queues:
●
Q0 – time quantum 8 milliseconds
●
Q1 – time quantum 16 milliseconds
●
Q2 – FCFS
Scheduling
●
A new job enters queue Q0 which is served FCFS. When it
gains CPU, job receives 8 milliseconds. If it does not finish
in 8 milliseconds, job is moved to queue Q1.
●
At Q1 job is again served FCFS and receives 16 additional
milliseconds. If it still does not complete, it is preempted
and moved to queue Q2.
Operating System 2011/2012
Multiple-Processor Scheduling
●

Multiprocessing
●
●

●

Processor affinity
●
●

●

Soft
Hard

Load Balancing
●
●

●

Asymmetric (AMP)
Symmetric (SMP)

push migration: task
pull migration: process

Multi-core

Operating System 2011/2012
Symmetric vs Asymmetric
Asymmetric: processors are dedicated to specific tasks.
Symmetric: processors can execute the same tasks and
exchange them during execution.

Operating System 2011/2012
Processor Affinity
Processor Affinity: the ability of a processor to exchange
process executing on run-time.
Soft affinity: a process can move from one CPU to another.
Hard affinity: a process can not move from one CPU to
another.

Operating System 2011/2012
Load Balancing
Push migration occurs when a specific task periodically
checks the load on each processor and move a process from a
busy CPU to an idle one.
Pull migration occurs when an idle processor pulls a waiting
task from a busy processor.

Operating System 2011/2012

More Related Content

What's hot

Operations Scheduling
Operations SchedulingOperations Scheduling
Operations Scheduling
Ashish Jain
 
Operations scheduling
Operations schedulingOperations scheduling
Operations scheduling
RajThakuri
 
Scheduling
SchedulingScheduling
Scheduling
mrinalmanik64
 
Work Center Scheduling
Work Center Scheduling Work Center Scheduling
Work Center Scheduling
Shivangi Singh
 
7. scheduling
7. scheduling7. scheduling
7. scheduling
Sudipta Saha
 
Loading jobs and methods definitivo
Loading jobs and methods definitivo Loading jobs and methods definitivo
Loading jobs and methods definitivo
Jorge Fuentes
 
Scheduling production
Scheduling   productionScheduling   production
Scheduling production
Aditya Powale
 
Operations Scheduling
Operations SchedulingOperations Scheduling
Operations Schedulingsenthil.G
 
Types of loading, production & operations management
Types of loading, production & operations managementTypes of loading, production & operations management
Types of loading, production & operations management
Mahima Mutnuru
 
Operation scheduling
Operation schedulingOperation scheduling
Operation schedulingsai precious
 
Jonson"s Rule Production scheduling
 Jonson"s Rule Production scheduling Jonson"s Rule Production scheduling
Jonson"s Rule Production scheduling
mrinalmanik64
 
Job shop scheduling
Job shop schedulingJob shop scheduling
Job shop scheduling
Sujeet TAMBE
 
Mpc sequencing
Mpc   sequencingMpc   sequencing
Mpc sequencing
Pankaj Kumar
 
What is forward and backward scheduling
What is forward and backward schedulingWhat is forward and backward scheduling
What is forward and backward schedulingNaresh Gupta
 
Chapter 15; Short-Term Scheduling
Chapter 15; Short-Term SchedulingChapter 15; Short-Term Scheduling
Chapter 15; Short-Term Scheduling
Alvaro Alvarez
 
Scheduling and sequencing
Scheduling and sequencingScheduling and sequencing
Scheduling and sequencingAkanksha Gupta
 

What's hot (20)

Ch17 scheduling
Ch17 schedulingCh17 scheduling
Ch17 scheduling
 
scheduling
schedulingscheduling
scheduling
 
operations scheduling
operations schedulingoperations scheduling
operations scheduling
 
Operations Scheduling
Operations SchedulingOperations Scheduling
Operations Scheduling
 
Operations scheduling
Operations schedulingOperations scheduling
Operations scheduling
 
Scheduling
SchedulingScheduling
Scheduling
 
Work Center Scheduling
Work Center Scheduling Work Center Scheduling
Work Center Scheduling
 
7. scheduling
7. scheduling7. scheduling
7. scheduling
 
Loading jobs and methods definitivo
Loading jobs and methods definitivo Loading jobs and methods definitivo
Loading jobs and methods definitivo
 
Scheduling production
Scheduling   productionScheduling   production
Scheduling production
 
Operations Scheduling
Operations SchedulingOperations Scheduling
Operations Scheduling
 
Types of loading, production & operations management
Types of loading, production & operations managementTypes of loading, production & operations management
Types of loading, production & operations management
 
Operation scheduling
Operation schedulingOperation scheduling
Operation scheduling
 
Jonson"s Rule Production scheduling
 Jonson"s Rule Production scheduling Jonson"s Rule Production scheduling
Jonson"s Rule Production scheduling
 
Job shop scheduling
Job shop schedulingJob shop scheduling
Job shop scheduling
 
Mpc sequencing
Mpc   sequencingMpc   sequencing
Mpc sequencing
 
What is forward and backward scheduling
What is forward and backward schedulingWhat is forward and backward scheduling
What is forward and backward scheduling
 
Chapter 15; Short-Term Scheduling
Chapter 15; Short-Term SchedulingChapter 15; Short-Term Scheduling
Chapter 15; Short-Term Scheduling
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Scheduling and sequencing
Scheduling and sequencingScheduling and sequencing
Scheduling and sequencing
 

Viewers also liked

Multiprocessor scheduling 3
Multiprocessor scheduling 3Multiprocessor scheduling 3
Multiprocessor scheduling 3mrbourne
 
Task allocation and scheduling inmultiprocessors
Task allocation and scheduling inmultiprocessorsTask allocation and scheduling inmultiprocessors
Task allocation and scheduling inmultiprocessors
Don William
 
Multiprocessor scheduling 1
Multiprocessor scheduling 1Multiprocessor scheduling 1
Multiprocessor scheduling 1mrbourne
 
Multiprocessor scheduling 2
Multiprocessor scheduling 2Multiprocessor scheduling 2
Multiprocessor scheduling 2mrbourne
 
Multiprocessor Scheduling
Multiprocessor SchedulingMultiprocessor Scheduling
Multiprocessor Scheduling
Khadija Saleem
 
Cpu scheduling final
Cpu scheduling finalCpu scheduling final
Cpu scheduling final
marangburu42
 
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
knowdiff
 
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
vtunotesbysree
 

Viewers also liked (13)

Multiprocessor scheduling 3
Multiprocessor scheduling 3Multiprocessor scheduling 3
Multiprocessor scheduling 3
 
Task allocation and scheduling inmultiprocessors
Task allocation and scheduling inmultiprocessorsTask allocation and scheduling inmultiprocessors
Task allocation and scheduling inmultiprocessors
 
Multiprocessor scheduling 1
Multiprocessor scheduling 1Multiprocessor scheduling 1
Multiprocessor scheduling 1
 
Multiprocessor scheduling 2
Multiprocessor scheduling 2Multiprocessor scheduling 2
Multiprocessor scheduling 2
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
Multiprocessor Scheduling
Multiprocessor SchedulingMultiprocessor Scheduling
Multiprocessor Scheduling
 
Cpu scheduling final
Cpu scheduling finalCpu scheduling final
Cpu scheduling final
 
quizz-2
quizz-2quizz-2
quizz-2
 
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
 
OSCh6
OSCh6OSCh6
OSCh6
 
Os..
Os..Os..
Os..
 
operating system lecture notes
operating system lecture notesoperating system lecture notes
operating system lecture notes
 
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
 

Similar to Scheduling

Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
Harshit Jain
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
Shipra Swati
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OS
harini0810
 
Cpu Schedule Algorithm
Cpu Schedule AlgorithmCpu Schedule Algorithm
Cpu Schedule Algorithm
Archit Jain
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
Vishnu Prasad
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
mohsinalilarik1
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
KeyreSebre
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
M. Abdullah Wasif
 
U2-LP2.ppt
U2-LP2.pptU2-LP2.ppt
U2-LP2.ppt
AJAYVISHALRP
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
Kp Sharma
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
Paurav Shah
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
Farhanahmad540205
 
Os prj ppt
Os prj pptOs prj ppt
Os prj ppt
Charmi Chokshi
 
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILEDCPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
VADAPALLYPRAVEENKUMA1
 
ch5_EN_CPUSched.pdf
ch5_EN_CPUSched.pdfch5_EN_CPUSched.pdf
ch5_EN_CPUSched.pdf
HoNguyn746501
 
Priority scheduling algorithms
Priority scheduling algorithmsPriority scheduling algorithms
Priority scheduling algorithms
Daffodil International University
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
Margrat C R
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
Nazir Ahmed
 
Operating Systems CPU Scheduling Process
Operating Systems CPU Scheduling ProcessOperating Systems CPU Scheduling Process
Operating Systems CPU Scheduling Process
Chandrakant Divate
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
Shanu Kumar
 

Similar to Scheduling (20)

Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OS
 
Cpu Schedule Algorithm
Cpu Schedule AlgorithmCpu Schedule Algorithm
Cpu Schedule Algorithm
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
U2-LP2.ppt
U2-LP2.pptU2-LP2.ppt
U2-LP2.ppt
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
 
Os prj ppt
Os prj pptOs prj ppt
Os prj ppt
 
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILEDCPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
 
ch5_EN_CPUSched.pdf
ch5_EN_CPUSched.pdfch5_EN_CPUSched.pdf
ch5_EN_CPUSched.pdf
 
Priority scheduling algorithms
Priority scheduling algorithmsPriority scheduling algorithms
Priority scheduling algorithms
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
Operating Systems CPU Scheduling Process
Operating Systems CPU Scheduling ProcessOperating Systems CPU Scheduling Process
Operating Systems CPU Scheduling Process
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
 

More from Mustafa Ugur Oduncu (8)

Windows server 2008
Windows server 2008 Windows server 2008
Windows server 2008
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Main Memory
Main MemoryMain Memory
Main Memory
 
Shared Memory
Shared MemoryShared Memory
Shared Memory
 
Thread
ThreadThread
Thread
 
Processes
ProcessesProcesses
Processes
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
 

Recently uploaded

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
ShivajiThube2
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 

Recently uploaded (20)

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 

Scheduling

  • 2. Basic concept In a single-processor system only one process can run at a time. Other active processes wait their turn until the CPU is free. ● The main purpose of the multiprogramming is to have process running at all times, in order to maximize CPU utilization. ● Maximization is achieved by reducing the idle time of a process while waits for the completion of some I/O request ● Operating System 2011/2012
  • 3. CPU – I/O Burst Cycle ● ● ● The process execution process execution consists of a cycle of CPU execution and I/O wait. The duration of the CPU execution and the I/O wait depend on the process type. Processes are divided in ● CPU bounded ● I/O bounded Operating System 2011/2012
  • 4. CPU Scheduler A new process is scheduled by the CPU when the previous one: 1. switches from the running state to the waiting state, 2. switches from the running state to the ready state 3. switches from the waiting state to the ready state 4. terminates ● ● ● When scheduling takes place only under circumstances 1 and 4, we say that the scheduling scheme is nonpreemptive or cooperative, otherwise, it is preemptive. At the nonpreemptive scheduling is the process that autonomously releases the resource. At the preemptive scheduling is the scheduler that forces the process to interrupt and release the resource. Operating System 2011/2012
  • 5. Dispatcher The dispatcher is the module that gives the control of the CPU to the process selected by the short-term scheduler. This module is responsible of the process switch: ● collects the information of one process to stop ● store the process stack ● load the next process stack ● give control to the CPU The time the dispatcher takes to stop one process and start another process of the queue is called dispatch latency. Operating System 2011/2012
  • 6. Scheduling Criteria The criteria used by the algorithms to evaluate the efficiency are: ● ● ● ● ● CPU utilization: % of time where the CPU is busy. Throughput: number of processes that are completed per time unit (from mm to h). Turnaround time: is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O. Waiting time: is the sum of the periods spent waiting in the ready queue. Response time: is the time from the submission of a request until the first response is produced. Operating System 2011/2012
  • 7. Scheduling Algorithms ● First-Come, First-Served (FCFS) ● Shortest-Job-First (SJF) ● Priority Scheduling ● Round-Robin Scheduling ● Multilevel Queue Scheduling ● Multilevel Feedback Queue Scheduling Operating System 2011/2012
  • 8. First-Come, First-Served (FCFS) ● Simplest CPU-scheduling algorithm. ● The process that requests the CPU first is allocated the CPU first (managed by the FIFO queue) . ● ( + ) The code for FCFS scheduling is simple to write and understand. ● ( - ) The average waiting time under the FCFS policy is often quite long. Operating System 2011/2012
  • 9. First-Come, First-Served (FCFS) Suppose that the processes arrive in the order: P1 , P2 , P3, with the respective computation time: 24, 3, 3. Waiting time for: ● P1 = 0 – no process to wait; ● P2 = 24 – starts after P1; ● P3 = 27 – starts after P1 and P2; Average waiting time: (0 + 24 + 27)/3 = 17 Operating System 2011/2012
  • 10. First-Come, First-Served (FCFS) Suppose that the processes arrive in the order P2 , P3 , P1 with the respective computation time: 3, 3, 24. Waiting time for: ● P2 = 0 – no process to wait; ● P3 = 3 – starts after P2; ● P1 = 6 – starts after P2 and P3; Average waiting time: (0 + 3 + 6) / 3 = 3 Operating System 2011/2012
  • 11. First-Come, First-Served (FCFS) FCFS is non-preemptive ● Not good for time sharing systems where where each user needs to get a share of the CPU at regular intervals. ● Convoy effect short process(I/O bound) wait for one long CPU-bound process to complete a CPU burst before they get a turn ● ➢ ➢ ➢ ➢ ➢ lowers CPU and device utilization I/O bound processes complete their burst and enter ready queue – I/O devices idle and I/O bound processes waiting CPU bound process completes CPU burst and moves to I/O device I/O bound processes all quickly complete their CPU bursts and enter I/O queue – now CPU is idle CPU bound completes I/O and executes on CPU; back to step 1 Operating System 2011/2012
  • 12. Shortest-Job-First (SJF) Shortest-Next-CPU-Burst algorithm. ● This algorithm associates with each process the length of the process’s next CPU burst. ● If the next CPU bursts of two processes are the same, FCFS scheduling is used. ● Two schemes: ● ● ● ● nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst. preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-RemainingTime-First (SRTF). SJF is optimal – gives minimum average waiting time for a given set of processes. Operating System 2011/2012
  • 13. Shortest-Job-First (SJF) Suppose that the processes arrive in the order: P1 , P2 , P3, P4 with the respective computation time: 6, 8, 7, 3. Waiting time for: ● P4 = 0 – no process to wait; ● P1 = 3 – starts after P4; ● P3 = 9 – starts after P4 and P1; ● P2 = 16 – starts after P4, P1 and P3; Average waiting time: (3 + 16 + 9 + 0)/4 = 7 Operating System 2011/2012
  • 14. Shortest-Job-First (SJF) Suppose that the processes arrive in the order: P1 , P2 , P3, P4 with the respective computation time: 8, 4, 9, 3. Waiting time for: ● P4 = 0 – no process to wait; ● P2 = 3 – starts after P4; ● P3 = 9 – starts after P4 and P1; ● P2 = 16 – starts after P4, P1 and P3; Average waiting time: (3 + 16 + 9 + 0)/4 = 7 Operating System 2011/2012
  • 15. Priority Scheduling A priority number (integer) is associated with each process ● The CPU is allocated to the process with the highest priority (smallest integer – highest priority). ● Can be preemptive (compares priority of process that has arrived at the ready queue with priority of currently running process) or nonpreemptive (put at the head of the ready queue). ● SJF is a priority scheduling where priority is the predicted next CPU burst time. ● Problem Starvation – low priority processes may never execute. ● Solution Aging – as time progresses increase the priority of the process. ● Operating System 2011/2012
  • 17. Round-Robin Scheduling Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. ● If there are n processes in the ready queue and the time quantum is q, then each process gets 1/n of the CPU time in chunks of at most q time units at once. No process waits more than (n-1)q time units. ● Performance ● q large -> FIFO ● q small -> q must be large with respect to context switch, otherwise overhead is too high. ● Operating System 2011/2012
  • 18. Multilevel Queue Scheduling Ready queue is partitioned into separate queues: ➢ foreground (interactive) ➢ background (batch) ● Each queue has its own scheduling algorithm, ➢ foreground – RR ➢ background – FCFS ● Scheduling must be done between the queues. ➢ Fixed priority scheduling; (i.e., serve all from foreground then from background). Possibility of starvation. ➢ Time slice – each queue gets a certain amount of CPU time which it can schedule amongst its processes; i.e., 80% to foreground in RR, 20% to background in FCFS ● Operating System 2011/2012
  • 19. Multilevel Feedback Queue A process can move between the various queues; aging can be implemented this way. Multilevel-feedback-queue scheduler defined by the following parameters: ● number of queues ● scheduling algorithms for each queue ● method used to determine when to upgrade a process ● method used to determine when to demote a process ● method used to determine which queue a process will enter when that process needs service Operating System 2011/2012
  • 20. Multilevel Feedback Queue Three queues: ● Q0 – time quantum 8 milliseconds ● Q1 – time quantum 16 milliseconds ● Q2 – FCFS Scheduling ● A new job enters queue Q0 which is served FCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q1. ● At Q1 job is again served FCFS and receives 16 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q2. Operating System 2011/2012
  • 21. Multiple-Processor Scheduling ● Multiprocessing ● ● ● Processor affinity ● ● ● Soft Hard Load Balancing ● ● ● Asymmetric (AMP) Symmetric (SMP) push migration: task pull migration: process Multi-core Operating System 2011/2012
  • 22. Symmetric vs Asymmetric Asymmetric: processors are dedicated to specific tasks. Symmetric: processors can execute the same tasks and exchange them during execution. Operating System 2011/2012
  • 23. Processor Affinity Processor Affinity: the ability of a processor to exchange process executing on run-time. Soft affinity: a process can move from one CPU to another. Hard affinity: a process can not move from one CPU to another. Operating System 2011/2012
  • 24. Load Balancing Push migration occurs when a specific task periodically checks the load on each processor and move a process from a busy CPU to an idle one. Pull migration occurs when an idle processor pulls a waiting task from a busy processor. Operating System 2011/2012