SlideShare une entreprise Scribd logo
1  sur  25
Understand Process Management
• Process Scheduling Algorithms




                                               1
HOME     PREVIOUS TOPIC
NEXT
PREVIOUS QUESTION PAPERS
FOR OS
CPP TUTORIALS




                           2
Recap

In the last class, you have learnt

Shortest Job First scheduling algorithm and its

  -Advantages

  -Disadvantages




                                                  3
Objectives

On completion of this class, you would be able to know
• Priority Scheduling

• Round Robin Scheduling




                                                     4
Priority Scheduling

• Priority scheduling algorithm is special case of SJF

• A priority is associated with each process

• Priorities are indicated by fixed range of numbers

• In this scheduling CPU is allocated to the process with
  the highest priority
• Equal priority process scheduled in FCFS order


                                                         5
Priority Scheduling
• Consider the following set of processes assumed to have
  arrived at time 0,
   – in order P1,P2,P3-----P5
   – with the length of the CPU burst time given in milliseconds
   – and their associated priorities

               Process     Burst time Priorities
                 P1           10          3
                 P2            1          1
                 P3            2          4
                 P4            1          5
                 P5            5          2
                                                               6
Priority Scheduling

• Using Priority Scheduling we should schedule these
  processes according to the following Gantt chart

       P2   P5           P1                  P3        P4
   0        1        6                  16        18    19

• The average waiting time is 8.2 milliseconds
  i.e. (0+1+6+16+18)/5 = 8.2 milliseconds
  Priority can be defined internally or externally


                                                             7
Priority Scheduling

• Internally defined priorities use some measurable
  quantity or quantities to compute the priority of a
  process i.e.
   – Time limits

   – Memory requirements

   – Open files

   – The ratio of average I/O burst to average CPU burst

• Externally priorities are set by criteria process type,
  work, department sponsoring                               8
Priority Scheduling

• Priority scheduling can be either be Preemptive or Non
  Preemptive
• When a process arrives at the ready queue, its priority is
  compared with the priority of currently running process
• Preempt the CPU if the priority of the newly arrived
  process is higher than the priority of the currently
  running processes

                                                         10
Priority Scheduling

• If the priority scheduling algorithm is Non –
  Preemptive put the new process at the head of the
  ready queue
• A major problem with this is indefinite blocking

• A solution to this problem is Aging

• Aging is a technique which gradually increases the
  priority of processes that wait in the system for a
  long time                                             11
Round-Robin Scheduling Algorithm
• The round robin scheduling algorithm is designed

 especially for Time Sharing Systems
• It is similar to FCFS scheduling, but Preemption is added
 to switch between processes
• A small unit of time called Time quantum or time slice is
 defined
• A time quantum is generally from 10 to 100 mille seconds
• The CPU scheduler allocates the CPU to each process for
  a time interval of up to 1 time quantum
                                                      12
Round-Robin Scheduling Algorithm
• The average waiting time under Round Robin policy
  is often long
• Consider the following set of processes that arrive at
  time 0, with the
   – length of the CPU burst time given in milliseconds:
          Process                 Burst Time
            P1                     24
            P2                      3
            P3                      3


                                                           13
Round-Robin Scheduling Algorithm

• Use a time quantum of 4milliseconds
• Process P1 gets the first 4msec it is Preempted after the
  first time quantum
• P2 & P3 does not require 4msec they quit before their time
  quantum




                                                        14
Round-Robin Scheduling Algorithm

• The CPU is returned to process P1
• The average waiting time 17 / 3= 5.66milliseconds
• The average turn around time for 3 processes of time
  quantum 10 is 29




                                                         15
Round-Robin Scheduling Algorithm


• Round Robin scheduling is Preemptive
• If CPU burst time of process, is larger than the
  process time quantum then CPU is Preempted
  from the process
• No process is allocated CPU for more than 1 time
  quantum
Round-Robin Scheduling Algorithm


• Performance of RR scheduling depends on the
  size of time quantum
• If time quantum is extremely very large RR
  approach is same as FCFs
• If it is extremely small, RR approach is called
  processor sharing
                                                    18
Summary

In this class, you have learnt
• Priority Scheduling Algorithm

• Round Robin Scheduling




                                  19
Frequently Asked Questions

1. Explain Round Robin Scheduling

2. Explain Priority Scheduling

3. What are the Internal & External priorities




                                                 20
Quiz
1. In __________ scheduling CPU allocated to the
   process with the highest priority
a) FCFS
b) SJF
c) RR
d) Priority




                                               21
Quiz

