Fm wtm12-v2
-
Upload
miguel-gamboa -
Category
Engineering
-
view
309 -
download
0
Transcript of Fm wtm12-v2
1
Objects with adaptive accessors to avoid STM barriers
F. Miguel Carvalho and João Cachopo
WTM-2012
Software Engineering Group
Bern, Switzerland, April 10, 2012
2
General Goal
3
Shared data
4
atomic
5
Overheads?
6
STM Barriers
Reduce Runtime Overheads
• Redo-log <vs> undo-log• Eager <vs> lazy ownership acquisition• Transactional versioning• No ownership records• Metatada in place• Multi-versioning (e.g. JVSTM)• …
7
8
Good for read-only
9
Memory overheads
10
Winding path
11
Can we suppress these overheads?
12
AOMAdaptive Object Metadata
…implemented in the JVSTM
13
box
:VBox
body:
:Counter
current:
14
versions’ history
:VBoxBody
next:
value: 2
version: 19
:VBoxBody
next:
value: 1
version: 17
:VBoxBody
next: null
value: 0
version: 13
:VBox
body:
:Counter
current:
The most recent committed value.
15
Transaction
:VBoxBody
next:
value: 2
version: 19
:VBoxBody
next:
value: 1
version: 17
:VBoxBody
next: null
value: 0
version: 13
:VBox
body:
:Counter
current:
:Transaction
version: 18
…lastCommitted 23
16
Transaction
:VBoxBody
next:
value: 2
version: 19
:VBoxBody
next:
value: 1
version: 17
:VBoxBody
next: null
value: 0
version: 13
:VBox
body:
:Counter
current:
:Transaction
version: 18
…lastCommitted 23
Transaction 18 reads the version 17
17
Shared Data
No contention
18
19
AOMCompact Extended
AOM
:SomeType32767
2147483647
34.7
field x
field y
field z
Compact Extended
AOM
:Something32767
2147483647
34.7
field x
field y
field z
Compact Extended
nullHeader
AOM
Header32767
2147483647
34.7
Header32767
214748364734.7
value of x
value of y
value of z
version
values
next
:VBoxBody
23
field x
field y
field z
version
values
next
:VBoxBody
19
null
value of x
value of y
value of z
22
Compact Extended
AOM
Headerx of version 23
z of version 23
y of version 23
Header32767
214748364734.7
value of x
value of y
value of z
version
values
next
:VBoxBody
23
field x
field y
field z
version
values
next
:VBoxBody
19
null
value of x
value of y
value of z
23
Compact Extended1.
2.
24
1. Extending
header:
x: 3
y: 7
null
25
:VBoxBody
next:
version: 0
value:
header:
x: 3
y: 7
null
null
:Integer
value: 7
:Integer
value: 3
1
1. Extending
replicate()
26
:VBoxBody
next:
version: 17
value:
:VBoxBody
next:
version: 0
value:
header:
x: 3
y: 7
null
null
:Integer
value: 7
:Integer
value:11
:Integer
value: 7
:Integer
value: 3
12
1. Extending
replicate()
27
:VBoxBody
next:
version: 17
value:
:VBoxBody
next:
version: 0
value:
header:
x: 3
y: 7
null
null
:Integer
value: 13
:Integer
value: 11
:Integer
value: 7
:Integer
value: 3
13 2
1. Extending
casHeader()
2. Reverting
:VBoxBody
next:
version: 17
value:
header:
x: 3
y: 7
:Integer
value: 13
:Integer
value: 11
null
null
2
1
3cas
put
read 28
boolean tryRevert (AdaptiveObject o , VBoxBody body){ if(o.readHeader() == body){ o.toCompactLayout(body.value); return o.casHeaderWithNull(body); } return false;}
1
2
3
29
AdaptiveObjectabstract class AdaptiveObject <T extends AdaptiveObject{
private VBoxBody<T> header;
public abstract void toCompactLayout(T from); public VBoxBody<T> readHeader(){
return header; } public boolean casHeaderWithNull(VBoxBody<T> expected){
return UtilUnsafe.UNSAFE.compareAndSwapObject(this,header__ADDRESS__, expected, null); }
}
29
boolean tryRevert (AdaptiveObject o , VBoxBody body){ if(o.readHeader() == body){ o.toCompactLayout(body.value); return o.casHeaderWithNull(body); } return false;}
1
2
3
30
AdaptiveObjectabstract class AdaptiveObject <T extends AdaptiveObject{
private static final long header__ADDRESS__;
private VBoxBody<T> header;
public abstract T replicate();
public abstract void toCompactLayout(T from); public VBoxBody<T> readHeader(){
return header; } public boolean casHeaderWithNull(VBoxBody<T> expected){
return UtilUnsafe.UNSAFE.compareAndSwapObject(this,header__ADDRESS__, expected, null); }
public boolean casHeader(VBoxBody<T> expected, VBoxBody<T> newBody){return UtilUnsafe.UNSAFE.compareAndSwapObject(this, header__ADDRESS__, expected,
newBody); }
}
31
hierarchy
Object
…
…… …
…
…
… …
… …
…
… …
… …
32
hierarchy
AdaptiveObject
…
…… …
…
…
… …
… …
…
… …
… …
Object
33
AOM
• 1st release (Multiprog 12)– implemented with the JVSTM lock based– reversion and extension operations specified by an AdaptiveObject interface
• 2nd release:– Implemented with the JVSTM lock free – AdaptiveObject as the root base class– provides a Transparent API (like Deuce STM)
34
• increases the speedup between 13% and 35%(* Multiprog12)
AOM with JVSTM lock based
0,00
0,50
1,00
1,50
2,00
2,50
3,00
3,50
1 2 4 8 10 12 14 16
Spee
dup
Threads
Circuit Main
0,00
0,50
1,00
1,50
2,00
2,50
3,00
1 2 4 8 10 12 14 16Threads
Circuit Mem
LeeTM
35
• increases the speedup between 5% and 36%
new AOM with JVSTM lock freeLeeTM
0,00
1,00
2,00
3,00
4,00
5,00
6,00
1 2 4 8 12 16 20 24 28 32 36 40 44 48
Spee
dup
Threads
Circuit Main
JVSTM
AOM
0,00
1,00
2,00
3,00
4,00
5,00
1 2 4 8 12 16 20 24 28 32 36 40 44 48
Spee
dup
Threads
Circuit Mem
36
STAMP Vacation, low++ & long trxs & RO
• Low contention• ++, large data sets• -n = 256, longer transactions, instead of the
recommendation 2 or 4• 3 kinds of transactions:– Delete and create items: car, flight or room– Remove defaulter clients (bill > 0)– Query and reserve an item: car, flight or room
Splitted in 2 transactions: RO + RW
STAMP Vacation, low++ & long trxs & RO
• increases the speedup between 18% and 37%• Maximum speedup = 4,32
0,00
0,50
1,00
1,50
2,00
2,50
3,00
3,50
4,00
4,50
5,00
1 2 4 8 12 16 20 24 28 32 36 40 44 48
Spee
dup
Threads
JVSTM
AOM
38
Comparing with the Deuce STM…
and enhancing the AOM with a transparent API
Turning all objects transactional
STAMP Vacation, low++ & long trxs & RO
• Maximum speedup = 3,83 (< 4,32 with a non-transparent API)• Still better than the Deuce STM with TL2
0,00
0,50
1,00
1,50
2,00
2,50
3,00
3,50
4,00
4,50
1 2 4 8 12 16 20 24 28 32 36 40 44 48
Spee
dup
Threads
JVSTM
AOM
Deuce TL2
STAMP Vacation, low++ & long trxs & RO
• Maximum speedup = 1,92• Still better than JVSTM and the Deuce TL2
0,00
0,50
1,00
1,50
2,00
2,50
1 2 4 8 12 16 20 24 28 32 36 40 44 48
Spee
dup
Threads
JVSTM
AOM
Deuce TL2
41
Future Work
42
Future Work• An improved reversion algorithm
• New design for AOM that keeps the contention-free execution path without any barrier or validation
• Integrate the AOM compiler in the implementation of the Deuce STM
43/42