SlideShare una empresa de Scribd logo
1 de 2
Descargar para leer sin conexión
CPU 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.
CPU-scheduling decisions may take place under the following four circumstances:
 When a process switches from the running state to the waiting state.
 When a process switches from the running state to the ready state.
 When a process switches from the waiting state to the ready state.
 When a process terminates.
When scheduling takes place only under circumstances 1 and 4, we say that the scheduling scheme
is non-preemptive or cooperative. Otherwise, it is preemptive.
Non-Preemptive Scheduling means once a process starts its execution or the CPU is processing a
specific process it cannot be halted or in other words we cannot preempt (take control) the CPU to
some other process.
Preemptive Scheduling means once a process started its execution, the currently running process
can be paused for a short period of time to handle some other process of higher priority, it means
we can preempt the control of CPU from one process to another if required.
Scheduling Criteria
CPU utilization. We want to keep the CPU as busy as possible. Conceptually, CPU utilization
can range from 0 to 100 percent. In a real system, it range from 40 percent (for a lightly loaded
system) to 90 percent (for a heavily loaded system).
Throughput. If the CPU is busy executing processes, then work is being done. One measure of
work is the number of processes that are completed per time unit, called throughput.
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. Waiting time is the sum of the periods spent waiting in the ready queue.
Response time. Response time, is the time it takes to start responding, not the time it takes to
output the response.
Scheduling Algorithms
First-Come, First Serve (FCFS)
Shortest Job First (SJF)
Priority Scheduling
Round Robin (RR)
Multi-level Queue
Multi-level Feedback Queue
First-Come, First-Served Scheduling
Its implementation is based on FIFO queue.
Process arrives first always execute first.
FCFS is non-preemptive scheduling algorithm so processes priority does not matter.
FCFS is pre-emptive scheduling algorithm.
 If process first arrived is a big process with a high burst time, then other process with
less burst time need to wait.
Average wait time is high.
Easy to implement.
Easy to understand.
Consider the following set of processes that arrive at time 0, with the length of the CPU burst given
in milliseconds:
If the processes arrive in the order P1, P2, P3, and are served in FCFS order, we get the result
shown in the following Gantt chart, which is a bar chart that illustrates a particular schedule,
including the start and finish times of each of the participating processes:
The waiting time is 0 milliseconds for process P1, 24 milliseconds for process P2, and 27
milliseconds for process P3. Thus, the average waiting time is (0 + 24 + 27)/3 = 17 milliseconds.
If the processes arrive in the order P2, P3, P1, however, the results will be as shown in the
following Gantt chart:
The average waiting time is now (6 + 0 + 3)/3 = 3 milliseconds. This reduction is substantial. Thus,
the average waiting time under an FCFS policy is generally not minimal and may vary substantially
if the processes’ CPU burst times vary greatly.

Más contenido relacionado

La actualidad más candente

First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
nikeAthena
 
17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria 17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria
myrajendra
 
Ch6
Ch6Ch6
Ch6
C.U
 

La actualidad más candente (20)

Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 
cpu scheduling
cpu schedulingcpu scheduling
cpu scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU Scheduling
 
Scheduling
SchedulingScheduling
Scheduling
 
first come first serve scheduling in os
first come first serve scheduling in os first come first serve scheduling in os
first come first serve scheduling in os
 
cpu scheduling OS
 cpu scheduling OS cpu scheduling OS
cpu scheduling OS
 
First Come First Serve
First Come First ServeFirst Come First Serve
First Come First Serve
 
cpu scheduling in os
cpu scheduling in oscpu scheduling in os
cpu scheduling in os
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
 
17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria 17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria
 
Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)
 
shortest job first
shortest job firstshortest job first
shortest job first
 
9 cm402.19
9 cm402.199 cm402.19
9 cm402.19
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Ch6
Ch6Ch6
Ch6
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 

Similar a Cpu scheduling

Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - Engineering
Yogesh Santhan
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
pri534
 

Similar a Cpu scheduling (20)

Fcfs and sjf
Fcfs and sjfFcfs and sjf
Fcfs and sjf
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
Preemptive process example.pptx
Preemptive process example.pptxPreemptive process example.pptx
Preemptive process example.pptx
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - Engineering
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
Unit 2 notes
Unit 2 notesUnit 2 notes
Unit 2 notes
 
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
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
Os..
Os..Os..
Os..
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
U2-LP2.ppt
U2-LP2.pptU2-LP2.ppt
U2-LP2.ppt
 
