SlideShare une entreprise Scribd logo
1  sur  5
Télécharger pour lire hors ligne
13
Scheduler and Dispatcher
Prepared By: Ghayour Abbas
Scheduler and Dispatcher are associated with the process scheduling of an operating
system. Scheduling is the operating system's process to decide which process should be
allocated to the CPU to execute several processes.
The key difference between scheduler and Dispatcher is that the scheduler selects a
process out of several processes to be executed. In contrast, the Dispatcher allocates the
CPU for the selected process by the scheduler.
What is Scheduler in OS
Schedulers are special system software that handles process scheduling in various ways.
Their main task is to select the jobs to submit into the system and decide which process
to run. There are three types of schedulers in an operating system.
1. Long Term Scheduler: It is also called a job scheduler. A long-term scheduler determines
which programs are admitted to the system for processing. It selects processes from the
queue and loads them into memory for execution. Process loads into the memory for
CPU scheduling.
The primary objective of the job scheduler is to provide a balanced mix of jobs, such as
I/O bound and processor bound. It also controls the degree of multiprogramming. If the
degree of multiprogramming is stable, then the average rate of process creation must be
equal to the average departure rate of processes leaving the system.
On some systems, the long-term scheduler may not be available or minimal, and Time-
sharing operating systems have no long term scheduler. When a process changes the
state from new to ready, there is a long-term scheduler.
2. Short Term Scheduler: It is also called a CPU scheduler. Its main objective is to increase
system performance under the chosen set of criteria. It is the change of ready state to
running state of the process. CPU scheduler selects a process among the processes that
are ready to execute and allocates CPU to one of them.
Short-term schedulers, also known as dispatchers, decide which process to execute next.
Short-term schedulers are faster than long-term schedulers.
3. Medium Term Scheduler: Medium-term scheduling is a part of swapping. It removes the
processes from memory, and it reduces the degree of multiprogramming. The medium-
term scheduler is in charge of handling the swapped out processes.
A running process may become suspended if it makes an I/O request, and a suspended
process cannot make any progress towards completion. In this condition, the suspended
process is moved to the secondary storage to remove the process from memory and
make space for other processes. This process is called swapping, and the process is said to
be swapped out or rolled out. Swapping may be necessary to improve the process mix.
What is Dispatcher in OS
A dispatcher is a special program that comes into play after the scheduler. When the
short term scheduler selects from the ready queue, the Dispatcher performs the task of
allocating the selected process to the CPU. A running process goes to the waiting state for
IO operation etc., and then the CPU is allocated to some other process.
This switching of CPU from one process to the other is called context switching.
A dispatcher performs various tasks, including context switching, setting up user registers
and memory mapping. These are necessary for the process to execute and transfer CPU
control to that process. When dispatching, the process changes from the ready state to
the running state.
The Dispatcher needs to be as fast as possible, as it is run on every context switch. The
time consumed by the Dispatcher is known as dispatch latency.
Sometimes, the Dispatcher is considered part of the short-term scheduler, so the whole
unit is called the short-term scheduler. In this scenario, the task of the short term
scheduler is to select a process from the ready queue and allocate the CPU for that
process. In the operating system, a dispatcher has the following responsibilities:
o Switching to user mode: All of the low-level operating system processes run on the kernel
level security access, but all application code and user issued processes run in the
application space or the user permission mode. The Dispatcher switches the processes to
the user mode.
o Addressing: The program counter (PC) register points towards the next process to be
executed. The Dispatcher is responsible for addressing that address.
o Initiation of context switch: A context switch is when a currently running process is
halted, and all of its data and its process control block (PCB) are stored in the main
memory, and another process is loaded in its place for execution.
o Managing dispatch latency: Dispatch latency is calculated as the time it takes to stop one
process and start another. The lower the dispatch latency, the more efficient the software
for the same hardware configuration.
Example of Scheduler and Dispatcher
Suppose four processes, P1, P2, P3, and P4, are in the ready queue. Their arrival times are
T1, T2, T3, and T4, respectively. And a First in, First out (FIFO) scheduling algorithm is used
in this whole process or task.
The process P1 arrived first, so the scheduler will decide it is the first process to be
executed, and the Dispatcher will remove P1 from the ready queue and give it to the CPU.
Then the scheduler will determine process P2 to be the next process that should be
executed, so when the Dispatcher returns to the queue for a new process, it will take
process P2 and give it to the CPU. This continues in the same way for process P3 and then
P4.
Difference between Scheduler and Dispatcher in Operating System
The CPU cannot execute all processes residing in the ready queue and waiting for
execution simultaneously. So the operating system has to choose a particular process
based on the scheduling algorithm, and the scheduler does this procedure of selecting a
process among various processes.
Once the scheduler has selected a process from the queue, the Dispatcher takes it from
the ready queue and moves it into the running state. Therefore, the scheduler gives the
Dispatcher an ordered list of processes which the Dispatcher moves to the CPU over time.
Scheduler and Dispatcher are used in the process scheduling of an operating system, and
they both complete the same process or task. Still, the difference between scheduler and
Dispatcher is that the scheduler selects a process out of several processes to be executed.
In contrast, the Dispatcher allocates the CPU for the selected process by the scheduler.
There are some more differences between the scheduler and the Dispatcher in the
operating system, such as:
Properties Scheduler Dispatcher
Definition The scheduler is special system software
that handles process scheduling by
selecting the process to execute.
The Dispatcher is a module that controls the
CPU to the process selected by the short term
scheduler.
Algorithm The scheduler works on various algorithms
such as FCFS, SJF, RR etc.
The Dispatcher has no specific algorithm for
its implementation.
Types There are three types of schedulers, such
as Long-term, Short-term, Medium-term.
There are no different types in Dispatcher,
and it is just a code segment.
Dependency The scheduler works independently, and it
works immediately when needed.
The working of a Dispatcher depends on a
scheduler, which means Dispatcher has to
wait until the scheduler selects a process.
Time Taken Time taken by the scheduler is usually
negligible.
The time taken by the Dispatcher is called
dispatch latency.
Functions The only work of the scheduler is a
selection of processes.
A dispatcher is also responsible for Context
Switching, Switch to user mode, and Jumping
to the proper location when the process
restarted again.
Tasks The scheduler performs the task in three
stages, such as:
o The long-term schedulerselects the
process from the job queue and
brings it to the ready queue.
o The short term schedulerselects a
process in the ready queue.
o The medium schedulercarries out
the swap in, swap out of the
process.
The Dispatcher allocates the CPU to the
process selected by the short-term scheduler.

