16
Embedded System Lab. 1 Embedded system Lab. 박박박 Email : [email protected]

Embedded System Lab. 1 Embedded system Lab. Email : [email protected]

Embed Size (px)

Citation preview

Page 1: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

Embedded System Lab.

1

Embedded system Lab.박희권

Email : [email protected]

Page 2: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

Internal seminar

Embedded System Lab.

2

contents

Lottery Scheduling Defined

Lottery scheduling

Implementation

Page 3: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

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]

Page 4: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

Internal seminar

Embedded System Lab.

4

Lottery scheduling

Resource rights Lottery Tickets encapsulate Resource Rights that

are abstract, relative, and uniform. Abstraction

Relativity

uniformity

Page 5: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

Internal seminar

Embedded System Lab.

5

Lottery scheduling

Lotteries Scheduling by lottery is probabilistically fair.

How many wins?

Page 6: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

Internal seminar

Embedded System Lab.

6

Lottery scheduling

Lotteries When to wins?

Starvation dose not exist.

Page 7: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

Internal seminar

Embedded System Lab.

7

Modular resource management

Ticket? The explicit representation of resource rights.

Provides a convenient substrate for modular resource management.

각 모듈들의 자원 관리 정책을 독립적으로 유지 할 수 있음

Page 8: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

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

Page 9: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

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.

Page 10: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

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.

Page 11: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

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.

Page 12: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

Internal seminar

Embedded System Lab.

12

Implementation

Lotteries Winning ticket 을 random 하게 선택 Ticket 을 찾는데 O(n) 시간 소비

Partial ticket 을 tree 로 관리 : O(lg n)

Page 13: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

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 로 구성

Page 14: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

Internal seminar

Embedded System Lab.

14

Implementation

Ticket currencies

Page 15: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

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

Page 16: Embedded System Lab. 1 Embedded system Lab. Email : phk0210@hotmail.com

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