software transactional objects guy eddon maurice herlihy tramp 2007
TRANSCRIPT
![Page 1: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/1.jpg)
Software Transactional Objects
Guy EddonMaurice Herlihy
TRAMP 2007
![Page 2: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/2.jpg)
2
Language/Library supportfor Transactions
• Lots of worn on unmanaged languages– “word-based”
• What about managed languages?– Objects, GC, bounds checks,
structured exceptions?– Java™, C#?
• Different concerns
![Page 3: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/3.jpg)
3
Prior STM Work
• Awkward user interface– Long-lived transactional “wrappers” vs– Short-lived “versions”
• Programmer conventions– List element points to wrapper which
points to list ….– Don’t use short-lived objects beyond
lifetime ….
![Page 4: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/4.jpg)
4
public class List { public int item; public TMObject<List> next;}
Old-School Atomic Classes
Next field is explicit wrapper
![Page 5: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/5.jpg)
5
List next = list.next.OpenRead();
Old-School Atomic Classes
Explicit open(specify read or write)
![Page 6: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/6.jpg)
6
List next = list.next.OpenRead();
Old-School Atomic Classes
Must discard after transaction, don’t modify,
etc…
![Page 7: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/7.jpg)
7
List rVersion = list.next.OpenRead();
Old-School Atomic Classes
Read version unchangedRead
version changed
List wVersion = list.next.OpenWrite();wVersion.item++;
List wVersion = list.next.OpenWrite();
List rVersion = list.next.OpenRead();
![Page 8: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/8.jpg)
8Software Transactional Memory
Library approach
• Intercept field accesses– SXM (C#)– DSTM2 (Java™)
• Programmer use factories– Input is interface– Synthesize code to intercept field
accesses
![Page 9: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/9.jpg)
9
Examples
node.Key = 42; // C# property style
Node.setKey(42); // Java EJB style
![Page 10: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/10.jpg)
10
Examples
node.Key = 42; // C# property style
Node.setKey(42); // Java EJB style
try { T version = (T) start.get().newVersion; final Method method = version.getClass().getMethod(methodName, _class); return new Adapter.Setter<V>() { public void call(V value) { try { ThreadState state = Thread.getLocalState(); …
![Page 11: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/11.jpg)
11
Advantages
• Strong Atomicity– Detects transactional/non-
transactional race conditions
• Natural programming style– Almost sequential– No complex conventions
![Page 12: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/12.jpg)
12
Disadvantages
• Efficiency, efficiency, efficiency– Even with fast-path optimizations
• Solution– Use flow analysis to remove
synchronization– Use MSFT Phoenix compiler
![Page 13: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/13.jpg)
13
Lock-Based Runtime
0
200,000
400,000
600,000
800,0001,000,000
1,200,000
1,400,000
SXM 1
.1
Libr
ary
Opts
Compil
er
Cons
tLo
cal
RWPr
omo
Subs
eque
nt
PreO
pen
List
RBTree
SkipList
HashTable
Buff er
![Page 14: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/14.jpg)
14
Obstruction-Free Run-Time
0
200,000
400,000
600,000
800,000
1,000,000
SXM 1
.1
Libr
ary
Opts
Compil
er
Cons
tLo
cal
RWPr
omo
Subs
eque
nt
PreO
pen
List
RBTree
SkipList
HashTable
Buff er
![Page 15: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/15.jpg)
15
Locking vs Obstruction-Free
0
50,000
100,000
150,000
200,000
Ofree
Locking
![Page 16: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/16.jpg)
16
Conclusions
• Managed languages are also important
• Simple flow analysis goes a long way
• Do not rule out non-blocking algorithms yet
![Page 17: Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007](https://reader033.vdocument.in/reader033/viewer/2022061306/551478c2550346ea6e8b4596/html5/thumbnails/17.jpg)
17
Clip Art