SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Operations Scheduling
Operations SchedulingOperations Scheduling
Operations SchedulingAshish Jain
 
Operations scheduling
Operations schedulingOperations scheduling
Operations schedulingRajThakuri
 
Work Center Scheduling
Work Center Scheduling Work Center Scheduling
Work Center Scheduling Shivangi Singh
 
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 productionAditya 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 managementMahima 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 schedulingmrinalmanik64
 
Job shop scheduling
Job shop schedulingJob shop scheduling
Job shop schedulingSujeet TAMBE
 
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 SchedulingAlvaro Alvarez
 
Scheduling and sequencing
Scheduling and sequencingScheduling and sequencing
Scheduling and sequencingAkanksha Gupta
 

Was ist angesagt? (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
 

Andere mochten auch

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 inmultiprocessorsDon 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 SchedulingKhadija Saleem
 
Cpu scheduling final
Cpu scheduling finalCpu scheduling final
Cpu scheduling finalmarangburu42
 
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 Systemsknowdiff
 
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
 

Andere mochten auch (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...
 

Ähnlich wie 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 SchedulingShipra Swati
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OSharini0810
 
Cpu Schedule Algorithm
Cpu Schedule AlgorithmCpu Schedule Algorithm
Cpu Schedule AlgorithmArchit Jain
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System SchedulingVishnu Prasad
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.pptKeyreSebre
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdfKp Sharma
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithmsPaurav Shah
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSMargrat C R
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-schedulingNazir Ahmed
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithmsShanu Kumar
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxansariparveen06
 

Ähnlich wie 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
 
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
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 

Mehr von 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
 

Kürzlich hochgeladen

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Kürzlich hochgeladen (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.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