Contenu connexe

Tendances

Operating system overview concepts ppt
Operating system overview concepts pptOperating system overview concepts ppt
Operating system overview concepts pptRajendraPrasad Alladi
 
Operating Systems
Operating SystemsOperating Systems
Operating Systemsvampugani
 
Services provided by os
Services provided by osServices provided by os
Services provided by osSumant Diwakar
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process SchedulingDamian T. Gordon
 
6 multiprogramming & time sharing
6 multiprogramming & time sharing6 multiprogramming & time sharing
6 multiprogramming & time sharingmyrajendra
 
Operating system components
Operating system componentsOperating system components
Operating system componentsSyed Zaid Irshad
 
Operating system and its types
Operating system and its types Operating system and its types
Operating system and its types vimal kumar arora
 
operating system
operating systemoperating system
operating systemKadianAman
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)nikeAthena
 
Fundamentals Of Computer
Fundamentals Of ComputerFundamentals Of Computer
Fundamentals Of ComputerJack Frost
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating SystemsShweta Shah
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linuxMazenetsolution
 
Linux shell env
Linux shell envLinux shell env
Linux shell envRahul Pola
 
Operating system notes
Operating system notesOperating system notes
Operating system notesSANTOSH RATH
 

Tendances (20)

Operating system overview concepts ppt
Operating system overview concepts pptOperating system overview concepts ppt
Operating system overview concepts ppt
 