2. Priority scheduling can be __________
a) Preemptive
b) Non Preemptive
c) Both
d) None




                                           22
Other subject materials
•   Web designing
•   Micro processors
•   C++ tutorials
•   java

home
Quiz

3. RR scheduling is designed for _______ systems
a)   Time sharing
b)   Real time
c)   Distributed
d)   None




                                                   24
Quiz

4. If the time quantum is extremely large than RR is
   same as
a) SJF
b) FCFS
c) Priority
d) None




                                                   25

Contenu connexe

Tendances (17)

RR and priority scheduling
RR and priority schedulingRR and priority scheduling
RR and priority scheduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
OPERATING SYSTEM-"Scheduling policies"
OPERATING SYSTEM-"Scheduling policies"OPERATING SYSTEM-"Scheduling policies"
OPERATING SYSTEM-"Scheduling policies"
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
 
Os prj ppt
Os prj pptOs prj ppt
Os prj ppt
 
OSCh6
OSCh6OSCh6
OSCh6
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Planificacion
PlanificacionPlanificacion
Planificacion
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
9 cm402.19
9 cm402.199 cm402.19
9 cm402.19
 
Scheduling
SchedulingScheduling
Scheduling
 
Lecture 4 process cpu scheduling
Lecture 4   process cpu schedulingLecture 4   process cpu scheduling
Lecture 4 process cpu scheduling
 
Os..
Os..Os..
Os..
 
cpu scheduling
cpu schedulingcpu scheduling
cpu scheduling
 
Process and CPU scheduler
Process and CPU schedulerProcess and CPU scheduler
Process and CPU scheduler
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
 

Similaire à 20

Round-ribon algorithm presntation
Round-ribon algorithm presntationRound-ribon algorithm presntation
Round-ribon algorithm presntationJamsheed Ali
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-schedulingNazir Ahmed
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptxSHUJEHASSAN
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .pptSaba651353
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdfKp Sharma
 
ch5_CPU Scheduling_part1.pdf
ch5_CPU Scheduling_part1.pdfch5_CPU Scheduling_part1.pdf
ch5_CPU Scheduling_part1.pdfSonaliAjankar
 
21 process scheduling alogorithm
21 process scheduling alogorithm21 process scheduling alogorithm
21 process scheduling alogorithmmyrajendra
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxansariparveen06
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdfAliyanAbbas1
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithmsPaurav Shah
 
3 process scheduling
3 process scheduling3 process scheduling
3 process schedulingahad alam
 
dataprocess using different technology.ppt
dataprocess using different technology.pptdataprocess using different technology.ppt
dataprocess using different technology.pptssuserf6eb9b
 

Similaire à 20 (20)

CPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdfCPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdf
 
Round-ribon algorithm presntation
Round-ribon algorithm presntationRound-ribon algorithm presntation
Round-ribon algorithm presntation
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptx
 
Ch6 cpu scheduling
Ch6   cpu schedulingCh6   cpu scheduling
Ch6 cpu scheduling
 
Os2
Os2Os2
Os2
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .ppt
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
 
9 cm402.18
9 cm402.189 cm402.18
9 cm402.18
 
ch5_CPU Scheduling_part1.pdf
ch5_CPU Scheduling_part1.pdfch5_CPU Scheduling_part1.pdf
ch5_CPU Scheduling_part1.pdf
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
 
Presentation by adeel
Presentation by adeelPresentation by adeel
Presentation by adeel
 
21 process scheduling alogorithm
21 process scheduling alogorithm21 process scheduling alogorithm
21 process scheduling alogorithm
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
3 process scheduling
3 process scheduling3 process scheduling
3 process scheduling
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
dataprocess using different technology.ppt
dataprocess using different technology.pptdataprocess using different technology.ppt
dataprocess using different technology.ppt
 

Plus de myrajendra (20)

Fundamentals
FundamentalsFundamentals
Fundamentals
 
Data type
Data typeData type
Data type
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Jdbc workflow
Jdbc workflowJdbc workflow
Jdbc workflow
 
2 jdbc drivers
2 jdbc drivers2 jdbc drivers
2 jdbc drivers
 
3 jdbc api
3 jdbc api3 jdbc api
3 jdbc api
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Dao example
Dao exampleDao example
Dao example
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
Internal
InternalInternal
Internal
 
3. elements
3. elements3. elements
3. elements
 
2. attributes
2. attributes2. attributes
2. attributes
 
1 introduction to html
1 introduction to html1 introduction to html
1 introduction to html
 
Headings
HeadingsHeadings
Headings
 
Forms
FormsForms
Forms
 
