Runtime Elision of Transactional Barriers for Captured Memory Fernando Miguel Carvalho
[email protected]
João Cachopo
[email protected]
INESC-ID Lisboa / Instituto Superior Técnico / Technical University of Lisbon
Overview Memory Heap
Memory Heap
Deuce void transactionalOperation(){
@Atomic void transactionalOperation(){ ... }
Captured Memory Captured Memory
trx life cycle
}
STM Barriers + Capture Analysis
void transactionalOperation(){ ... }
Instrument Memory Accesses
Motivation and problem statement
Idea
STM frameworks may provide a Transparent API (e.g. Deuce):
+ Labeling objects with the allocating transaction ID. Transaction
@Atomic public void transactionalOperation(){ ... }
Captured Memory
Which data is shared from within an atomic operation?
:Object
Trx Id Trx Id
owner:
+ Rely on the GC to recycle IDs, avoiding additional synchronization. Overzealous STM compilers may protect every memory access with an STM barrier, even for unshared data!!!
Lightweight runtime capture analysis CtxDelegatorCapSt
Thread A
1
Loss of performance
trxFingerprint: init()
3
:CtxFilterCapSt
init()
new
:CtxFilterCapSt
2
1 :Object
:Counter
:Object
CtxDelegatorCapSt
Thread B
:trxFingerprint new
init()
init()
:owner n: ...
new
next() onReadAccess()
Remembering past proposals
onWritedAccess() Unsafe.putInt()
Heterogeneous API examples:
commit()
next() commit()
onReadAccess()
onReadAccess()
void m(){ ... opAccessUnsharedData(); }
@tm_waiver void opAccessUnsharedData(){ ... }
3
init()
init()
new
onWriteAccess()
:Object
onWriteAccess()
next()
void m(){ ... ImmutableClass.op(); }
onReadAccess()
@Exclude Class ImmutableClass{ ... }
Performance
onReadAccess()
Burdens programmers
Experimental results
vs
• Static Analysis • Runtime Capture Analysis: Memory Heap
Transaction life cycle start
1400
end
start
end
start
end
1600 1800 2200
1000 1200 1400 1600 1800 2200
transaction-local allocation log
Automatic
Performance
Captured Memory
Automatic STM barriers elision on: • Iterators => STMBench7 operations traverse a large graph of objects, leading to an intensive use of collection iterators. • Auxiliary arrays => several parameterized arrays provide the required arguments for the execution of the Vacation operations.
Acknowledgements This work was supported by national funds through FCT - Fundação para a Ciência e a Tecnologia, both under project PEst-OE/EEI/LA0021/2011 and under project PTDC/EIA-EIA/108240/2008 (the RuLAM project). Copyright is held by the author/owner(s). PPoPP’13, February 23–27, 2013, Shenzhen, China. ACM 978-1-4503-1922/13/02.
2