Você está na página 1de 22

Cache Related Preemption Delay for Set-Associative Caches

Resilience Analysis

` Sebastian Altmeyer, Claire Burguiere, Jan Reineke

Predator Meeting, Pisa 2010

saarland
university
computer science

Context

saarland
university
computer science

Preemptive scheduling Cache related preemption delay (CRPD):


Impact of preemption on the cache content Overall cost of additional reloads due to preemption

T1 T2
= CRPD = Task Activation

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

2 / 16

CRPD for set-associative caches - LRU

saarland
university
computer science

CRPD computation:
preempted task: Useful Cache Blocks (UCB) preempting task: Evicting Cache Blocks (ECB)

CRPD from UCB and ECB:


Previous combination overestimates Some UCBs remain useful under preemption

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

3 / 16

Useful Cache Block - [Lee et al., 1996]


Denition (Useful Cache Block)

saarland
university
computer science

A memory block m at program point P is called a useful cache block, if a) m may be cached at P b) m may be reused at program point P that may be reached from P with no eviction of m on this path.
= hit = miss

P
A B D C Cache Content: [A, B , C , D ] B A C

CRPDUCB CRPDs UCB

=
s =1

CRPDs UCB
n = associativity BRT = Block Reload Time
Predator, Pisa 2010 4 / 16

= BRT min(|UCB(s)|, n)
CRPD for set-associative caches

` Altmeyer, Burguiere, Reineke

Useful Cache Block - [Lee et al., 1996]


Denition (Useful Cache Block)

saarland
university
computer science

A memory block m at program point P is called a useful cache block, if a) m may be cached at P b) m may be reused at program point P that may be reached from P with no eviction of m on this path.
= hit = miss

P
A B D C Cache Content: [A, B , C , D ] B A C

CRPDUCB CRPDs UCB

=
s =1

CRPDs UCB
n = associativity BRT = Block Reload Time
Predator, Pisa 2010 4 / 16

= BRT min(|UCB(s)|, n)
CRPD for set-associative caches

` Altmeyer, Burguiere, Reineke

Evicting Cache Blocks [Tomiyama & Dutt, 2000]


Denition (Evicting Cache Blocks (ECB))

saarland
university
computer science

A memory block of the preempting task is called an evicting cache block, if it may be accessed during the execution of the preempting task.
Cache Content: [A, B , C , D ] X Y Z Cache Content: [X , Y , Z , D ]

= additional miss due to preemption (CRPD)

CRPDs ECB =
` Altmeyer, Burguiere, Reineke

0 if ECB(s) = BRT n otherwise


Predator, Pisa 2010 5 / 16

CRPD for set-associative caches

Impact of the preempting task on the preempted task

saarland
university
computer science

CRPD (using UCB and ECB)


c s min(CRPDs UCB , CRPDECB ) s =1

CRPDUCB&ECB =

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

6 / 16

Impact of the preempting task on the preempted task (example)


a b c

saarland
university
computer science

0x0a 0x0b 0x0c

[c , b, a, x ] ECBs = {e} [e, c , b, a]

[a, c , b, x ]

[b , a , c , x ]

[c , b , a , x ]

no miss

[a , e , c , b ]

[b , a , e , c ]

[c , b, a, e]

no miss

CRPDUCB |UCB| = 3 CRPDECB n = 4 CRPDUCB&ECB = min(CRPDUCB , CRPDECB ) 3


Overestimation: number of additional misses= 0 < 3

Why?
|ECB| to evict a UCB = 2 but, |ECB| = 1 One single ECB is not sufcient to evict a UCB
` Altmeyer, Burguiere, Reineke CRPD for set-associative caches Predator, Pisa 2010 7 / 16

Renement

saarland
university
computer science

Determining max |ECB| s.t. no additional cache miss occur m a1 a2 a3 m

m UCB m is 4-resilient (res(m) = 4)

[m , , , , , , , ]

[a3 , a2 , a1 , m, , , , ] [m, a3 , a2 , a1 , , , , ]

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

8 / 16

Resilience analysis
Denition (Resilience)

saarland
university
computer science

The resilience resP (m) of memory block m at program point P is the greatest l, such that all possible next accesses to m, a) that would be hits without preemption, b) would still be hits in case of a preemption with l accesses at P.
preempted task m a1 a2 preempting task

[m , , , , , , , ] ECB = {e1 , e2 , e3 , e4 }

m UCB res(m) = 4

a3 [a3 , e4 , e3 , e2 , e1 , a2 , a1 , m] m [m, a3 , e4 , e3 , e2 , e1 , a2 , a1 ]

if |ECB| l then the UCB is not evicted


` Altmeyer, Burguiere, Reineke CRPD for set-associative caches Predator, Pisa 2010 9 / 16

CRPD using resilience

saarland
university
computer science

CRPD (combining UCB and ECB by using resilience)

blocks contributing to CRPD

CRPD

BRT

| UCB \ {m | res(m) = |ECB |} |


useful remain useful

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

10 / 16

CRPD using resilience - example

saarland
university
computer science

0x0a 0x0b 0x0c

[c , b, a, x ] ECBs = {e} [e, c , b, a]

[a, c , b, x ]

[b , a , c , x ]

[c , b , a , x ]

no miss

[a , e , c , b ]

[b , a , e , c ]

[c , b, a, e]

no miss

|ECB | = 1 res(a) = res(b) = res(c ) = 1 res CRPDUCB&ECB = BRT |UCB \ {m | res(m) = |ECB | }| = 0