Ch5
Ch5Ch5
Ch5
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 

Más de A. S. M. Shafi

Más de A. S. M. Shafi (20)

2D Transformation in Computer Graphics
2D Transformation in Computer Graphics2D Transformation in Computer Graphics
2D Transformation in Computer Graphics
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
Projection
ProjectionProjection
Projection
 
2D Transformation
2D Transformation2D Transformation
2D Transformation
 
Line drawing algorithm
Line drawing algorithmLine drawing algorithm
Line drawing algorithm
 
Fragmentation
FragmentationFragmentation
Fragmentation
 
File organization
File organizationFile organization
File organization
 
Bankers algorithm
Bankers algorithmBankers algorithm
Bankers algorithm
 
RR and priority scheduling
RR and priority schedulingRR and priority scheduling
RR and priority scheduling
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
1D Array
1D Array1D Array
1D Array
 
2D array
2D array2D array
2D array
 
Stack push pop
Stack push popStack push pop
Stack push pop
 
Queue
QueueQueue
Queue
 
Searching
SearchingSearching
Searching
 
Sorting
SortingSorting
Sorting
 
Linked list
Linked listLinked list
Linked list
 
Sum of subset problem
Sum of subset problemSum of subset problem
Sum of subset problem
 
Quick sort
Quick sortQuick sort
Quick sort
 
N queens problem
N queens problemN queens problem
N queens problem
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
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
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
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
PECB
 

Último (20)

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
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
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...
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
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
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
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
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
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
 
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
 

Cpu scheduling

  • 1. CPU 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. CPU-scheduling decisions may take place under the following four circumstances:  When a process switches from the running state to the waiting state.  When a process switches from the running state to the ready state.  When a process switches from the waiting state to the ready state.  When a process terminates. When scheduling takes place only under circumstances 1 and 4, we say that the scheduling scheme is non-preemptive or cooperative. Otherwise, it is preemptive. Non-Preemptive Scheduling means once a process starts its execution or the CPU is processing a specific process it cannot be halted or in other words we cannot preempt (take control) the CPU to some other process. Preemptive Scheduling means once a process started its execution, the currently running process can be paused for a short period of time to handle some other process of higher priority, it means we can preempt the control of CPU from one process to another if required. Scheduling Criteria CPU utilization. We want to keep the CPU as busy as possible. Conceptually, CPU utilization can range from 0 to 100 percent. In a real system, it range from 40 percent (for a lightly loaded system) to 90 percent (for a heavily loaded system). Throughput. If the CPU is busy executing processes, then work is being done. One measure of work is the number of processes that are completed per time unit, called throughput. 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. Waiting time is the sum of the periods spent waiting in the ready queue. Response time. Response time, is the time it takes to start responding, not the time it takes to output the response. Scheduling Algorithms First-Come, First Serve (FCFS) Shortest Job First (SJF) Priority Scheduling Round Robin (RR) Multi-level Queue Multi-level Feedback Queue
  • 2. First-Come, First-Served Scheduling Its implementation is based on FIFO queue. Process arrives first always execute first. FCFS is non-preemptive scheduling algorithm so processes priority does not matter. FCFS is pre-emptive scheduling algorithm.  If process first arrived is a big process with a high burst time, then other process with less burst time need to wait. Average wait time is high. Easy to implement. Easy to understand. Consider the following set of processes that arrive at time 0, with the length of the CPU burst given in milliseconds: If the processes arrive in the order P1, P2, P3, and are served in FCFS order, we get the result shown in the following Gantt chart, which is a bar chart that illustrates a particular schedule, including the start and finish times of each of the participating processes: The waiting time is 0 milliseconds for process P1, 24 milliseconds for process P2, and 27 milliseconds for process P3. Thus, the average waiting time is (0 + 24 + 27)/3 = 17 milliseconds. If the processes arrive in the order P2, P3, P1, however, the results will be as shown in the following Gantt chart: The average waiting time is now (6 + 0 + 3)/3 = 3 milliseconds. This reduction is substantial. Thus, the average waiting time under an FCFS policy is generally not minimal and may vary substantially if the processes’ CPU burst times vary greatly.