1 / 18

The ATOMOS Transactional Programming Language

This paper discusses the ATOMOS transactional programming language, focusing on transactional memory, conditional waiting, transaction nesting, and evaluation. It compares ATOMOS with Java and concludes that ATOMOS simplifies program design and improves performance.

reubenk
Download Presentation

The ATOMOS Transactional Programming Language

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. The ATOMOS Transactional Programming Language Mehdi AmirijooLinköpings universitet

  2. Background • Transactional memory • Conditional waiting • Transaction Nesting • Evaluation • Conclusion Mehdi Amirijoo

  3. Background • Multi-threaded application • Access to shared data using lockssemaphore s;... wait(s); //decrease scount++;signal(s); //increase s... Mehdi Amirijoo

  4. Background • Course-grained locking leads to serialization on high-contention data structures Process P1 { wait(s); ... d.a++; ... signal(s);} Process P2 { wait(s); ... d.b++; ... signal(s);} Process P3 { wait(s); ... d.a++; ... signal(s);} Mehdi Amirijoo

  5. Background • Fine-grained locking: • improves concurrency • increases code complexity (deadlocks) • degrading performance Process P1 { ... wait(s1); d.a++; signal(s1); ...} Process P2 { ... wait(s2); d.b++; signal(s2); ...} Mehdi Amirijoo

  6. Transactional Memory • Focus on where atomic execution is necessary • Not how it is implemented Process P1 { ... atomic { d.a++; } ...} Process P2 { ... atomic { d.b++; } ...} Mehdi Amirijoo

  7. Transactional Memory • Statements within atomic appear to have serialization with respect to: • Other transactions • Reads and writes outside of transactions • Nested transactions • Optimistic speculation (transactions) vspessimistic waiting (locks) • Roll-back due to writesoutside the transaction Process P1 { atomic { atomic { ... } } ... Mehdi Amirijoo

  8. Conditional Waiting • Conditional critical region (CCR) • Similar property as critical sections, and • A process can enter the critical region iff the condition evaluates to be true. • In ATOMOS: atomic { if ( !condition(condition_variables) ) { watch condition_variables; retry;} // critical region} Mehdi Amirijoo

  9. Conditional Waiting Class Buffer { public int get (){ synchronized (this) { while (!available) wait(); available = false; notifyAll(); return contents;}} public void put(int value) { synchronized (this) { while (available) wait(); contents = value; available = true; notifyAll();}} } Class Buffer {public int get() { atomic { if (!available) { watch available; retry;} available = false; return contents;}} public void put (int value) { atomic { if (available) { watch available; retry;} contents = value; available = true;}}} Mehdi Amirijoo

  10. Conditional Waiting Example: Barrier synchronization atomic { count++; if (count != nThreads) { watch count; retry; }} synchronized (lock) { count++; if (count != nThreads) lock.wait(); else lock.notifyAll();} atomic { count++; } atomic { if (count != nThreads) { watch count; retry; }} Mehdi Amirijoo

  11. Nesting • In databases transactions usually reduce isolation to improve performance • Communication from within uncommitted transactions! • Closed-nested transaction:Results of children visible only to parent • Open-nested Transaction:Results of children visible globally Mehdi Amirijoo

  12. Nesting Mehdi Amirijoo

  13. Nesting public static int generateID { atomic { return id++; }} public static void createOrder (...) { atomic { Order order = new Order(); order.setID(generateID()); // finish initialization of order. This could // include more calls to generateID. orders.put(new Integer(order.getID()),order); }} Mehdi Amirijoo

  14. Nesting public static open int generateID { open { return id++; }} public static void createOrder (...) { atomic { Order order = new Order(); order.setID(generateID()); // finish initialization of order. This could // include more calls to generateID. orders.put(new Integer(order.getID()),order); }} Mehdi Amirijoo

  15. Evaluation • Goal:Compare ATOMOS with Java • Synchronized→atomic • wait(), notify(), notifyAll() → watch, retry • 1 to 32 CPU:s (no thread migration) • No garbage collection • Measure execution time Mehdi Amirijoo

  16. Evaluation Benchmark focusing on business object manipulation Only 1% chance of contention between threads. ATOMOS does not incur additional bottlenecks Mehdi Amirijoo

  17. Evaluation Benchmark focusing on business object manipulation Hashtable and HashMap use only one mutex ConcurrentHashMap uses fine-grained locking Atomos uses single atomic statement Mehdi Amirijoo

  18. Conclusion • Transactional programming simplifies design of programs • Conditional waiting enables CCR • Open nesting increases performance by reducing time to commit • Evaluation shows that the approach is scalable with the number of processors Mehdi Amirijoo

More Related