CRAFTING
A READY-TO-GO STM

Guy Korland
Tel Aviv University
Process 1

a = acc.get()
a = a + 100
acc.set(a)

Process 2
b = acc.get()
b = b + 50
acc.set(b)

... Lost Update! ...
Process 1

Process 2

lock(A)
lock(B)

lock(B)
lock(A)

... Deadlock! ...
Process 1

Process 2

atomic{
a = acc.get()
a = a + 100
acc.set(a)
}

atomic{
b = acc.get()
b = b + 50
acc.set(b)
}

... W...
DSTM2
MAURICE HERLIHY ET AL, A FLEXIBLE FRAMEWORK … [OOPSLA06]

@atomic public interface INode{
int getValue ();
void setV...
JVSTM
JOÃO CACHOPO AND ANTÓNIO RITO-SILVA, VERSIONED BOXES AS THE BASIS
FOR MEMORY TRANSACTIONS [SCOOL05]

public class Ac...
DEUCE STM - API
Guy Korland, Nir Shavit and Pascal Felber, “Noninvasive Java
Concurrency with Deuce STM”, [MultiProg '10]
...
DEUCE STM - OVERVIEW
BENCHMARKS
(SUN ULTRASPARC T2 PLUS – 2 X QUAD X 8HT)
BENCHMARKS
(AZUL – VEGA2 – 2 X 48)
BENCHMARK - THE DARK SIDE
1.2
1
0.8
0.6

Lock
Deuce

0.4
0.2
0

1

2

3

4

5

6

7

8

9

10
OVERHEAD
• Contention – Retries, Aborts, Contention Manager …
• STM Algorithm – Data structures, optimistic, pessimistic…
...
STATIC ANALYSIS
OPTIMIZATIONS
1. Avoiding instrumentation of accesses to
immutable and transaction-local memory.
2. Avoidi...
NEW STATIC ANALYSIS
OPTIMIZATIONS
Yehuda Afek, Guy Korland, and Arie Zilberstein,
“Lowering STM Overhead with Static Analy...
BENCHMARKS – K-MEANS
STM FRIENDLY LIBRARIES
• Most of the developers/application only use Data Structures.
@Atomic(retries=64)
public void tran...
WWW.DEUCESTM.ORG
Crafting  a Ready-to-Go STM
Crafting  a Ready-to-Go STM
Crafting  a Ready-to-Go STM
Crafting  a Ready-to-Go STM
Crafting  a Ready-to-Go STM
Crafting  a Ready-to-Go STM
Crafting  a Ready-to-Go STM
Crafting  a Ready-to-Go STM
Upcoming SlideShare
Loading in...5
×

Crafting a Ready-to-Go STM

851

Published on

Crafting a Ready-to-Go Java STM

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
851
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Crafting a Ready-to-Go STM

  1. 1. CRAFTING A READY-TO-GO STM Guy Korland Tel Aviv University
  2. 2. Process 1 a = acc.get() a = a + 100 acc.set(a) Process 2 b = acc.get() b = b + 50 acc.set(b) ... Lost Update! ...
  3. 3. Process 1 Process 2 lock(A) lock(B) lock(B) lock(A) ... Deadlock! ...
  4. 4. Process 1 Process 2 atomic{ a = acc.get() a = a + 100 acc.set(a) } atomic{ b = acc.get() b = b + 50 acc.set(b) } ... WIIIII ...
  5. 5. DSTM2 MAURICE HERLIHY ET AL, A FLEXIBLE FRAMEWORK … [OOPSLA06] @atomic public interface INode{ int getValue (); void setValue (int value ); } Factory<INode> factory = Thread.makeFactory(INode.class ); final INode node = factory.create(); factory result = Thread.doIt(new Callable<Boolean>() { public Boolean call () { return node.setValue(value); } });
  6. 6. JVSTM JOÃO CACHOPO AND ANTÓNIO RITO-SILVA, VERSIONED BOXES AS THE BASIS FOR MEMORY TRANSACTIONS [SCOOL05] public class Account{ private VBox<Long> balance = new VBox<Long>(); public @Atomic void withdraw(long amount) { balance.put (balance.get() - amount); } }
  7. 7. DEUCE STM - API Guy Korland, Nir Shavit and Pascal Felber, “Noninvasive Java Concurrency with Deuce STM”, [MultiProg '10] public class Bank{ private double commission = 10; @Atomic public void transaction( Account ac1, Account ac2, double amount){ ac1.balance -= (amount + commission); ac2.balance += amount; } }
  8. 8. DEUCE STM - OVERVIEW
  9. 9. BENCHMARKS (SUN ULTRASPARC T2 PLUS – 2 X QUAD X 8HT)
  10. 10. BENCHMARKS (AZUL – VEGA2 – 2 X 48)
  11. 11. BENCHMARK - THE DARK SIDE 1.2 1 0.8 0.6 Lock Deuce 0.4 0.2 0 1 2 3 4 5 6 7 8 9 10
  12. 12. OVERHEAD • Contention – Retries, Aborts, Contention Manager … • STM Algorithm – Data structures, optimistic, pessimistic… • Semantic – Consistency model, Privatization… • Instrumented Memory access – Linear overhead on every read/write
  13. 13. STATIC ANALYSIS OPTIMIZATIONS 1. Avoiding instrumentation of accesses to immutable and transaction-local memory. 2. Avoiding lock acquisition and releases for thread-local memory. 3. Avoiding readset population in read-only transactions.
  14. 14. NEW STATIC ANALYSIS OPTIMIZATIONS Yehuda Afek, Guy Korland, and Arie Zilberstein, “Lowering STM Overhead with Static Analysis”, LCPC'10 1. Reduce amount of instrumented memory reads using load elimination. 2. Reduce amount of instrumented memory writes using scalar promotion. 3. Avoid writeset lookups for memory not yet written to. 4. Avoid writeset record keeping for memory that will not be read. 5. Reduce false conflicts by Transaction re-scoping. 6. …
  15. 15. BENCHMARKS – K-MEANS
  16. 16. STM FRIENDLY LIBRARIES • Most of the developers/application only use Data Structures. @Atomic(retries=64) public void transaction( Map map1, Map map2, String key){ map2.put(key, map1.remove(key)); }  We should build a set of “STM Friendly” libraries. Maurice Herlihy, Eric Koskinen: Transactional boosting: a methodology for highly-concurrent transactional objects. PPOPP’08
  17. 17. WWW.DEUCESTM.ORG
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×