1 Course Matters. NUS.SOC.CS5248 OOI WEI TSANG 2 Paper Review October 2003 MonTueWedThuFriSatSun 171819 20212223242526 Paper Reviews Due 20% off for each.

Post on 29-Jan-2016

213 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

1

Course Matters

NUS.SOC.CS5248OOI WEI TSANG

2

Paper Review

October 2003

Mon Tue Wed Thu Fri Sat Sun

17 18 19

20 21 22 23 24 25 26

Paper Reviews Due20% off for each late day

NUS.SOC.CS5248OOI WEI TSANG

3

Diwali/Deepavali

October 2003

Mon Tue Wed Thu Fri Sat Sun

17 18 19

20 21 22 23 24 25 26

No Class

NUS.SOC.CS5248OOI WEI TSANG

4

Guest Lecture

October 2003

Mon Tue Wed Thu Fri Sat Sun

17 18 19

20 21 22 23 24 25 26

CS6212 Guest Lecture“A/V Synchronization”SR1 4-6pm

NUS.SOC.CS5248OOI WEI TSANG

5

Books

NUS.SOC.CS5248OOI WEI TSANG

6

Project Grading

Proposal5%

Paper20%

Poster20%

Contribution20%

Methodology 35%

7

Previously, on CS5248

NUS.SOC.CS5248OOI WEI TSANG

8

Cello

OS disk schedulerSupport multiple classesProtect classes from each otherWork conservingUse two-level scheduling

NUS.SOC.CS5248OOI WEI TSANG

9

CPU vs Disk SchedulingTask computation time

unpredictable

Task can be preemptive

NUS.SOC.CS5248OOI WEI TSANG

10

Problem

How can multimedia applications co-exists with normal applications?

NUS.SOC.CS5248OOI WEI TSANG

11

Same Old Idea

NUS.SOC.CS5248OOI WEI TSANG

12

Same Gang

P. Goyal, X. Guo, and H. M. Vin.

“A hierarchical CPU scheduler formultimedia operating systems.”

OSDI’96

NUS.SOC.CS5248OOI WEI TSANG

13

So Far

Best-Effort Real-Time

Scheduling

NUS.SOC.CS5248OOI WEI TSANG

14

How to Guarantee Services?

15

Resource Reservation: CPU

NUS.SOC.CS5248OOI WEI TSANG

16

Resource Reservations

How to reserve?Overbook?Overuse?

NUS.SOC.CS5248OOI WEI TSANG

17

Example: Memory

How to reserve?malloc

Overbook? return NULL

Overuse? crash, throw exception

NUS.SOC.CS5248OOI WEI TSANG

18

Example: Memory

How to reserve?“I will need 128KB”

Overbook? “Sorry!”

Overuse? malloc returns NULL

NUS.SOC.CS5248OOI WEI TSANG

19

Example: CPU

How to reserve?Overbook?Overuse?

Memory is discrete. CPU time is continuous.

20

How to Reserve?

NUS.SOC.CS5248OOI WEI TSANG

21

CPU Reservation

“I need C units of time, out of every T units.”

NUS.SOC.CS5248OOI WEI TSANG

22

Two Problems

How to determine C?take measurement and estimate

What if C is not constant?take the maximum

NUS.SOC.CS5248OOI WEI TSANG

23

Effects of T and C

0%10%20%30%40%50%60%70%80%90%

100%

0 10 20 30 40 50 60Reservation Period (ms)

% F

ram

es

Re

ndere

d

20% 15% 10%

24

CPU Scheduling Algorithm

25

Classic Real-Time Scheduler

NUS.SOC.CS5248OOI WEI TSANG

26

Rate Scheduling AlgorithmsRate MonotonicEarliest Deadline First

NUS.SOC.CS5248OOI WEI TSANG

27

Rate Monotonic

NUS.SOC.CS5248OOI WEI TSANG

28

EDF

NUS.SOC.CS5248OOI WEI TSANG

