CPU Scheduling - PowerPoint PPT Presentation

About This Presentation
Title:

CPU Scheduling

Description:

Kernel Mixer. 24. 10. Thread. Priority. Period. NUS.SOC.CS5248. Ooi Wei Tsang. 48 ... Kernel Mixer. 24. 10. NUS.SOC.CS5248. Ooi Wei Tsang. 49. Experiment 2 ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 56
Provided by: dcso
Category:
Tags: cpu | mixer | scheduling

less

Transcript and Presenter's Notes

Title: CPU Scheduling


1
CPU Scheduling
2
Scheduling Task vs I/O Request
  • Task computation time unpredictable
  • Task can be preemptive

3
CPU Scheduling Algorithm
  • FCFS
  • Priority-based
  • Proportional fair-share
  • EDF
  • Rate monotonic

4
Rate Monotonic
5
EDF
6
Problem
  • How can multimedia applications co-exists with
    normal applications?

7
Same Idea as Cello
  • P. Goyal, X. Guo, and H. M. Vin.
  • A hierarchical CPU scheduler for
  • multimedia operating systems.
  • OSDI96

8
Guarantee?
  • So far Best-Effort Real-Time Scheduling
  • What about Guaranteed service?

9
How to Guarantee Services?
10
Resource Reservation CPU
11
Resource Reservations
  • How to reserve?
  • Overbook?
  • Overuse?

12
Example Memory
  • How to reserve?
  • malloc
  • Overbook?
  • return NULL
  • Overuse?
  • crash, throw exception

13
Example CPU
  • How to reserve?
  • Overbook?
  • Overuse?

Memory is discrete. CPU time is continuous.
14
How to Reserve?
15
CPU Reservation
  • I need C units of time ..
  • out of every T units.

16
Some Issues
  • I need C units of time, out of every T units.

17
Effects of T and C
18
Effects of T and C
19
Schedulability Theorems
  • Rate Monotonic Scheduler
  • Earliest Deadline First

20
Assumptions
  • programs are periodic
  • computation time is constant
  • zero context switch time
  • programs are independent

21
Rialto Scheduler
  • CPU Reservations and Time Contraints Efficient
    and Predictable Scheduling of Independent
    Activities,
  • M. Jones, D. Rosu and M. Rosu

22
Why Rialto?
  • Provide CPU reservation
  • Enable deadlines
  • Co-exists with best-effort apps

23
Overview
  • input a set of tasks and their reservation
  • pre-compute a scheduling graph
  • schedule tasks based on scheduling graph

24
E
B
C
A
E
B
F
D
E
B
A
E
B
D
25
C
A
E
B
F
D
26
Advantages
  • Only need to make new scheduling decisions when
    new task is added

27
Computing Scheduling Graph
  • Input A set of tasks with their reservations
  • Output A scheduling graph if feasible

28
Many Possible Solutions
C
A
A
E
B
E
B
F
F
D
D
C
29
C
A
F
E
B
F
D
30
Computing Scheduling Graph
  • Input A set of tasks with their reservations
  • Output A scheduling graph if feasible
  • Goals (a) Minimize context switches (b)
    Distribute free time evenly

31
Life is Tough..
NP-Hard
32
Heuristic
10
10
10
10
10
10
10
33
10
5
F
5
5
10
10
10
34
6
1
F
1
BE
1
6
6
6
35
C
4
1
F
1
BE
1
1
1
AD
1
36
Time Constraint
  • I need to run the following code, that takes
    30ms, 100ms from now, and the deadline is
    (now180ms).

37
Pseudocode
  • can begin_constraint(start_time, deadline,
    estimate)
  • if can schedule then
  • do work
  • else
  • adapt
  • time_taken end_constraint()

38
Scheduling Constraints
C
A
F
E
B
F
D
39
Advantages
  • Only need to make new scheduling decisions when
    new task is added
  • Feasibility of time constraint can be predicted
    accurately

40
Running Unreserved Task
C
A
F
E
B
F
D
41
Media Player on Rialto/NT
42
Look inside NT Scheduler
  • Scheduling unit Thread
  • Priority level 1-15, 16-31
  • rt 24 high 13 normal 8 idle 4

43
Priority Boosting
  • Example
  • Priority 6 after awaken by keyboard input

44
Anti-Starvation
  • If hasnt run for 3 seconds
  • Boost priority to 14
  • Avoid Priority Inversion

45
Mars Pathfinder
46
Rialto/NT
Rialto
Boost Priority to 30
NT Scheduler
47
Win Media Player 6.4
48
Experiment 1
  • WMP running alone

49
Experiment 2
  • WMP running with priority 8 competitor

50
Experiment 3
  • WMP running with priority 10 competitor

51
Experiment 5
  • WMP running with priority 10 competitor

52
Experiment 6
  • WMP running with priority 10 competitor

53
Experiment 7
  • WMP running with priority 10 competitor

54
Summary
55
CPU Scheduling
  • With guarantee
  • percentage of CPU time
  • task with deadline
  • Algorithms
  • Rate-monotonic
  • EDF
  • Rialto
Write a Comment
User Comments (0)
About PowerShow.com