Time-Warp: Lightweight Abort Minimization in Transactional Memory Nuno Diegues and Paolo Romano ndiegues@gsd.inesc-id.pt Nuno Diegues 1/27
Transactional Memory Powerful abstraction for synchronization in shared memory Nuno Diegues 2/27
Transactional Memory Powerful abstraction for synchronization in shared memory Executions equivalent to serial ones Nuno Diegues 2/27
Transactional Memory Powerful abstraction for synchronization in shared memory Executions equivalent to serial ones Optimistic Nuno Diegues 2/27
Transactional Memory Powerful abstraction for synchronization in shared memory Executions equivalent to serial ones Optimistic Transactions may abort to ensure correctness ◮ Typically, more aborts than needed Nuno Diegues 2/27
Problem Linked ... head A D E List Nuno Diegues 3/27
Problem B Linked ... head A D E List insert B T Nuno Diegues 3/27
Problem B Linked ... head A D E List remove E U insert B T Nuno Diegues 3/27
Problem B Linked ... head A D E List remove E U insert B T contains D? RO Nuno Diegues 3/27
Problem B Linked ... head A D E List remove E U insert B T contains D? RO Nuno Diegues 4/27
Problem B Linked ... head A D E List remove E U X insert B T contains D? RO Nuno Diegues 4/27
Problem B Linked ... head A D E List remove E read-set: { head.next, A .next, D .next } U X write-set: { D .next } insert B read-set: { head.next, A .next } T write-set: { A .next } contains D? read-set: { head.next, A .next } RO Nuno Diegues 4/27
Problem B Linked ... head A D E List remove E read-set: { head.next, A .next, D .next } U X write-set: { D .next } read write head.next: A B .next = D T read write A .next: D A .next = B contains D? read-set: { head.next, A .next } RO Nuno Diegues 4/27
Problem B Linked ... head A D E List remove E read-set: { head.next, A .next, D .next } U X write-set: { D .next } read write head.next: A B .next = D T read write A .next: D A .next = B rw RO read read head.next: A A .next: D Nuno Diegues 4/27
Problem B Linked ... head A D E List read read read write head.next: A A .next: D D .next = E D .next = E .next U X rw read write head.next: A B .next = D T read write A .next: D A .next = B rw RO read read head.next: A A .next: D Nuno Diegues 4/27
Problem B Linked ... head A D E List read A .next: D U X rw T write A .next = B rw RO read A .next: D Nuno Diegues 4/27
Problem To guarantee a given correctness level, a TM aborts transactions. Typical STMs use the following rule: Nuno Diegues 5/27
Problem To guarantee a given correctness level, a TM aborts transactions. Typical STMs use the following rule: function commit ( Transaction tx ): for each ‹ datum , version › ∈ tx .readSet do if not latestVersion( datum , version ) then abort( tx ) Nuno Diegues 5/27
Problem Condition: Abort T if its reads are not up-to-date when it attempts to commit. Nuno Diegues 6/27
Problem Condition: Abort T if its reads are not up-to-date when it attempts to commit. Serializability: Necessary condition But not sufficient Nuno Diegues 6/27
Problem Condition: Abort T if its reads are not up-to-date when it attempts to commit. Serializability: Necessary condition But not sufficient Deemed to be practical ◮ without being overly conservative (eg., precluding all concurrency) Nuno Diegues 6/27
Objective B Linked ... head A D E List read A .next: D U X rw T write A .next = B rw RO read A .next: D Nuno Diegues 7/27
Objective B Linked ... head A D E List read A .next: D U rw T write A .next = B rw RO read A .next: D Nuno Diegues 7/27
Objective Lightweight minimization of spurious aborts: More restrictive abort condition Always read consistently Read-only transactions that never abort Nuno Diegues 7/27
Outline Problem and Motivation Objective Existing Work Time-Warp Evaluation Nuno Diegues 8/27
Existing Work Additional versions — fixed number in LSA [DISC06] MV-Permissiveness — as many as needed in JVSTM [PPoPP11] Permissiveness — AbortsAvoider [SPAA09] Interval-Based — AVSTM [DISC08] Nuno Diegues 9/27
Existing Work Interval-Based : AVSTM [DISC08], TSTM [TPDS12], IR_VWC_P [ICA3PP11] Nuno Diegues 10/27
Existing Work Interval-Based : AVSTM [DISC08], TSTM [TPDS12], IR_VWC_P [ICA3PP11] bounds for serialization order refined with transaction execution imposed by concurrent commits choose one value in the final interval Nuno Diegues 10/27
Interval-based Approach Disadvantages: A read-only transaction may abort An update transaction may abort due to one miss Scalability issues on commit Nuno Diegues 11/27
read x read y write y T 1 rw T 2 read x write x Nuno Diegues 12/27
read x read y write y T 1 rw T 2 read x write x T 2 T 1 serialization time Nuno Diegues 12/27
read x read y write y T 1 rw T 2 read x write x rw T 2 T 1 serialization time Decouple serialization order from commit order Nuno Diegues 12/27
read x read y write y T 1 rw T 2 read x write x T 2 serialization Nuno Diegues 12/27
read x read y write y T 1 rw T 2 read x write x rw T 1 T 2 serialization Nuno Diegues 12/27
read x read y write y T 1 rw T 2 read x write x rw T 1 T 2 serialization Time-warp commit Nuno Diegues 12/27
read x read y write y T 1 t=4 rw t=3 T 2 read x write x rw T 1 T 2 serialization Time-warp commit Nuno Diegues 12/27
read x read y write y T 1 t=4 time-warp=2 rw t=3 T 2 read x write x rw T 1 T 2 serialization Time-warp commit — versions are produced with past version Nuno Diegues 12/27
Abort Condition When can we not apply this idea? Nuno Diegues 13/27
Abort Condition When can we not apply this idea? Look out for a specific structure Nuno Diegues 13/27
Abort Condition When can we not apply this idea? Look out for a specific structure: write y read x Three transactions connected A B ◮ a triad rw rw T read y write x Nuno Diegues 13/27
Abort Condition When can we not apply this idea? Look out for a specific structure: write y read x Three transactions connected A B ◮ a triad The link between all three rw rw ◮ the pivot Pivot T read y write x Nuno Diegues 13/27
Abort Condition When can we not apply this idea? Look out for a specific structure: Three transactions connected write y read x A B ◮ a triad The link between all three rw rw ◮ the pivot Pivot T Abort if: read y write x ◮ Completes a triad ◮ Whose pivot time-warp commits Nuno Diegues 13/27
Abort Condition wr write y write z read x read z A B Necessary condition (tighter) Still cheap enough to check rw rw Pivot T read y write x Nuno Diegues 13/27
How to Validate Upon commit, transaction T performs: Nuno Diegues 14/27
How to Validate Upon commit, transaction T performs: Validate each write k Nuno Diegues 14/27
How to Validate Upon commit, transaction T performs: Validate each write k ◮ Detect if some concurrent T ′ read k ◮ If so, T ′ witnessed that T did not exist ◮ We forbid T from time-warping Nuno Diegues 14/27
How to Validate Upon commit, transaction T performs: Validate each write k ◮ Detect if some concurrent T ′ read k ◮ If so, T ′ witnessed that T did not exist ◮ We forbid T from time-warping Validate each read k Nuno Diegues 14/27
How to Validate Upon commit, transaction T performs: Validate each write k ◮ Detect if some concurrent T ′ read k ◮ If so, T ′ witnessed that T did not exist ◮ We forbid T from time-warping Validate each read k ◮ Detect if some concurrent T ′ committed a new version to k ◮ If so, T must time-warp Nuno Diegues 14/27
How to Validate Upon commit, transaction T performs: Validate each write k ◮ Detect if some concurrent T ′ read k ◮ If so, T ′ witnessed that T did not exist ◮ We forbid T from time-warping Validate each read k ◮ Detect if some concurrent T ′ committed a new version to k ◮ If so, T must time-warp Abort T if it must time-warp, but cannot do so Nuno Diegues 14/27
How to Validate Upon commit, transaction T performs: Validate each write k ◮ Detect if some concurrent T ′ read k ◮ If so, T ′ witnessed that T did not exist ◮ We forbid T from time-warping Validate each read k ◮ Detect if some concurrent T ′ committed a new version to k ◮ If so, T must time-warp Abort T if it must time-warp, but cannot do so Semi-visible readers scheme ◮ Know that some transaction read, not which ◮ Write transactions amortize the cost during read validation Nuno Diegues 14/27
Evaluation Study Wide variety of benchmarks: Micro-benchmarks: skip-list Macro-benchmarks: STMBench7 and STAMP Nuno Diegues 15/27
Evaluation Study Wide variety of benchmarks: Micro-benchmarks: skip-list Macro-benchmarks: STMBench7 and STAMP STMs spanning the design space: Nuno Diegues 15/27
Recommend
More recommend