Chapter 9: Processor Scheduling - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Chapter 9: Processor Scheduling

Description:

Chapter 9: Processor Scheduling. CS 472 Operating Systems ... FCFS example. 15. Round-robin. Preemptive version of FCFS. Time slicing is used with high overhead ... – PowerPoint PPT presentation

Number of Views:76
Avg rating:3.0/5.0
Slides: 32
Provided by: markt2
Category:

less

Transcript and Presenter's Notes

Title: Chapter 9: Processor Scheduling


1
Chapter 9 Processor Scheduling
  • CS 472 Operating Systems
  • Indiana University Purdue University Fort Wayne

2
Time frame for scheduling
  • Long-term scheduling
  • decide to admit a new process
  • often a processes is admitted in the suspended
    state
  • Medium-term scheduling
  • decide to suspend / resume
  • involves allocating memory to the admitted
    process
  • Short-term scheduling
  • choose process to dispatch

3
(No Transcript)
4
Dispatcher
  • This is the short-term scheduler
  • Invoked whenever appropriate
  • I/O request
  • clock interrupt
  • system service call
  • etc.
  • Attempts to meet established criteria

5
(No Transcript)
6
(No Transcript)
7
Use of priorities
  • Scheduler will always choose a process of higher
    priority over one of lower priority
  • Have multiple ready queues to represent each
    level of priority
  • Lower-priority processes may suffer starvation
  • To overcome starvation, allow a process to change
    its priority based on its age or execution
    history

8
(No Transcript)
9
Decision Mode
  • Nonpreemptive
  • Once a process is in the running state, it will
    continue until it terminates or blocks itself for
    I/O
  • Preemptive
  • The currently running process may be interrupted
    and moved to the Ready state by the operating
    system
  • Allows for better service since no one process
    may monopolize the processor for very long

10
Dispatcher policies
  • FCFS
  • Round-robin
  • SPN
  • SRT
  • HRRN
  • Feedback
  • Fair-share

11
Running example
12
FCFS
  • First Come First Served or FIFO
  • Ready queue ordered by waiting time
  • Batch oriented
  • Nonpreemptive
  • Poor turnaround time
  • Normalized turnaround time poor also
  • Ratio of turnaround time to service time

13
FCFS
  • A short process may have to wait a very long time
    before it can execute
  • Favors CPU-bound processes
  • A process waiting for I/O must wait until
    CPU-bound process completes
  • However, very low overhead

14
FCFS example
15
Round-robin
  • Preemptive version of FCFS
  • Time slicing is used with high overhead
  • A clock interrupt is generated periodically
  • Quantum time slice size
  • should slightly exceed the length of a typical
    user interaction
  • Time sharing / transaction processing oriented

16
  • Round-robin refinement
  • Processes in the auxiliary queue take priority
    over those in the main ready queue
  • In this case, the quantum is the basic quantum
    minus time used before I/O block

17
SPN
  • Shortest Process Next
  • Ready queue ordered by estimated service time
  • until next block (interactive environment)
  • until termination (batch environment)
  • Nonpreemptive
  • Improves average wait over FCFS
  • A long process may starve and short processes may
    have long waits due to no preemption
  • Difficult to estimate service time

18
SPN estimated service time
  • Batch environment service time
  • Estimated by programmer
  • Available from previous runs in a production
    environment
  • Interactive environment
  • OS may keep a running average of each burst for
    each process
  • Sn1 1/n ? nTi where Ti historical
    time
  • i1

19
SPN interactive environment
  • Exponential moving average estimate is good
  • Choose a such that 0 lt a lt 1
  • Then define
  • S0 0
  • Sn1 a Tn (1- a)Sn
  • a Tn (1- a) a Tn-1 (1- a)2 a Tn-2
  • This gives higher weight to more recent times

20
SPN example
21
SRT
  • Shortest Remaining Time
  • Preemptive version of SPN
  • When a job enters the Ready queue with a small
    Sn, it may preempt the current job
  • A long process may starve here
  • Good turnaround time for short jobs

22
HRRN
  • Highest Response Ratio Next
  • RR Response Ratio (w s) / s
  • w time waiting for processor
  • s expected service time
  • The Ready queue is ordered by RR values
  • Prevents starvation
  • Short jobs favored
  • Service time still needs to be estimated

23
HRRN example
24
Feedback
Q1
  • Involves
  • multiple
  • round-robin
  • queues

Q2
Q3
Qn
running
25
Feedback
  • Queues have decreasing priority
  • A process is demoted to the next lower queue
    based on cumulative execution time or each
    time-out
  • A process is promoted to a higher queue based on
    events like I/O request
  • Lower queues may get a larger time-slice
  • Short and I/O-bound jobs keep higher priority
  • Adapts to changing process behavior

26
Feedback example
27
Fair-share
  • Assign each user a fair share of processor time
  • A user may have many processes
  • Monitor usage and adjust priorities so each user
    gets a fair share

28
(No Transcript)
29
(No Transcript)
30
(No Transcript)
31
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com