Batch operating system
Batch operating system Batch operating system
Batch operating system
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Services provided by os
Services provided by osServices provided by os
Services provided by os
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
6 multiprogramming & time sharing
6 multiprogramming & time sharing6 multiprogramming & time sharing
6 multiprogramming & time sharing
 
Organization of a computer
Organization of a computerOrganization of a computer
Organization of a computer
 
Scheduling
SchedulingScheduling
Scheduling
 
Operating system components
Operating system componentsOperating system components
Operating system components
 
Boot process
Boot processBoot process
Boot process
 
Operating system and its types
Operating system and its types Operating system and its types
Operating system and its types
 
operating system
operating systemoperating system
operating system
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
 
Fundamentals Of Computer
Fundamentals Of ComputerFundamentals Of Computer
Fundamentals Of Computer
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating Systems
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linux
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Linux shell env
Linux shell envLinux shell env
Linux shell env
 
Operating system notes
Operating system notesOperating system notes
Operating system notes
 

Similaire à CSI-503 - 13. Scheduler and Dispatcher

Schudling os presentaion
Schudling os presentaionSchudling os presentaion
Schudling os presentaioninayat khan
 
Process scheduling.pptx
Process scheduling.pptxProcess scheduling.pptx
Process scheduling.pptxMSivani
 
CSI-503 - 3. Process Scheduling
CSI-503 - 3. Process SchedulingCSI-503 - 3. Process Scheduling
CSI-503 - 3. Process Schedulingghayour abbas
 
Operating System
Operating SystemOperating System
Operating SystemGowriLatha1
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2) rohassanie
 
operating system 1.1.pdf
operating system 1.1.pdfoperating system 1.1.pdf
operating system 1.1.pdfBillylesaigor
 
52bf066dbfcc4d739fa99d255dba287a.pptx
52bf066dbfcc4d739fa99d255dba287a.pptx52bf066dbfcc4d739fa99d255dba287a.pptx
52bf066dbfcc4d739fa99d255dba287a.pptx11SnehlataGujar
 
Multi-Threading.pptx
Multi-Threading.pptxMulti-Threading.pptx
Multi-Threading.pptxCHANDRUG31
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...ApurvaLaddha
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptxDivyaKS18
 

Similaire à CSI-503 - 13. Scheduler and Dispatcher (20)

RDos.pptx
RDos.pptxRDos.pptx
RDos.pptx
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Schudling os presentaion
Schudling os presentaionSchudling os presentaion
Schudling os presentaion
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Process scheduling.pptx
Process scheduling.pptxProcess scheduling.pptx
Process scheduling.pptx
 
CSI-503 - 3. Process Scheduling
CSI-503 - 3. Process SchedulingCSI-503 - 3. Process Scheduling
CSI-503 - 3. Process Scheduling
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
UNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdfUNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdf
 
Os unit 2
Os unit 2Os unit 2
Os unit 2
 
Operating System
Operating SystemOperating System
Operating System
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
 
operating system 1.1.pdf
operating system 1.1.pdfoperating system 1.1.pdf
operating system 1.1.pdf
 
52bf066dbfcc4d739fa99d255dba287a.pptx
52bf066dbfcc4d739fa99d255dba287a.pptx52bf066dbfcc4d739fa99d255dba287a.pptx
52bf066dbfcc4d739fa99d255dba287a.pptx
 
Multi-Threading.pptx
Multi-Threading.pptxMulti-Threading.pptx
Multi-Threading.pptx
 
Operating System.pptx
Operating System.pptxOperating System.pptx
Operating System.pptx
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...
 
Lecture 4 process cpu scheduling
Lecture 4   process cpu schedulingLecture 4   process cpu scheduling
Lecture 4 process cpu scheduling
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
 

Plus de ghayour abbas

Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)ghayour abbas
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)ghayour abbas
 
Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)ghayour abbas
 
Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)ghayour abbas
 
CSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating SystemCSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating Systemghayour abbas
 
SWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing OverviewSWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing Overviewghayour abbas
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementationghayour abbas
 
SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Designghayour abbas
 
SWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design StrategiesSWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design Strategiesghayour abbas
 
SWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design BasicsSWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design Basicsghayour abbas
 
SWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design ToolsSWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design Toolsghayour abbas
 
SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications ghayour abbas
 
SWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project ManagementSWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project Managementghayour abbas
 
CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management ghayour abbas
 
CSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronizationCSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronizationghayour abbas
 
CSI-503 - 2. Processor Management
CSI-503 - 2. Processor ManagementCSI-503 - 2. Processor Management
CSI-503 - 2. Processor Managementghayour abbas
 

Plus de ghayour abbas (20)

TCP/IP & UDP
TCP/IP & UDPTCP/IP & UDP
TCP/IP & UDP
 
Web Development 5
Web Development 5 Web Development 5
Web Development 5
 
Web Development 4
Web Development 4Web Development 4
Web Development 4
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)
 
Lab Manual CSI-321
Lab Manual CSI-321Lab Manual CSI-321
Lab Manual CSI-321
 
Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)
 
Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)
 
CSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating SystemCSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating System
 
SWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing OverviewSWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing Overview
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementation
 
SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Design
 
SWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design StrategiesSWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design Strategies
 
SWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design BasicsSWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design Basics
 
SWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design ToolsSWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design Tools
 
SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications
 
SWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project ManagementSWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project Management
 
CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management
 
CSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronizationCSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronization
 
CSI-503 - 2. Processor Management
CSI-503 - 2. Processor ManagementCSI-503 - 2. Processor Management
CSI-503 - 2. Processor Management
 

Dernier

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 

Dernier (20)

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

