THE UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION Jons-Tobias - - PowerPoint PPT Presentation

the universal transactional memory construction
SMART_READER_LITE
LIVE PREVIEW

THE UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION Jons-Tobias - - PowerPoint PPT Presentation

THE UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION Jons-Tobias Wamhoff and Christof Fetzer Dresden University of Technology, Germany 1 MOTIVATION Universal construction Shows how to convert sequential algorithm into concurrent wait-free


slide-1
SLIDE 1

THE UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION

Jons-Tobias Wamhoff and Christof Fetzer Dresden University of Technology, Germany

1

slide-2
SLIDE 2

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

MOTIVATION

  • Universal construction
  • Shows how to convert sequential algorithm into concurrent

wait-free algorithm

  • Can one base such a construction on TM?
  • Wait-free progress for all correct operations
  • Tolerate crashes and non-terminating operations

2

slide-3
SLIDE 3

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

ASYNCHRONOUS MULTICORE SYSTEM MODEL (AMSM)

  • Asynchronous model with features of

current multi-core systems

  • Performance counters for executed

cycles per thread

  • Size of memory is bound
  • Operations (transactions) can be

executed by any thread

  • Compare-and-Swap (CAS),

Fetch-and-Increment (FAI)

3

Thread n Operating System Thread 1 Perf Ctr 1 Perf Ctr n

Code Code

Transactional Memory Shared Memory

slide-4
SLIDE 4

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

Thread n Operating System Thread 1 Perf Ctr 1 Perf Ctr n

Code Code

Transactional Memory Shared Memory

AMSM CRASH FAILURES

  • Threads can crash (stop taking steps)

caused by:

  • Operating system, hardware, signal:

not detectable in AMSM

  • Program code (bug): detected by

runtime and converted in exception

4

slide-5
SLIDE 5

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

AMSM PROGRAMS

  • Log defines total order on a sequence of

invocations (operations)

  • FIFO sequential execution
  • Multiple logs executed in parallel
  • Invocations (transactions) applied to shared

memory

  • Sequential object to transform into wait-free

linerizable object

  • Transactions can be non-terminating
  • Terminate correct transactions within finite

number of steps

5

Log 1 Log 0 Invocation 0

txBegin txRead txWrite txCommit

S1

txBegin txRead txWrite txCommit

S2

txBegin txRead txWrite txCommit

S3

txBegin txRead txWrite txCommit

S4

Invocation 1

slide-6
SLIDE 6

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

INVOCATION PROCESSING

How can one process invocations from k logs using n threads in a finite number of steps?

6

Thread n Operating System Thread 1 Perf Ctr 1 Perf Ctr n

Code Code

Transactional Memory Shared Memory

Log 1 Log 0 Invocation 0

txBegin txRead txWrite txCommit

S1

txBegin txRead txWrite txCommit

S2

txBegin txRead txWrite txCommit

S3

txBegin txRead txWrite txCommit

S4

Invocation 1

slide-7
SLIDE 7

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION

  • Universal construction transforms program from one valid

state to another valid state

  • Use TM to isolate modifications until commit
  • Schedule transactions on threads for wait-free progress

7

slide-8
SLIDE 8

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

STATES

8

Memory ... ...

1 2 3 4

ct key

S0

chunks

1 1 2 3 1 4 S1 1 1 2 2 2 3 1 4 S2 3 1 2 2 2 3 3 4 3 S3

current

NULL

State History

slide-9
SLIDE 9

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

TRANSACTION SCHEDULING ONTO THREADS

  • A thread‘s commit time is FAI(CT)
  • SCT = ftx(SCT-1)
  • CT-1 = i * k + l
  • Log l = (CT-1) mod k
  • Invocation i = (CT-1) div k

9

Log k Log 1 Invocation 0

txBegin txRead txWrite txCommit

S1

txBegin txRead txWrite txCommit

Sk

txBegin txRead txWrite txCommit

Sk+1

txBegin txRead txWrite txCommit

S2k

Invocation 1 ...

slide-10
SLIDE 10

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

TRANSACTION SCHEDULING ONTO THREADS

  • ct4 = FAI(CT4)
  • S4 = ftx(S3)
  • ct4-1 = i * k + l
  • Log l1 = 3 mod 2
  • Invocation i1 = 3 div 2

10

Log 1 Log 0 Invocation 0

