Download Fields - VELOX Project

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Deuce STM
Noinvasive Java Concurrency with Deuce STM
OPTIONAL
LOGO HERE
OPTIONAL
LOGO HERE
An extensible Java STM framework
Guy Korland, Nir Shavit, and Pascal Felber
Tel-Aviv University & University of Neuchˆatel
Introduction
We present a complete Java STM framework,
called Deuce, intended as a platform for
developing scalable concurrent applications and
as a research tool for designing new STM
algorithms.
Deuce provides several benefits over existing
Java STM frameworks:
Avoids any changes or additions to the JVM.
Does not require language extensions or
intrusive APIs.
Does not impose any memory footprint or GC
overhead.
Dynamically instruments classes at load time.
Uses an original “field-based” locking
strategy to improve concurrency.
Provides a simple internal API allowing
different STMs algorithms to be plugged and
test.






Implementation
Deuce Layers:
1. The application which consists only user
classes, except for annotations added to atomic
methods.
3. The actual STM libraries that implement the
Deuce context API.
void beforeReadAccess(Object obj,
long field);
Object onReadAccess(Object obj,
Object value, long field);
int onReadAccess(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 );
...
}
@Atomic(retries = 10)
public void transfer(Account account1,
Account account2,
double amount){
account1.amount -= amount;
account2.amount += amount;
}
}
• Relies on Java annotations, transactifying an
application is as easy as adding @Atomic
annotations to methods that should execute as
transactions.
• Provides a configurable attribute, retries, to
optionally limit the amount of retries the
transaction attempts.
• A TransactionException is thrown in case
this limit is reached.
Java -javaagent:deuceAgent.jar -cp ...
TEMPLATE DESIGN © 2007
www.PosterPresentations.com
Byte Code Manipulation
Deuce’s instrumentation engine is based on
ASM, an all-purpose Java bytecode manipulation
and analysis framework.
Instrument each loaded class:
1. Fields – adds a synthetic constant field which
represents the relative position of the field.
2. Duplicate methods - to avoid performance
penalty on non transactional code.
Circuit routing - is the process of
automatically producing an interconnection
between electronic components. Scales well,
with the overall time decreasing.
Performance Evaluation
We evaluated the performance on:
Sun UltraSPARC T2 Plus multicore machine,
an Azul Vega2 and a SuperMicro (2 Intel
quad core CPUs).
We tested the three built-in DEUCE STM options:
LSA (Lazy Snapshot Algorithm), TL2
(Transactional Locking II), and a simple Global
Lock (A reference implementation).
Conclusions
•A novel open-source Java framework for
transactional memory.
•The first efficient fully featured Java STM
framework that that can be added to an
existing application without changes to its
compiler or libraries.
•We encourage developers to try Deuce.
For further information
3. Atomic methods - the original @Atomic
method is replaced by a transactional version
that executes the a transaction retry loop.
4. Optimizations:
• Final fields – Avoid instrument accesses to
final fields as they cannot be modified after
creation.
• Constructor fields accessed Avoid
instrument fields accessed in the constructor
as they are not accessible by concurrent
threads until the constructor returns.
•Use the sun.misc.Unsafe pseudostandard
internal library to implement fast reflection.
Bank benchmark - Combines short update
transactions with long read-only transactions.
Scaling starts even at a small number of
threads.
public class Context{
void init ( int atomicBlockId);
boolean commit();
void rollback ();
One of the main goals in designing the Deuce
API was to
keep it simple.
public class Bank{
A research platform for STM methods.
Provides a simple Context API for researchers
to plug in their own STM implementation.
2. The Deuce runtime that orchestrates the
interactions between the application and the
underlying STM implementation.
Programming Model
public class Account{
public int id;
public double amount;
}
Customizing Concurrency Control
• Visit Deuce page: http://www.deucestm.org
•TAU MultiCore Group http://mcg.cs.tau.ac.il
• Guy Korland: [email protected]
• Nir Shavit: [email protected]
• Pascal Felber: [email protected]
Skip list benchmark The STMs scale in an impressive way as long as
there is an increase in the level of parallelism,
and provide great scalability even with 20%
updates.
Acknowledgment
This work was supported in part by grants from
Sun Microsystems, Intel Corporation, Microsoft
Inc, as well as a grant 06/1344 from the Israeli
Science Foundation and European Union grant
FP7-ICT-2007-1 (project VELOX).