Instead of: CRPDUCB&ECB = min(CRPDUCB , CRPDECB ) = 3 BRT

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

11 / 16

Evaluation Setting

saarland
university
computer science

Cachesize 8KB 8 ways 32 sets linesize 32 bytes LRU caches Testcases: Malardalen benchmark suite:

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

12 / 16

Evaluation Benchmarks
Task minmax insertsort bcall fac bs bsort100 ns matmult r crc select qsort-exam sqrt qurt
` Altmeyer, Burguiere, Reineke

saarland
university
computer science

Code Size 608B 384B 256B 256B 320B 544B 576B 864B 928B 1216B 1280B 1440B 3680B 4160B

Cache Util. 7.4% 4.7% 3.1% 3.1% 3.9% 6.6% 7% 10.5% 11.3% 14.8% 15.6% 17.6% 44.9% 50.8%

|UCB| 4 5 5 6 8 10 11 12 22 35 37 42 101 118


Predator, Pisa 2010 13 / 16

CRPD for set-associative caches

Evaluation
preempted by fibcall (#ECBs= 8) 100

saarland
university
computer science

10

min

in f max sertso ac rt

bs

bso

n rt10 s 0

mat

f mult ir

crc

sele

ct

qso

rt-e

sqrt xam

preempted by qurt (#ECBs= 121) 100

10

min

in f max sertso ac rt

bs

bso
tan

n rt10 s 0

mat

f mult ir

crc

sele

ct

qso

rt-e

sqrt xam

resilience

UCB & ECB

#UCBs

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

14 / 16

Conclusions

saarland
university
computer science

UCB and ECB analyses:


pessimistic overapproximation of the CRPD

Resilience analysis:
regain some precision reduce pessimism

Resilience analysis:
simple data-ow analyses similar to UCB analysis for LRU

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

15 / 16

Further reading

saarland
university
computer science

` Altmeyer, S. & Burguiere, C. (2009). In Proceedings of the 21st Euromicro Conference on Real-Time Systems (ECRTS 09) pp. 109118, IEEE Computer Society. Lee, C.-G., Hahn, J., Min, S. L., Ha, R., Hong, S., Park, C. Y., Lee, M. & Kim, C. S. (1996). In RTSS96 p. 264, IEEE Computer Society. Negi, H. S., Mitra, T. & Roychoudhury, A. (2003). In CODES+ISSS03 ACM. Reineke, J. (2008). Caches in WCET Analysis. des Saarlandes, Saarbrucken. PhD thesis, Universitat Staschulat, J. & Ernst, R. (2007). ACM Trans. on Embedded Computing Sys. 6, 25. Tan, Y. & Mooney, V. (2004). In SCOPES04 pp. 182199,. Tomiyama, H. & Dutt, N. D. (2000). In CODES00 ACM.

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

16 / 16

l -resilience analysis
0-resilient 0-resilient m is not useful 2-resilient

saarland
university
computer science

m 2-resilient

m 2-resilient
Predator, Pisa 2010

m m

m (b)

(a)

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

16 / 16

CPRD using ECB: Pitfall

saarland
university
computer science

0x08 0x09 0x0a 0x0b

[b, a, 9, 8] ECBs = {e} [e, b, a, 9]

[8, b, a, 9]

[9, 8, b, a]

[a, 9, 8, b]

[b, a, 9, 8]

0 misses

[8, e, b, a]

[9, 8, e, b]

[a, 9, 8, e]

[b, a, 9, 8]

4 misses

|UCB(s)| = 4 |ECB(s)| = 1 n=4 number of additional misses= 4

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

16 / 16

university Upper-bound on the CRPD - direct-mapped caches

saarland

computer science

using UCB [Lee et al., 1996]: CRPDUCB = BRT |{si | m UCB : m mod c = si }|

using ECB [Tomiyama & Dutt, 2000]: CRPDECB = BRT |{si | m ECB : m mod c = si }|

using UCB and ECB [Negi et al., 2003, Tan & Mooney, 2004]: CRPDUCB&ECB = BRT |{si | m UCB : m mod c = si m ECB : m mod c = si }|

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

16 / 16

CRPD for FIFO: Pitfalls

saarland
university
computer science

ECBs = {x}

[b, a] [x, b]

a a

[b , a ] [a, x]

e e

[e , b ] [e, a]

b b

[e, b] [b, e]

c c

[c , e] [c , b ]

e e

[c , e ] [e , c ]

2 misses 5 misses

|UCB(s)| = 2 |ECB(s)| = 1 n=2 But: number of additional misses= 3

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

16 / 16

CRPD for PLRU: Pitfalls

saarland
university
computer science

1 1 a ECBs = {x, y} 0 a y c b 1 0 x c 1 d

d 1 a d* 0 a y b

0 0 c 0 1 d x d

b 0 a b* 1 b y b

1 0 c 1 1 d x d

c 0 a c* 1 b y b

0 1 c 0 0 d c d

b 0 a b 1 b y b

1 1 c 1 0 d c d

a 1 a a* 1 b y b

1 1 c 0 1 a c d

d 1 a d* 0 b d b

0 0 c 1 1 a c 5 misses d 0 misses

|UCB(s)| = 4 |ECB(s)| = 2 n=4 But: number of additional misses= 5

` Altmeyer, Burguiere, Reineke

CRPD for set-associative caches

Predator, Pisa 2010

16 / 16

Você também pode gostar