SlideShare a Scribd company logo
( T E C H N I C A L P R E S E N TAT I O N S K I L L S )
CPU SCHEDULING
SHRI VAISHNAV VIDYAPEETH VISHWAVIDYALAYA
SHRI VAISHNAV INSTITUTE OF INFORMATION TECHNOLOGY
DEPARTMENT OF INFORMATION TECHNOLOGY
Submitted By:
Yashita Namdeo
CSE – B
18100BTIT03158
Submitted To:
Mrs. Sonam Mehta
WHAT IS CPU SCHEDULING?
• Operating System manages a collection of processes.
• If a system has more processes and one CPU or more
processes with fewer CPU’s has to divide CPU time
among different processes.
• This is called CPU Scheduling
PROCESS STATE DIAGRAM
PROCESS STATES
• New State : process is under creation
• Ready State : waiting for CPU for execution
• Running State : under execution
• Termination : execution is completed
• Waiting/Block : waits for certain resource
• Suspend Wait : process waits in Secondary Memory
• Suspend Ready : moves from ready state to Secondary
Memory
NEED OF SCHEDULING?
• CPU scheduling is a process which allows one process
to use the CPU while the execution of another process is
on hold(in waiting state) due to unavailability of any
resource like I/O etc, thereby making full use of CPU.
• The aim of CPU scheduling is to make the system
efficient, fast and fair.
NEED OF SCHEDULING
• Whenever the CPU becomes idle, the operating system
must select one of the processes in the ready queue to
be executed.
• The selection process is carried out by the short-term
scheduler (or CPU scheduler).
• The scheduler selects from among the processes in
memory that are ready to execute, and allocates the
CPU to one of them.
Continue
OVERVIEW
• Short term scheduler : selects a process from ready
queue among the ready processes to execute on the
CPU.
• Based on the Scheduling Algorithm employed on the
system.
• CPU switching from one process to another requires
saving the state of the current process and having the
latest state of the next process. This is known as
Context Switching
• Dispatcher : the STS just selects the process which can
be assigned to the processor. The actual job of Context
Switching is done by dispatcher.
• Dispatch Latency : Time taken by dispatcher to stop
one process and start another process.
SCHEDULING CRITERIA
• Arrival Time ( AT )
• Burst Time ( BT / ET )
• Turn Around Time ( TAT )
• Waiting Time ( WT )
• Response Time ( RT )
• Completion Time ( CT )
• Arrival Time : time the process has arrived in RS.
• Burst Time/ Execution Time : time required by process
for its execution.
• Completion Time : time when process is completed.
• Turn Around Time : CT – AT
• Waiting Time : TAT – ET
• Response Time : AT – first response by CPU
• Throughput : no. of process that complete execution
per unit time.
• CPU Utilization : keep CPU as busy as possible.
TYPES OF SCHEDULING METHODS
• Preemptive – OS can force ( preempt ) a process from
CPU at anytime.
• Nonpreemptive – once a process is allocated the CPU,
it does not leave unless:
i. It has to wait( for I/O request)
ii. It terminates
SCHEDULING ALGORITHMS
• First Come First Serve ( FCFS )
• Shortest Job First ( SJF )
• Priority
• Round Robin ( RR )
FIRST COME FIRST SERVE
• First Come, First Serve (FCFS), is the simplest
scheduling algorithm, FIFO simply queues processes in
the order that they arrive in the ready queue.
• Throughput can be low, since long processes can hold
the CPU.
• It is based on Queuing.
• No prioritization occurs, thus this system has trouble
meeting process deadlines.
• Convey Effect – short process behind long process.
MERITS AND DEMERITS
Merits
• Easy to understand and
easy to program.
• It is fair.
Demerites
• Does not perform well in
real systems.
• Ignores the service time
request and all criteria.
SHORTEST JOB FIRST
i. Non preemptive – once CPU given to the process it
cannot be preempted until completes its CPU burst.
ii. Preemptive – if a new process arrives with CPU burst
length less than remaining time of current executing
process, preempt. This scheme is known as the
Shortest – Remaining – Time – First (SRTF).
MERITS AND DEMERITS
Merits
• SJF is optimal – gives
minimum average waiting
time for a given set of
processes.
Demerits
• Need to have a good
heuristic to guess the
next CPU execution time.
• Short duration processes
will starve longer ones.
PRIORITY SCHEDULING
• The SJF algorithm is a special case of the general
priority scheduling algorithm.
• A priority number(integer) is associated with each
process.
• The CPU is allocated to the process with the highest
priority (smallest integer = highest priority)
• Starvation (Infinity blocking) : low priority process may
never execute.
• Aging : as time progresses increases the priority of the
process.
MERITS AND DEMERITS
Merits
• Simplicity
• Reasonable support for
priority.
• Suitable for applications
with varying time and
resource requirements.
Demerits
• Indefinite blocking or
starvation.
• A priority scheduling can
leave some low priority
waiting processes
indefinitely for CPU.
ROUND ROBIN
• 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.
MERITS AND DEMERITS
Merits
• Fair allocation of CPU
across jobs.
• Low average waiting time
when job lengths vary.
Demerits
• It is suitable for task with
varied burst time. But for
task with same time
makes trouble.
CPU Scheduling.pptx
CPU Scheduling.pptx