Css
CssCss
Css
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Starting jdbc
Starting jdbcStarting jdbc
Starting jdbc
 

20

  • 1. Understand Process Management • Process Scheduling Algorithms 1
  • 2. HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS 2
  • 3. Recap In the last class, you have learnt Shortest Job First scheduling algorithm and its -Advantages -Disadvantages 3
  • 4. Objectives On completion of this class, you would be able to know • Priority Scheduling • Round Robin Scheduling 4
  • 5. Priority Scheduling • Priority scheduling algorithm is special case of SJF • A priority is associated with each process • Priorities are indicated by fixed range of numbers • In this scheduling CPU is allocated to the process with the highest priority • Equal priority process scheduled in FCFS order 5
  • 6. Priority Scheduling • Consider the following set of processes assumed to have arrived at time 0, – in order P1,P2,P3-----P5 – with the length of the CPU burst time given in milliseconds – and their associated priorities Process Burst time Priorities P1 10 3 P2 1 1 P3 2 4 P4 1 5 P5 5 2 6
  • 7. Priority Scheduling • Using Priority Scheduling we should schedule these processes according to the following Gantt chart P2 P5 P1 P3 P4 0 1 6 16 18 19 • The average waiting time is 8.2 milliseconds i.e. (0+1+6+16+18)/5 = 8.2 milliseconds Priority can be defined internally or externally 7
  • 8. Priority Scheduling • Internally defined priorities use some measurable quantity or quantities to compute the priority of a process i.e. – Time limits – Memory requirements – Open files – The ratio of average I/O burst to average CPU burst • Externally priorities are set by criteria process type, work, department sponsoring 8
  • 9.
  • 10. Priority Scheduling • Priority scheduling can be either be Preemptive or Non Preemptive • When a process arrives at the ready queue, its priority is compared with the priority of currently running process • Preempt the CPU if the priority of the newly arrived process is higher than the priority of the currently running processes 10
  • 11. Priority Scheduling • If the priority scheduling algorithm is Non – Preemptive put the new process at the head of the ready queue • A major problem with this is indefinite blocking • A solution to this problem is Aging • Aging is a technique which gradually increases the priority of processes that wait in the system for a long time 11
  • 12. Round-Robin Scheduling Algorithm • The round robin scheduling algorithm is designed especially for Time Sharing Systems • It is similar to FCFS scheduling, but Preemption is added to switch between processes • A small unit of time called Time quantum or time slice is defined • A time quantum is generally from 10 to 100 mille seconds • The CPU scheduler allocates the CPU to each process for a time interval of up to 1 time quantum 12
  • 13. Round-Robin Scheduling Algorithm • The average waiting time under Round Robin policy is often long • Consider the following set of processes that arrive at time 0, with the – length of the CPU burst time given in milliseconds: Process Burst Time P1 24 P2 3 P3 3 13
  • 14. Round-Robin Scheduling Algorithm • Use a time quantum of 4milliseconds • Process P1 gets the first 4msec it is Preempted after the first time quantum • P2 & P3 does not require 4msec they quit before their time quantum 14
  • 15. Round-Robin Scheduling Algorithm • The CPU is returned to process P1 • The average waiting time 17 / 3= 5.66milliseconds • The average turn around time for 3 processes of time quantum 10 is 29 15
  • 16.
  • 17. Round-Robin Scheduling Algorithm • Round Robin scheduling is Preemptive • If CPU burst time of process, is larger than the process time quantum then CPU is Preempted from the process • No process is allocated CPU for more than 1 time quantum
  • 18. Round-Robin Scheduling Algorithm • Performance of RR scheduling depends on the size of time quantum • If time quantum is extremely very large RR approach is same as FCFs • If it is extremely small, RR approach is called processor sharing 18
  • 19. Summary In this class, you have learnt • Priority Scheduling Algorithm • Round Robin Scheduling 19
  • 20. Frequently Asked Questions 1. Explain Round Robin Scheduling 2. Explain Priority Scheduling 3. What are the Internal & External priorities 20
  • 21. Quiz 1. In __________ scheduling CPU allocated to the process with the highest priority a) FCFS b) SJF c) RR d) Priority 21
  • 22. Quiz 2. Priority scheduling can be __________ a) Preemptive b) Non Preemptive c) Both d) None 22
  • 23. Other subject materials • Web designing • Micro processors • C++ tutorials • java home
  • 24. Quiz 3. RR scheduling is designed for _______ systems a) Time sharing b) Real time c) Distributed d) None 24
  • 25. Quiz 4. If the time quantum is extremely large than RR is same as a) SJF b) FCFS c) Priority d) None 25