2007-03-16 1 The ATOMOS Transactional Programming Language Mehdi Amirijoo Linköpings universitet.

Slides:



Advertisements
Similar presentations
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Advertisements

Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Operating Systems: Monitors 1 Monitors (C.A.R. Hoare) higher level construct than semaphores a package of grouped procedures, variables and data i.e. object.
Ken Birman 1. Refresher: Dekers Algorithm Assumes two threads, numbered 0 and 1 CSEnter(int i) { int J = i^1; inside[i] = true; turn = J; while(inside[J]
Concurrency Control III. General Overview Relational model - SQL Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Operating Systems Part III: Process Management (Process Synchronization)
Concurrent programming for dummies (and smart people too) Tim Harris & Keir Fraser.
Operating Systems Mehdi Naghavi Winter 1385.
Global Environment Model. MUTUAL EXCLUSION PROBLEM The operations used by processes to access to common resources (critical sections) must be mutually.
Ch 7 B.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: Process Synchronization
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Monitors Chapter 7. The semaphore is a low-level primitive because it is unstructured. If we were to build a large system using semaphores alone, the.
5.6 Semaphores Semaphores –Software construct that can be used to enforce mutual exclusion –Contains a protected variable Can be accessed only via wait.
1 Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, “lazy” implementation.
5.6.2 Thread Synchronization with Semaphores Semaphores can be used to notify other threads that events have occurred –Producer-consumer relationship Producer.
Chapter 2.3 : Interprocess Communication
Synchronization in Java Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
TxLinux: Using and Managing Hardware Transactional Memory in an Operating System Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E. Ramadan,
Semaphores CSCI 444/544 Operating Systems Fall 2008.
Synchronization in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Department of Computer Science Presenters Dennis Gove Matthew Marzilli The ATOMO ∑ Transactional Programming Language.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Process Synchronization.
More Synchronisation Last time: bounded buffer, readers-writers, dining philosophers Today: sleeping barber, monitors.
Atomic Operations David Monismith cs550 Operating Systems.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Quick overview of threads in Java Babak Esfandiari (extracted from Qusay Mahmoud’s slides)
1 Concurrent Languages – Part 1 COMP 640 Programming Languages.
CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.
Condition Variables and Transactional Memory: Problem or Opportunity? Polina Dudnik and Michael Swift University of Wisconsin, Madison.
Semaphores, Locks and Monitors By Samah Ibrahim And Dena Missak.
Internet Software Development Controlling Threads Paul J Krause.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization.
OPERATING SYSTEMS Frans Sanen.  Recap of threads in Java  Learn to think about synchronization problems in Java  Solve synchronization problems in.
In Java processes are called threads. Additional threads are associated with objects. An application is associated with an initial thread via a static.
Java Thread and Memory Model
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-5 Process Synchronization Department of Computer Science and Software.
Lecture 6: Monitors & Semaphores. Monitor Contains data and procedures needed to allocate shared resources Accessible only within the monitor No way for.
COSC 3407: Operating Systems Lecture 9: Readers-Writers and Language Support for Synchronization.
C H A P T E R E L E V E N Concurrent Programming Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
Comunication&Synchronization threads 1 Programación Concurrente Benemérita Universidad Autónoma de Puebla Facultad de Ciencias de la Computación Comunicación.
CS 2200 Presentation 18b MUTEX. Questions? Our Road Map Processor Networking Parallel Systems I/O Subsystem Memory Hierarchy.
June 11, 2002Serguei A. Mokhov, 1 The Monitor COMP346 - Operating Systems Tutorial 7 Edition 1.2, June 15, 2002.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Big Picture Lab 4 Operating Systems C Andras Moritz
Scalable Computing model : Lock free protocol By Peeyush Agrawal 2010MCS3469 Guided By Dr. Kolin Paul.
CS 311/350/550 Semaphores. Semaphores – General Idea Allows two or more concurrent threads to coordinate through signaling/waiting Has four main operations.
Multithreading / Concurrency
Background on the need for Synchronization
Part 2: Software-Based Approaches
Definitions Concurrent program – Program that executes multiple instructions at the same time. Process – An executing program (the running JVM for Java.
Monitors Chapter 7.
Changing thread semantics
Atomicity in Multithreaded Software
Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E
Critical section problem
Monitors Chapter 7.
Chapter 6: Process Synchronization
Conditions for Deadlock
Monitors Chapter 7.
CSE 153 Design of Operating Systems Winter 19
Chapter 6: Synchronization Tools
Threads and Multithreading
Software Engineering and Architecture
Presentation transcript:

The ATOMOS Transactional Programming Language Mehdi Amirijoo Linköpings universitet

Mehdi Amirijoo2 Background Transactional memory Conditional waiting Transaction Nesting Evaluation Conclusion

Mehdi Amirijoo3 Background Multi-threaded application Access to shared data using locks semaphore s;... wait(s); //decrease s count++; signal(s); //increase s...

Mehdi Amirijoo4 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 Amirijoo5 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 Amirijoo6 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 Amirijoo7 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) vs pessimistic waiting (locks) Roll-back due to writes outside the transaction Process P1 { atomic { atomic {... } }...

Mehdi Amirijoo8 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 Amirijoo9 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 Amirijoo10 Conditional Waiting synchronized (lock) { count++; if (count != nThreads) lock.wait(); else lock.notifyAll(); } atomic { count++; if (count != nThreads) { watch count; retry; }} Example: Barrier synchronization atomic { count++; } atomic { if (count != nThreads) { watch count; retry; }}

Mehdi Amirijoo11 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 Amirijoo12 Nesting

Mehdi Amirijoo13 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 Amirijoo14 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 Amirijoo15 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 Amirijoo16 Evaluation Benchmark focusing on business object manipulation Only 1% chance of contention between threads. ATOMOS does not incur additional bottlenecks

Mehdi Amirijoo17 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 Amirijoo18 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