SlideShare a Scribd company logo
1 of 15
Download to read offline
Amrita
School
of
Engineering,
Bangalore
Ms. Harika Pudugosula
Teaching Assistant
Department of Electronics & Communication Engineering
• Basic Concepts
• Scheduling Criteria
• Scheduling Algorithms
• Thread Scheduling
• Multiple-Processor Scheduling
• Real-Time CPU Scheduling
• Operating Systems Examples
• Algorithm Evaluation
2
Objectives
CPU scheduling is the basis of multiprogrammed operating systems. By
switching the CPU among processes, the operating system can make the
computer more productive
• To introduce CPU scheduling, which is the basis for multiprogrammed
operating systems
• To describe various CPU-scheduling algorithms
• To discuss evaluation criteria for selecting a CPU-scheduling algorithm for
a particular system
• To examine the scheduling algorithms of several operating systems
3
Basic Concepts
• In a single-processor system, only one process can run at a time
• Others must wait until the CPU is free and can be rescheduled
• The objective of multiprogramming is to have some process running at
all times, to maximize CPU utilization
• A process is executed until it must wait, typically for the completion of
some I/O request
• In a simple computer system, the CPU then just sits idle. All this waiting
time is wasted; no useful work is accomplished
• With multiprogramming, we try to use this time productively, maximum
CPU utilization
4
Basic Concepts
• With multiprogramming, we try to use this time productively
• Several processes are kept in memory at one time
• When one process has to wait, the operating system takes the CPU
away from that process and gives the CPU to another process
• This pattern continues...
5
Basic Concepts
• Process execution consists of a
cycle of CPU execution and I/O
wait - CPU - I/O Burst Cycle
• CPU Burst - when the process is
being executed in the CPU
• I/O Burst - when the CPU is
waiting for I/O for further exection
• CPU burst followed by I/O burst
• Eventually, the final CPU burst
ends with a system request to
terminate execution
6
Histogram of CPU-burst Times
7
• An I/O-bound program typically has many short CPU bursts
• A CPU-bound program might have a few long CPU bursts.
CPU Scheduler
• Short-term/CPU scheduler selects from among the processes in ready
queue, and allocates the CPU to one of them
• Queue may be ordered in various ways
• CPU scheduling decisions may take place when a process:
1. Switches from running to waiting state
2. Switches from running to ready state
3. Switches from waiting to ready
4. Terminates
• For situations 1 and 4, there is no choice in terms of scheduling
A new process (if one exists in the ready queue) must be selected for
execution
• However, there is a choice for situations 2 and 3
8
CPU Scheduler
• When scheduling takes place only under circumstances 1 and 4, we say
that the scheduling scheme is nonpreemptive or cooperative
• Otherwise, it is preemptive
• Under nonpreemptive scheduling, once the CPU has been allocated to
a process, the process keeps the CPU until it releases the CPU either by
terminating or by switching to the waiting state
• Under preemptive scheduling, CPU has been taken away from a
process, before the process has completed its execution or before it is
swicting to the waiting state
• Scheduling under 1 and 4 is nonpreemptive
• All other scheduling is preemptive
• Consider access to shared data
• Consider preemption while in kernel mode
• Consider interrupts occurring during crucial OS activities
9
Dispatcher
• Dispatcher module gives control of the CPU to the process selected by
the short-term scheduler; this involves:
• switching context
• switching to user mode
• jumping to the proper location in the user program to restart that
program
• Dispatch latency – time it takes for the dispatcher to stop one process
and start another running
10
Scheduling Criteria
• CPU utilization –
• keep the CPU as busy as possible
• Conceptually, CPU utilization can range from 0 to 100 percent
• In a real system, it should range from 40 percent (for a lightly loaded
system) to 90 percent (for a heavily loaded system).
• Throughput –
• Number of processes that complete their execution per time unit
• For long processes, this rate may be one process per hour
• For short transactions, it may be ten processes per second
• Turnaround time –
• amount of time to execute a particular process
• The interval from the time of submission of a process to the time of
completion is the turnaround time
11
Scheduling Criteria
• Turnaround time –
• 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 –
• The CPU-scheduling algorithm does not affect the amount of time
during which a process executes or does I/O
• It affects only the amount of time that a process spends waiting in the
ready queue
• Waiting time is the sum of the periods spent waiting in the ready
queue
• Response time –
• amount of time it takes from when a request was submitted until the
first response is produced, not output (for time-sharing environment)
12
Scheduling Algorithm Optimization Criteria
• Max CPU utilization
• Max throughput
• Min turnaround time
• Min waiting time
• Min response time
13
14
References
1. Silberscatnz and Galvin, “Operating System Concepts,” Ninth Edition, John
Wiley and Sons, 2012.
15
Thank you