CSI-503 - 13. Scheduler and Dispatcher

  • 1. 13 Scheduler and Dispatcher Prepared By: Ghayour Abbas Scheduler and Dispatcher are associated with the process scheduling of an operating system. Scheduling is the operating system's process to decide which process should be allocated to the CPU to execute several processes. The key difference between scheduler and Dispatcher is that the scheduler selects a process out of several processes to be executed. In contrast, the Dispatcher allocates the CPU for the selected process by the scheduler. What is Scheduler in OS Schedulers are special system software that handles process scheduling in various ways. Their main task is to select the jobs to submit into the system and decide which process to run. There are three types of schedulers in an operating system. 1. Long Term Scheduler: It is also called a job scheduler. A long-term scheduler determines which programs are admitted to the system for processing. It selects processes from the queue and loads them into memory for execution. Process loads into the memory for CPU scheduling. The primary objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. It also controls the degree of multiprogramming. If the degree of multiprogramming is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system. On some systems, the long-term scheduler may not be available or minimal, and Time-
  • 2. sharing operating systems have no long term scheduler. When a process changes the state from new to ready, there is a long-term scheduler. 2. Short Term Scheduler: It is also called a CPU scheduler. Its main objective is to increase system performance under the chosen set of criteria. It is the change of ready state to running state of the process. CPU scheduler selects a process among the processes that are ready to execute and allocates CPU to one of them. Short-term schedulers, also known as dispatchers, decide which process to execute next. Short-term schedulers are faster than long-term schedulers. 3. Medium Term Scheduler: Medium-term scheduling is a part of swapping. It removes the processes from memory, and it reduces the degree of multiprogramming. The medium- term scheduler is in charge of handling the swapped out processes. A running process may become suspended if it makes an I/O request, and a suspended process cannot make any progress towards completion. In this condition, the suspended process is moved to the secondary storage to remove the process from memory and make space for other processes. This process is called swapping, and the process is said to be swapped out or rolled out. Swapping may be necessary to improve the process mix.
  • 3. What is Dispatcher in OS A dispatcher is a special program that comes into play after the scheduler. When the short term scheduler selects from the ready queue, the Dispatcher performs the task of allocating the selected process to the CPU. A running process goes to the waiting state for IO operation etc., and then the CPU is allocated to some other process. This switching of CPU from one process to the other is called context switching. A dispatcher performs various tasks, including context switching, setting up user registers and memory mapping. These are necessary for the process to execute and transfer CPU control to that process. When dispatching, the process changes from the ready state to the running state. The Dispatcher needs to be as fast as possible, as it is run on every context switch. The time consumed by the Dispatcher is known as dispatch latency. Sometimes, the Dispatcher is considered part of the short-term scheduler, so the whole unit is called the short-term scheduler. In this scenario, the task of the short term scheduler is to select a process from the ready queue and allocate the CPU for that process. In the operating system, a dispatcher has the following responsibilities: o Switching to user mode: All of the low-level operating system processes run on the kernel level security access, but all application code and user issued processes run in the application space or the user permission mode. The Dispatcher switches the processes to the user mode. o Addressing: The program counter (PC) register points towards the next process to be executed. The Dispatcher is responsible for addressing that address.
  • 4. o Initiation of context switch: A context switch is when a currently running process is halted, and all of its data and its process control block (PCB) are stored in the main memory, and another process is loaded in its place for execution. o Managing dispatch latency: Dispatch latency is calculated as the time it takes to stop one process and start another. The lower the dispatch latency, the more efficient the software for the same hardware configuration. Example of Scheduler and Dispatcher Suppose four processes, P1, P2, P3, and P4, are in the ready queue. Their arrival times are T1, T2, T3, and T4, respectively. And a First in, First out (FIFO) scheduling algorithm is used in this whole process or task. The process P1 arrived first, so the scheduler will decide it is the first process to be executed, and the Dispatcher will remove P1 from the ready queue and give it to the CPU. Then the scheduler will determine process P2 to be the next process that should be executed, so when the Dispatcher returns to the queue for a new process, it will take process P2 and give it to the CPU. This continues in the same way for process P3 and then P4. Difference between Scheduler and Dispatcher in Operating System The CPU cannot execute all processes residing in the ready queue and waiting for execution simultaneously. So the operating system has to choose a particular process based on the scheduling algorithm, and the scheduler does this procedure of selecting a process among various processes. Once the scheduler has selected a process from the queue, the Dispatcher takes it from the ready queue and moves it into the running state. Therefore, the scheduler gives the Dispatcher an ordered list of processes which the Dispatcher moves to the CPU over time.
  • 5. Scheduler and Dispatcher are used in the process scheduling of an operating system, and they both complete the same process or task. Still, the difference between scheduler and Dispatcher is that the scheduler selects a process out of several processes to be executed. In contrast, the Dispatcher allocates the CPU for the selected process by the scheduler. There are some more differences between the scheduler and the Dispatcher in the operating system, such as: Properties Scheduler Dispatcher Definition The scheduler is special system software that handles process scheduling by selecting the process to execute. The Dispatcher is a module that controls the CPU to the process selected by the short term scheduler. Algorithm The scheduler works on various algorithms such as FCFS, SJF, RR etc. The Dispatcher has no specific algorithm for its implementation. Types There are three types of schedulers, such as Long-term, Short-term, Medium-term. There are no different types in Dispatcher, and it is just a code segment. Dependency The scheduler works independently, and it works immediately when needed. The working of a Dispatcher depends on a scheduler, which means Dispatcher has to wait until the scheduler selects a process. Time Taken Time taken by the scheduler is usually negligible. The time taken by the Dispatcher is called dispatch latency. Functions The only work of the scheduler is a selection of processes. A dispatcher is also responsible for Context Switching, Switch to user mode, and Jumping to the proper location when the process restarted again. Tasks The scheduler performs the task in three stages, such as: o The long-term schedulerselects the process from the job queue and brings it to the ready queue. o The short term schedulerselects a process in the ready queue. o The medium schedulercarries out the swap in, swap out of the process. The Dispatcher allocates the CPU to the process selected by the short-term scheduler.