29

Classic Schedulability TheoremsRate Monotonic Scheduler

Earliest Deadline First2ln

i

i

T

C

2lni

i

T

C

1i

i

T

C

NUS.SOC.CS5248OOI WEI TSANG

30

Assumptions

programs are periodiccomputation time is constantzero context switch timeprograms are independent

NUS.SOC.CS5248OOI WEI TSANG

31

Why do we care about RM?Theoretically, RM has lower CPU

utilization (70%) butRM is more efficient than EDFCan support up to 80-90% CPU

utilization in practiceDon’t want to commit 100% CPU

anyway (for emergency)

32

Rialto Scheduler

From MS Research

NUS.SOC.CS5248OOI WEI TSANG

33

Overview

Given a set of task, pre-compute a scheduling graph

NUS.SOC.CS5248OOI WEI TSANG

34

Task A B C D E F

Amount 4 3 2 1 1 5

Period 20 10 40 20 10 40

EB CA

EB FD

EB A

EB D

NUS.SOC.CS5248OOI WEI TSANG

35

Task A B C D E F

Amount 4 3 2 1 1 5

Period 20 10 40 20 10 40

C

F

A

D

EB

NUS.SOC.CS5248OOI WEI TSANG

36

Advantages

Only need to make new scheduling decisions when new task is added

NUS.SOC.CS5248OOI WEI TSANG

37

Computing Scheduling GraphInput: A set of tasks with their

reservationsOutput: A scheduling graph if

feasible

NUS.SOC.CS5248OOI WEI TSANG

38

Many Possible Solutions

C

F

A

D

EBF

C

A

D

EB

NUS.SOC.CS5248OOI WEI TSANG

39

Task A B C D E F

Amount 4 3 2 1 1 5

Period 20 10 40 20 10 40

C

F

F

A

D

EB

NUS.SOC.CS5248OOI WEI TSANG

40

Computing Scheduling GraphInput: A set of tasks with their

reservationsOutput: A scheduling graph if

feasibleGoals: (a) Minimize context

switches (b) Distribute free time evenly

NUS.SOC.CS5248OOI WEI TSANG

41

Life is Tough..

NP-Hard

NUS.SOC.CS5248OOI WEI TSANG

42

Heuristic

10

10

10

10

10

10

10

NUS.SOC.CS5248OOI WEI TSANG

43

10

5

10

10

5

10

5

F

Task A B C D E F

Amount 4 3 2 1 1 5

Period 20 10 40 20 10 40

NUS.SOC.CS5248OOI WEI TSANG

44

6

1

6

6

1

6

1

F

B+E

Task A B C D E F

Amount 4 3 2 1 1 5

Period 20 10 40 20 10 40

NUS.SOC.CS5248OOI WEI TSANG

45

4

1

1

1

1

1

1

F

B+E

A+D

C

Task A B C D E F

Amount 4 3 2 1 1 5

Period 20 10 40 20 10 40

NUS.SOC.CS5248OOI WEI TSANG

46

Task A B C D E F

Amount 4 3 2 1 1 5

Period 20 10 40 20 10 40

EB C

EB DA

EB F

EB A D

47

Time Constraints

NUS.SOC.CS5248OOI WEI TSANG

48

Time Constraint

“I need to run the following code, that takes 30ms, 100ms from now, and the deadline is (now+180ms).”

NUS.SOC.CS5248OOI WEI TSANG

49

Pseudocode

can = begin_constraint(start_time, deadline, estimate)

if can schedule thendo work

elseadapt

time_taken = end_constraint()

NUS.SOC.CS5248OOI WEI TSANG

50

Scheduling Constraints

C

F

F

A

D

EB

NUS.SOC.CS5248OOI WEI TSANG

51

Scheduling Constraints

C

F

F

A

D

EB

C1, C2, C5

NUS.SOC.CS5248OOI WEI TSANG

52

Advantages of Scheduling GraphOnly need to make new