More Related Content

Similar to CPU Scheduling Part-I.pdf

Similar to CPU Scheduling Part-I.pdf (20)

UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
 
CPU Scheduling.pptx
CPU Scheduling.pptxCPU Scheduling.pptx
CPU Scheduling.pptx
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Section05 scheduling
Section05 schedulingSection05 scheduling
Section05 scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
L6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxL6 CPU Scheduling.pptx
L6 CPU Scheduling.pptx
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .
 
Lecture- 2_Process Management.pdf
Lecture- 2_Process Management.pdfLecture- 2_Process Management.pdf
Lecture- 2_Process Management.pdf
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Lect07
Lect07Lect07
Lect07
 
Process management1
Process management1Process management1
Process management1
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
 
Operating Systems 1 (10/12) - Scheduling
Operating Systems 1 (10/12) - SchedulingOperating Systems 1 (10/12) - Scheduling
Operating Systems 1 (10/12) - Scheduling
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptx
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 
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...
 
Operating System.pptx
Operating System.pptxOperating System.pptx
Operating System.pptx
 

More from Harika Pudugosula

More from Harika Pudugosula (20)

Artificial Neural Networks_Part-2.pptx
Artificial Neural Networks_Part-2.pptxArtificial Neural Networks_Part-2.pptx
Artificial Neural Networks_Part-2.pptx
 
Artificial Neural Networks_Part-1.pptx
Artificial Neural Networks_Part-1.pptxArtificial Neural Networks_Part-1.pptx
Artificial Neural Networks_Part-1.pptx
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
CPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdfCPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdf
 
CPU Scheduling Part-II.pdf
CPU Scheduling Part-II.pdfCPU Scheduling Part-II.pdf
CPU Scheduling Part-II.pdf
 
Multithreaded Programming Part- III.pdf
Multithreaded Programming Part- III.pdfMultithreaded Programming Part- III.pdf
Multithreaded Programming Part- III.pdf
 
Multithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdfMultithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdf
 
Multithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdfMultithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdf
 
Deadlocks Part- III.pdf
Deadlocks Part- III.pdfDeadlocks Part- III.pdf
Deadlocks Part- III.pdf
 
Deadlocks Part- II.pdf
Deadlocks Part- II.pdfDeadlocks Part- II.pdf
Deadlocks Part- II.pdf
 
Deadlocks Part- I.pdf
Deadlocks Part- I.pdfDeadlocks Part- I.pdf
Deadlocks Part- I.pdf
 
Memory Management Strategies - IV.pdf
Memory Management Strategies - IV.pdfMemory Management Strategies - IV.pdf
Memory Management Strategies - IV.pdf
 
Memory Management Strategies - III.pdf
Memory Management Strategies - III.pdfMemory Management Strategies - III.pdf
Memory Management Strategies - III.pdf
 
Memory Management Strategies - II.pdf
Memory Management Strategies - II.pdfMemory Management Strategies - II.pdf
Memory Management Strategies - II.pdf
 
Memory Management Strategies - I.pdf
Memory Management Strategies - I.pdfMemory Management Strategies - I.pdf
Memory Management Strategies - I.pdf
 
Virtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfVirtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdf
 
Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdf
 
Operating System Structure Part-II.pdf
Operating System Structure Part-II.pdfOperating System Structure Part-II.pdf
Operating System Structure Part-II.pdf
 
Operating System Structure Part-I.pdf
Operating System Structure Part-I.pdfOperating System Structure Part-I.pdf
Operating System Structure Part-I.pdf
 
Lecture-4_Process Management.pdf
Lecture-4_Process Management.pdfLecture-4_Process Management.pdf
Lecture-4_Process Management.pdf
 

Recently uploaded

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
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
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.
 
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.
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

