1 / 25

Crafting a Ready-to-Go STM

Crafting a Ready-to-Go STM. Guy Korland Tel Aviv University. DSTM2 Maurice Herlihy et al, A flexible framework … [OOPSLA06]. Limited to Objects. V ery intrusive. Doesn’t support libraries. Bad performance (fork). . @atomic public interface INode { int getValue ();

etenia
Download Presentation

Crafting a Ready-to-Go STM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Craftinga Ready-to-Go STM Guy Korland Tel Aviv University

  2. DSTM2Maurice Herlihy et al, A flexible framework … [OOPSLA06] • Limited to Objects. • Very intrusive. • Doesn’t support libraries. • Badperformance (fork). @atomicpublic interface INode{ intgetValue (); 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); } });

  3. JVSTMJoãoCachopo and AntónioRito-Silva, Versioned boxes as the basis for memory transactions [SCOOL05] • Doesn’t support libraries. • Less intrusive. • Need to “Announce” shared fields public class Account{ private VBox<Long> balance = new VBox<Long>(); public @Atomic void withdraw(long amount) { balance.put (balance.get() - amount); } }

  4.   public static class Node<E> { private Ref<E> value;        final Node parent;        Node(E value, Node prev) {this.value = value;this.parent = prev;        }    } MultiversePeter Veentjer, since 2009 • Doesn’t support libraries. • Need to “Announce” shared things. • But, used commercially (AKKA). @TransactionalObject public class Stack<E>{ private Node<E> head; @TransactionalMethod public void push(E item) {    head = new Node(item, head); } }

  5. Atom-JavaB. Hindman and D. Grossman. Atomicity via source-tosourcetranslation. [MSPC06] • Add a reserved word. • Need pre-compilation. • Doesn’t support libraries. • Even Lessintrusive. public void update ( double value) { Atomic { commission += value; } }

  6. Guy Korland, Nir Shavit and Pascal Felber, “Noninvasive Java Concurrency with Deuce STM”,[MultiProg '10] Deuce STM Annotation based--> @Atomicmethods Field basedaccess More scalable than Object bases. More efficient than word based. No reserved words No need for new compilers (Existing IDEs can be used)

  7. Deuce STM Supports external libraries Can be part of a transaction Research tool API for developing and testing new algorithms. Real life feedback.

  8. Deuce STM - API public class Bank{ private double commission = 10; @Atomic(retries=64) public void transaction( Account ac1, Account ac2, double amount){ ac1.balance -= (amount + commission); ac2.balance += amount; } @Atomic public void update( double value){ commission += value; } }

  9. Deuce STM - Overview

  10. public interface Context{ • void init ( intatomicBlockId) • boolean commit(); • void rollback (); • void beforeReadAccess( Object obj , long field ); • Object onReadAccess( Object obj, Object value , long field ); • intonReadAccess( Object obj, int value , long field ); • long onReadAccess( Object obj, long value , long field ); • … • void onWriteAccess( Object obj , Object value , long field ); • void onWriteAccess( Object obj , int value , long field ); • void onWriteAccess( Object obj , long value , long field ); • … • } Research tool(Context- interface)

  11. Benchmarks (SuperMicro – 2 x Quad Intel)

  12. Benchmarks (Sun UltraSPARC T2 Plus – 2 x Quad x 8HT)

  13. Benchmarks (Azul – Vega2 – 2 x 48)

  14. Benchmarks (Sun UltraSPARC T2 Plus – 2 x Quad x 8HT)

  15. Benchmark - the dark side

  16. 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

  17. Static analysis OPTIMIZATIONS • Avoiding instrumentation of accesses to immutableand transaction-local memory. • Avoiding lock acquisition and releases for thread-localmemory. • Avoiding readset population in read-onlytransactions.

  18. NEWStatic analysis OPTIMIZATIONS Yehuda Afek, Guy Korland, and ArieZilberstein, “Lowering STM Overhead with Static Analysis”, LCPC'10 • Reduce amount of instrumented memory reads using load elimination. • Reduce amount of instrumented memory writes using scalar promotion. • Avoid writeset lookups for memory not yet written to. • Avoid writesetrecord keeping for memory that will not be read. • Reduce false conflicts byTransaction re-scoping. • …

  19. 1. LOAD ELIMINATION IN ATOMIC BLOCKS • for (int j = 0; j < nfeatures; j++) { newCenters[index][j] = newCenters[index][j] + feature[i][j]; } • if (0 < nfeatures) { nci = new_centers[index]; fi = feature[i]; for (j = 0; j < nfeatures; j++) nci[j] = nci[j] + fi[j]; } 5 instrumented memory reads per loop iteration 2 instrumented memory reads per loop iteration

  20. Benchmarks – K-Means

  21. 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

  22. Summarywww.deucestm.org

More Related