An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs....

18
An Efficient Software Transactional Memory Using Commit - Time Invalidation CGO Justin E. Gottschlich, Manish Vachharajani, and Jeremy G. Siek University of Colorado-Boulder Gottschlich, Vachharajani, and Siek 1

Transcript of An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs....

Page 1: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

An Efficient Software Transactional Memory Using Commit-Time Invalidation

CGO Justin E. Gottschlich, Manish Vachharajani,

and Jeremy G. Siek

University of Colorado-Boulder Gottschlich, Vachharajani, and Siek 1

Page 2: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

• Problem o TM is not fast enough! (Cascaval et al., 2008)

• Reason oConflict Detection and Opacity

oMost TMs use Validation

• Our solution: o Full Invalidation

o InvalSTM

Gottschlich, Vachharajani, and Siek 2

Motivation

Page 3: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

• Conflict Detection o Determine if transaction can commit

• (Papadimitrou, “Theory of Database Concurrency Control,” 1986)

• Opacity o Keep in-flight transactions consistent

• (Guerraoui & Kapalka, PPoPP’08)

Gottschlich, Vachharajani, and Siek 3

TM Performance Bottleneck

Page 4: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Conflict Detection

Gottschlich, Vachharajani, and Siek 4

Conflict: WT1 ∩ (WT2 ∪ RT2) ≠ Ø

• Validation (T2) oAnalyze the Past

• Version # is same

• Invalidation (T1) oAnalyze the Future

• T2.valid = false

Page 5: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Opacity

Gottschlich, Vachharajani, and Siek 5

• Validation oVersion # is same

• Invalidation oCheck valid != false

Page 6: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Validation Vs. Invalidation

6

# of in-flight transactions

ele

men

ts p

er tx

validation variable

validation

invalidation

Gottschlich, Vachharajani, and Siek

variable invalidation

Page 7: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Contending + Concurrent Workload

7

Commit to Executed Ratio: Commits / Executed Max = 1, Min = 0

Gottschlich, Vachharajani, and Siek Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

1-Writer, N-Reader

Page 8: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Side-By-Side Analysis

8

Commit / Executed: 1 / M Commit / Executed: (M-1) / M

Validation Invalidation

lim𝑀→∞

1

𝑀= 0 lim

𝑀→∞

(𝑀−1)

𝑀= 1

Gottschlich, Vachharajani, and Siek Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Page 9: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Algorithmic Growth

9

𝑗

𝑟𝑖

𝑗=1

𝑀

𝑖=1

Validation =

𝑟𝑖 + 𝑤𝑖 𝑠𝑟𝑗 𝑟𝑗 + 𝑠𝑤𝑗 𝑤𝑗

𝐹𝑖

𝑗=1

𝑀

𝑖=1

Invalidation =

𝑟𝑖 + (2𝑘𝑤 ∗ 𝐹𝑖)

𝑀

𝑖=1

Bloom Inval =

Gottschlich, Vachharajani, and Siek Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Page 10: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Efficient Read-Only Transactions

10

𝑗

𝑟𝑖

𝑗=1

𝑀

𝑖=1

Validation Read-Only =

𝑟𝑖

𝑀

𝑖=1

Invalidation Read-Only =

Gottschlich, Vachharajani, and Siek

𝑟𝑖 + 𝑤𝑖 𝑠𝑟𝑗 𝑟𝑗 + 𝑠𝑤𝑗 𝑤𝑗

𝐹𝑖

𝑗=1

𝑀

𝑖=1

Invalidation =

Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Page 11: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Validation + Memory

atomic { x = y / z; } Addressable memory

Cache line size

x

z

y

L1 Cache

N = Elements per tx O(N2) cache misses per tx

x

z

y

Gottschlich, Vachharajani, and Siek 11

Page 12: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Invalidation + Memory

atomic { x = y / z; } Addressable memory

Cache line size

x

z

y

L1 Cache

x z y

M = # of in-flight txes N = # of read elements O(N + M) cache miss per tx

x z y

? ? ?

Bloom Filter

? ? ?

Other Tx

Gottschlich, Vachharajani, and Siek 12 Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Page 13: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Linked List

Gottschlich, Vachharajani, and Siek 13 Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Page 14: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

1-Writer / N-Readers

Gottschlich, Vachharajani, and Siek 14 Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Page 15: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Hash Table

Gottschlich, Vachharajani, and Siek 15 Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Page 16: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Zoomed Hash Table

0

1000

2000

3000

64k 128k 256k

TL2

iFair

Gottschlich, Vachharajani, and Siek 16

validation

invalidation

inserts/lookups per thread

seco

nd

s

Few Txes Few Elements

Few Txes Many Elements

Many Txes Many Elements

Many Txes Few Elements

Page 17: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Conclusion • Invalidation (InvalSTM) can be efficient

• Next up o Proof of correctness for Full Invalidation

o InvalSTM + STAMP

• Special thanks to Spear and Herlihy Gottschlich, Vachharajani, and Siek 17

Few Txes Few Elements

Many Txes Many Elements

Many Txes Few Elements

# of in-flight transactions

ele

me

nts p

er tx

validation variable

validation

variable invalidation invalidation

Page 18: An Efficient Software Transactional Memory Using Commit ... · Few Elements Validation Vs. Invalidation 6 # of in-flight transactions r tx validation variable validation invalidation

Gottschlich, Vachharajani, and Siek 18

Questions?

Justin E. Gottschlich [email protected]

http://eces.colorado.edu/~gottschl/