txBegin txRead txWrite txCommit

S1

txBegin txRead txWrite txCommit

S2

txBegin txRead txWrite txCommit

S3

txBegin txRead txWrite txCommit

S4

Invocation 1

slide-11
SLIDE 11

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

txBegin(ct)

  • Clone current head of state history
  • Chunks are contained only by

reference

  • Set new commit time
  • Keep base version

11

1 1 2 2 2 3 1 4 S2

current

NULL 1 1 2 2 2 3 1 4 S4 B2

ct key

slide-12
SLIDE 12

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

txWrite(addr, val)

  • Identify chunk using hash function
  • Clone chunk if still reference
  • Update clone with value

12

1 1 2 2 2 3 1 4 S2

current

NULL 1 1 4 2 2 3 1 4 S4 B2

ct key

slide-13
SLIDE 13

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

txRead(addr)

  • Identify chunk using hash function
  • Keep commit time of chunk in read-

set if written by predecessor

  • Return value of address

13

1 1 2 2 2 3 1 4 S2

current

NULL 1 1 4 2 2 3 1 4 S4 B2

ct key

slide-14
SLIDE 14

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

txCommit

  • Wait until SCT-1 is available
  • Validate against SCT-1 that read-

set versions unchanged

  • Failure: abort and retry
  • Success: update chunk

references and append state to history using CAS

14

1 1 2 2 2 3 1 4 S2 3 1 2 2 2 3 3 4 3 S3

current

1 1 4 2 2 3 1 4 S4 B2

ct key

slide-15
SLIDE 15

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

txCommitProceeding(ct)

  • Wait until SCT-1 is available
  • Clone SCT-1 and append as SCT

using CAS

15

ct key

1 1 2 2 2 3 1 4 S2 3 1 2 2 2 3 3 4 3 S3

current

3 1 2 2 2 3 3 4 3 S4

slide-16
SLIDE 16

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

UNIVERSAL CONSTRUCTION FOR THE GOOD CASE

16 Thread 2 Thread 3 Thread 4 Operating System Thread 1 Log 1 Log 0 Log 2

CT8 s1=ftx(S0) s3=ftx(S2) s2=ftx(S1) ct4 ct5 ct6 ct7 s4=ftx(S3) s5=ftx(S4) s6=ftx(S5) NULL

Invocation 0 Invocation 1 Invocation 2

S3

Global State next CT

NULL NULL

slide-17
SLIDE 17

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

DEALING WITH THREAD CRASHES

  • Thread crashes not detectable in

AMSM: need helping

  • Waiting in txCommit for SCT-1 used

for helping

  • Process SCT-1 = ftx(SCT-2)
  • Progress as long as one thread survives

17 Log 1 Log 0

txBegin txRead txWrite txCommit

S3

txBegin txRead txWrite txCommit

S4

Invocation 1 Thread 2 Thread 1

ct3 ct4 S2

current

NULL S4

slide-18
SLIDE 18

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

DEALING WITH TRANSACTION CRASHES

  • Transaction crashes detectable in

AMSM: throw exception

  • Considered as persistent failures
  • Commit proceeding state
  • No further invocations can be added

to the log

18

Log 1 Log 0

txBegin txRead txWrite txCommit

S3

txBegin txRead txWrite txCommit

S4

Invocation 1

S2

current

S3=S2 NULL S5=S4

Empty

NULL

Invocation 2

slide-19
SLIDE 19

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

TOLERATING NON- TERMINATING TRANSACTIONS

  • Non-terminating transaction: ftx(SCT-1) never returns
  • Use performance counter to assign quota of steps

for invocation

  • When exceeded commit proceeding and retry

with larger quota

  • Quota is unknown and usually large
  • Bounded number of states (bound memory)

means bound number of steps for transaction to complete

19

Log 1 Log 0

txBegin txRead txWrite txCommit

S3

txBegin txRead txWrite txCommit

S4

Invocation 1

S2

current

S3=S2 NULL NULL

Invocation 2

txBegin txRead txWrite txCommit

S5 t=12 t=13 t=23

slide-20
SLIDE 20

The Universal Transactional Memory Construction TRANSACT‘11, San Jose, CA

CONCLUSION

  • Wait-free progress under AMSM by:
  • Decoupling of work from threads for helping
  • Isolating changes in transactions to mask failures

20