CPU Scheduling Part-I.pdf

  • 1. Amrita School of Engineering, Bangalore Ms. Harika Pudugosula Teaching Assistant Department of Electronics & Communication Engineering
  • 2. • Basic Concepts • Scheduling Criteria • Scheduling Algorithms • Thread Scheduling • Multiple-Processor Scheduling • Real-Time CPU Scheduling • Operating Systems Examples • Algorithm Evaluation 2
  • 3. Objectives CPU scheduling is the basis of multiprogrammed operating systems. By switching the CPU among processes, the operating system can make the computer more productive • To introduce CPU scheduling, which is the basis for multiprogrammed operating systems • To describe various CPU-scheduling algorithms • To discuss evaluation criteria for selecting a CPU-scheduling algorithm for a particular system • To examine the scheduling algorithms of several operating systems 3
  • 4. Basic Concepts • In a single-processor system, only one process can run at a time • Others must wait until the CPU is free and can be rescheduled • The objective of multiprogramming is to have some process running at all times, to maximize CPU utilization • A process is executed until it must wait, typically for the completion of some I/O request • In a simple computer system, the CPU then just sits idle. All this waiting time is wasted; no useful work is accomplished • With multiprogramming, we try to use this time productively, maximum CPU utilization 4
  • 5. Basic Concepts • With multiprogramming, we try to use this time productively • Several processes are kept in memory at one time • When one process has to wait, the operating system takes the CPU away from that process and gives the CPU to another process • This pattern continues... 5
  • 6. Basic Concepts • Process execution consists of a cycle of CPU execution and I/O wait - CPU - I/O Burst Cycle • CPU Burst - when the process is being executed in the CPU • I/O Burst - when the CPU is waiting for I/O for further exection • CPU burst followed by I/O burst • Eventually, the final CPU burst ends with a system request to terminate execution 6
  • 7. Histogram of CPU-burst Times 7 • An I/O-bound program typically has many short CPU bursts • A CPU-bound program might have a few long CPU bursts.
  • 8. CPU Scheduler • Short-term/CPU scheduler selects from among the processes in ready queue, and allocates the CPU to one of them • Queue may be ordered in various ways • CPU scheduling decisions may take place when a process: 1. Switches from running to waiting state 2. Switches from running to ready state 3. Switches from waiting to ready 4. Terminates • For situations 1 and 4, there is no choice in terms of scheduling A new process (if one exists in the ready queue) must be selected for execution • However, there is a choice for situations 2 and 3 8
  • 9. CPU Scheduler • When scheduling takes place only under circumstances 1 and 4, we say that the scheduling scheme is nonpreemptive or cooperative • Otherwise, it is preemptive • Under nonpreemptive scheduling, once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or by switching to the waiting state • Under preemptive scheduling, CPU has been taken away from a process, before the process has completed its execution or before it is swicting to the waiting state • Scheduling under 1 and 4 is nonpreemptive • All other scheduling is preemptive • Consider access to shared data • Consider preemption while in kernel mode • Consider interrupts occurring during crucial OS activities 9
  • 10. Dispatcher • Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves: • switching context • switching to user mode • jumping to the proper location in the user program to restart that program • Dispatch latency – time it takes for the dispatcher to stop one process and start another running 10
  • 11. Scheduling Criteria • CPU utilization – • keep the CPU as busy as possible • Conceptually, CPU utilization can range from 0 to 100 percent • In a real system, it should range from 40 percent (for a lightly loaded system) to 90 percent (for a heavily loaded system). • Throughput – • Number of processes that complete their execution per time unit • For long processes, this rate may be one process per hour • For short transactions, it may be ten processes per second • Turnaround time – • amount of time to execute a particular process • The interval from the time of submission of a process to the time of completion is the turnaround time 11
  • 12. Scheduling Criteria • Turnaround time – • 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 – • The CPU-scheduling algorithm does not affect the amount of time during which a process executes or does I/O • It affects only the amount of time that a process spends waiting in the ready queue • Waiting time is the sum of the periods spent waiting in the ready queue • Response time – • amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment) 12
  • 13. Scheduling Algorithm Optimization Criteria • Max CPU utilization • Max throughput • Min turnaround time • Min waiting time • Min response time 13
  • 14. 14 References 1. Silberscatnz and Galvin, “Operating System Concepts,” Ninth Edition, John Wiley and Sons, 2012.