Upload
alexis-claxon
View
247
Download
0
Tags:
Embed Size (px)
Citation preview
Internal seminar
Embedded System Lab.
2
contents
Lottery Scheduling Defined
Lottery scheduling
Implementation
Internal seminar
Embedded System Lab.
3
Lottery Scheduling Defined
“Lottery scheduling is a randomized resource allocation mechanism. Resource rights are represented by lottery tickets. Each allocation is determined by holding a lottery; the resource is granted to the client with the winning ticket.” [Waldspurger]
Internal seminar
Embedded System Lab.
4
Lottery scheduling
Resource rights Lottery Tickets encapsulate Resource Rights that
are abstract, relative, and uniform. Abstraction
Relativity
uniformity
Internal seminar
Embedded System Lab.
5
Lottery scheduling
Lotteries Scheduling by lottery is probabilistically fair.
How many wins?
Internal seminar
Embedded System Lab.
6
Lottery scheduling
Lotteries When to wins?
Starvation dose not exist.
Internal seminar
Embedded System Lab.
7
Modular resource management
Ticket? The explicit representation of resource rights.
Provides a convenient substrate for modular resource management.
각 모듈들의 자원 관리 정책을 독립적으로 유지 할 수 있음
Internal seminar
Embedded System Lab.
8
Modular resource management
Ticket transfers Ticket 을 양도하는 기법 Avoid Priority inversion problem => priority
inheritanceTicket :3 Ticket :10 Ticket :5
c a b
b a c
t
Internal seminar
Embedded System Lab.
9
Modular resource management
Ticket Inflation Provides alternative to transfers.
Escalating resource rights by creating more tickets.
In general, such inflation should be disallowed.
However, ticket inflation can be very useful among mutually trusting clients.
Internal seminar
Embedded System Lab.
10
Modular resource management
Ticket currencies Local abstraction barrier: Interpretation of
“value” of a ticket in different modules Base currency + exchange rate
Compensation tickets A client which consumes only a fraction f of its
allocated resource quantum can be granted a compensation ticket that inflates ins value by 1/f until the client starts its next quantum.
Internal seminar
Embedded System Lab.
11
Implementation
Implementation 25MHz MUPS-based DECStation 5000/125 Mach kernel 3.0 을 수정 Scheduling quantum : 100ms
Random number park-miller algorithm Executes in approximately 10 RISC instructions.
Internal seminar
Embedded System Lab.
12
Implementation
Lotteries Winning ticket 을 random 하게 선택 Ticket 을 찾는데 O(n) 시간 소비
Partial ticket 을 tree 로 관리 : O(lg n)
Internal seminar
Embedded System Lab.
13
Implementation
Mach kernel interface A minimal lottery scheduling interface is
exported by the microkernel. operation
Create, destroy ticket 과 currency 로 구성
Internal seminar
Embedded System Lab.
14
Implementation
Ticket currencies
Internal seminar
Embedded System Lab.
15
Implementation
Compensation Tickets This is consistent with proportional sharing, and
permits I/O-bound tasks that use few processor cycle to start quickly.
A B
Ticket : 400
Quantum :
100ms
A 는 100ms 를 모두 소비하고 B 는 20ms 만 사용 하고 양보
After 100msAfter 20ms
f=1/5Compensation tickets = 1600400/f = 2000
B = 2000 tickets
Internal seminar
Embedded System Lab.
16
Implementation Ticket Transfers
mach_msg system call 을 수정하여 구현 Synchronous RPCs 를 위해 client 로부터 server 에게 ti
cket 을 transfer 함
User interface User-level comands Create/destroy tickets and currencies
mktkt, rmtkt, mkcur, rmcur Fund/unfund a currency
fund, unfund Execute a shell command
fundx