More Related Content

Similar to CPU Scheduling.pptx

CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
Tayba Farooqui
 
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
 
CPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdfCPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdf
Harika Pudugosula
 
L6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxL6 CPU Scheduling.pptx
L6 CPU Scheduling.pptx
SeniorGaming
 
Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.
Shreya Kumar
 
ch5_CPU Scheduling_part1.pdf
ch5_CPU Scheduling_part1.pdfch5_CPU Scheduling_part1.pdf
ch5_CPU Scheduling_part1.pdf
SonaliAjankar
 
Ch6 cpu scheduling
Ch6   cpu schedulingCh6   cpu scheduling
Ch6 cpu scheduling
Welly Dian Astika
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
Nazir Ahmed
 
May14ProcessScheduling.ppt
May14ProcessScheduling.pptMay14ProcessScheduling.ppt
May14ProcessScheduling.ppt
ansariparveen06
 
pscheduling.ppt
pscheduling.pptpscheduling.ppt
pscheduling.ppt
ansariparveen06
 
Lecture 7 cpu scheduling
Lecture 7   cpu schedulingLecture 7   cpu scheduling
Lecture 7 cpu scheduling
Pradeep Kumar TS
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
manideepakc
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .
nathansel1
 
Operating system
Operating systemOperating system
Operating system
devanshi_chowdhary
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .ppt
Saba651353
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptx
SHUJEHASSAN
 
Section05 scheduling
Section05 schedulingSection05 scheduling
Section05 scheduling
Venkatesh Chowdary Nagilla
 
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptxCPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
TSha7
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
M. Abdullah Wasif
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
usmankiyani1
 

Similar to CPU Scheduling.pptx (20)

CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
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
 
CPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdfCPU Scheduling Part-I.pdf
CPU Scheduling Part-I.pdf
 
L6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxL6 CPU Scheduling.pptx
L6 CPU Scheduling.pptx
 
Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.
 
ch5_CPU Scheduling_part1.pdf
ch5_CPU Scheduling_part1.pdfch5_CPU Scheduling_part1.pdf
ch5_CPU Scheduling_part1.pdf
 
Ch6 cpu scheduling
Ch6   cpu schedulingCh6   cpu scheduling
Ch6 cpu scheduling
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
May14ProcessScheduling.ppt
May14ProcessScheduling.pptMay14ProcessScheduling.ppt
May14ProcessScheduling.ppt
 
pscheduling.ppt
pscheduling.pptpscheduling.ppt
pscheduling.ppt
 
Lecture 7 cpu scheduling
Lecture 7   cpu schedulingLecture 7   cpu scheduling
Lecture 7 cpu scheduling
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .
 
Operating system
Operating systemOperating system
Operating system
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .ppt
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptx
 
Section05 scheduling
Section05 schedulingSection05 scheduling
Section05 scheduling
 
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptxCPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 

Recently uploaded

14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 

Recently uploaded (20)

14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 