scheduling decisions when new task is added

Feasibility of time constraint can be predicted accurately

53

Peaceful Coexistence

NUS.SOC.CS5248OOI WEI TSANG

54

Running Unreserved Task

C

F

F

A

D

EB

55

Media Player on Rialto/NT

NUS.SOC.CS5248OOI WEI TSANG

56

Look inside NT SchedulerScheduling unit : ThreadPriority level: 1-15, 16-31

rt 24 high 13 normal 8 idle 4

NUS.SOC.CS5248OOI WEI TSANG

57

Priority Boosting

Example:Priority +6 after awaken by

keyboard input

NUS.SOC.CS5248OOI WEI TSANG

58

Anti-Starvation

If hasn’t run for 3 secondsBoost priority to 14

Avoid “Priority Inversion”

NUS.SOC.CS5248OOI WEI TSANG

59

Mars Pathfinder

NUS.SOC.CS5248OOI WEI TSANG

60

Rialto/NT

NT Scheduler

RialtoC

F

F

A

D

EB

Boost Priorityto 30

NUS.SOC.CS5248OOI WEI TSANG

61

Win Media Player 6.4

Period Priority Thread

10 24 Kernel Mixer

45 8 GUI

100 15 Timer

100 9 MP3 Decoder

500 8 Unknown

2000 8 Disk Reader

NUS.SOC.CS5248OOI WEI TSANG

62

Experiment 1

WMP running alone

Period Priority Thread

10 24 Kernel Mixer

45 8 GUI

100 15 Timer

100 9 MP3 Decoder

500 8 Unknown

2000 8 Disk Reader

NUS.SOC.CS5248OOI WEI TSANG

63

Experiment 2

WMP running with priority 8 competitor

Period Priority Thread

10 24 Kernel Mixer

45 8 GUI

100 15 Timer

100 9 MP3 Decoder

500 8 Unknown

2000 8 Disk Reader

NUS.SOC.CS5248OOI WEI TSANG

64

Experiment 3

WMP running with priority 10 competitor

Period Priority Thread

10 24 Kernel Mixer

45 8 GUI

100 15 Timer

100 9 MP3 Decoder

500 8 Unknown

2000 8 Disk Reader

NUS.SOC.CS5248OOI WEI TSANG

65

Experiment 5

WMP running with priority 10 competitor

Period Priority Reservation Thread

10 24 Kernel Mixer

45 8 GUI

100 15 Timer

100 9 40/1024 MP3 Decoder

500 8 Unknown

2000 8 Disk Reader

NUS.SOC.CS5248OOI WEI TSANG

66

Experiment 6

WMP running with priority 10 competitor

Period Priority Reservation Thread

10 24 1/16 Kernel Mixer

45 8 GUI

100 15 Timer

100 9 40/1024 MP3 Decoder

500 8 Unknown

2000 8 Disk Reader

NUS.SOC.CS5248OOI WEI TSANG

67

Experiment 7

WMP running with priority 10 competitor

Period Priority Reservation Thread

10 24 Kernel Mixer

45 8 GUI

100 15 Timer

100 9 20/512 MP3 Decoder

500 8 Unknown

2000 8 Disk Reader

68

Summary

NUS.SOC.CS5248OOI WEI TSANG

69

CPU Scheduling

With guaranteepercentage of CPU timetask with deadline

AlgorithmsRate-monotonicEDFRialto

NUS.SOC.CS5248OOI WEI TSANG

70

CS5248 Summary

Network

Encoder

Sender

Middlebox

Receiver

Decoder

NUS.SOC.CS5248OOI WEI TSANG

71

Last Two Lectures

October/November 2003

Mon Tue Wed Thu Fri Sat Sun

17 18 19

20 21 22 23 24 25 26

27 28 29 30 31 1 2

3 4 5 6 7 8 9

NUS.SOC.CS5248OOI WEI TSANG

72

Last Two Lectures

Papers from recent conferences and journals.

top related