CPU Scheduling.pptx

  • 1. ( T E C H N I C A L P R E S E N TAT I O N S K I L L S ) CPU SCHEDULING
  • 2. SHRI VAISHNAV VIDYAPEETH VISHWAVIDYALAYA SHRI VAISHNAV INSTITUTE OF INFORMATION TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY Submitted By: Yashita Namdeo CSE – B 18100BTIT03158 Submitted To: Mrs. Sonam Mehta
  • 3. WHAT IS CPU SCHEDULING? • Operating System manages a collection of processes. • If a system has more processes and one CPU or more processes with fewer CPU’s has to divide CPU time among different processes. • This is called CPU Scheduling
  • 5. PROCESS STATES • New State : process is under creation • Ready State : waiting for CPU for execution • Running State : under execution • Termination : execution is completed • Waiting/Block : waits for certain resource • Suspend Wait : process waits in Secondary Memory • Suspend Ready : moves from ready state to Secondary Memory
  • 6. NEED OF SCHEDULING? • CPU scheduling is a process which allows one process to use the CPU while the execution of another process is on hold(in waiting state) due to unavailability of any resource like I/O etc, thereby making full use of CPU. • The aim of CPU scheduling is to make the system efficient, fast and fair.
  • 7. NEED OF SCHEDULING • Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be executed. • The selection process is carried out by the short-term scheduler (or CPU scheduler). • The scheduler selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. Continue
  • 8. OVERVIEW • Short term scheduler : selects a process from ready queue among the ready processes to execute on the CPU. • Based on the Scheduling Algorithm employed on the system.
  • 9. • CPU switching from one process to another requires saving the state of the current process and having the latest state of the next process. This is known as Context Switching
  • 10. • Dispatcher : the STS just selects the process which can be assigned to the processor. The actual job of Context Switching is done by dispatcher. • Dispatch Latency : Time taken by dispatcher to stop one process and start another process.
  • 11. SCHEDULING CRITERIA • Arrival Time ( AT ) • Burst Time ( BT / ET ) • Turn Around Time ( TAT ) • Waiting Time ( WT ) • Response Time ( RT ) • Completion Time ( CT )
  • 12. • Arrival Time : time the process has arrived in RS. • Burst Time/ Execution Time : time required by process for its execution. • Completion Time : time when process is completed. • Turn Around Time : CT – AT • Waiting Time : TAT – ET • Response Time : AT – first response by CPU • Throughput : no. of process that complete execution per unit time. • CPU Utilization : keep CPU as busy as possible.
  • 13. TYPES OF SCHEDULING METHODS • Preemptive – OS can force ( preempt ) a process from CPU at anytime. • Nonpreemptive – once a process is allocated the CPU, it does not leave unless: i. It has to wait( for I/O request) ii. It terminates
  • 14. SCHEDULING ALGORITHMS • First Come First Serve ( FCFS ) • Shortest Job First ( SJF ) • Priority • Round Robin ( RR )
  • 15. FIRST COME FIRST SERVE • First Come, First Serve (FCFS), is the simplest scheduling algorithm, FIFO simply queues processes in the order that they arrive in the ready queue. • Throughput can be low, since long processes can hold the CPU. • It is based on Queuing. • No prioritization occurs, thus this system has trouble meeting process deadlines. • Convey Effect – short process behind long process.
  • 16.
  • 17. MERITS AND DEMERITS Merits • Easy to understand and easy to program. • It is fair. Demerites • Does not perform well in real systems. • Ignores the service time request and all criteria.
  • 18. SHORTEST JOB FIRST i. Non preemptive – once CPU given to the process it cannot be preempted until completes its CPU burst. ii. Preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is known as the Shortest – Remaining – Time – First (SRTF).
  • 19.
  • 20. MERITS AND DEMERITS Merits • SJF is optimal – gives minimum average waiting time for a given set of processes. Demerits • Need to have a good heuristic to guess the next CPU execution time. • Short duration processes will starve longer ones.
  • 21. PRIORITY SCHEDULING • The SJF algorithm is a special case of the general priority scheduling algorithm. • A priority number(integer) is associated with each process. • The CPU is allocated to the process with the highest priority (smallest integer = highest priority) • Starvation (Infinity blocking) : low priority process may never execute. • Aging : as time progresses increases the priority of the process.
  • 22.
  • 23. MERITS AND DEMERITS Merits • Simplicity • Reasonable support for priority. • Suitable for applications with varying time and resource requirements. Demerits • Indefinite blocking or starvation. • A priority scheduling can leave some low priority waiting processes indefinitely for CPU.
  • 24. ROUND ROBIN • 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.
  • 25.
  • 26. MERITS AND DEMERITS Merits • Fair allocation of CPU across jobs. • Low average waiting time when job lengths vary. Demerits • It is suitable for task with varied burst time. But for task with same time makes trouble.