Download presentation
Presentation is loading. Please wait.
Published byXavier McNulty Modified over 11 years ago
1
Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007
2
2 Language/Library support for Transactions Lots of worn on unmanaged languages –word-based What about managed languages? –Objects, GC, bounds checks, structured exceptions? –Java, C#? Different concerns
3
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 …. –Dont use short-lived objects beyond lifetime ….
4
4 public class List { public int item; public TMObject next; } Old-School Atomic Classes Next field is explicit wrapper
5
5 List next = list.next.OpenRead(); Old-School Atomic Classes Explicit open (specify read or write)
6
6 List next = list.next.OpenRead(); Old-School Atomic Classes Must discard after transaction, dont modify, etc…
7
7 List rVersion = list.next.OpenRead(); Old-School Atomic Classes Read version unchanged Read version changed List wVersion = list.next.OpenWrite(); wVersion.item++; List wVersion = list.next.OpenWrite(); List rVersion = list.next.OpenRead();
8
8 Software Transactional Memory Library approach Intercept field accesses –SXM (C#) –DSTM2 (Java) Programmer use factories –Input is interface –Synthesize code to intercept field accesses
9
9 Examples node.Key = 42; // C# property style Node.setKey(42); // Java EJB style
10
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 () { public void call(V value) { try { ThreadState state = Thread.getLocalState(); …
11
11 Advantages Strong Atomicity –Detects transactional/non-transactional race conditions Natural programming style –Almost sequential –No complex conventions
12
12 Disadvantages Efficiency, efficiency, efficiency –Even with fast-path optimizations Solution –Use flow analysis to remove synchronization –Use MSFT Phoenix compiler
13
13 Lock-Based Runtime
14
14 Obstruction-Free Run-Time
15
15 Locking vs Obstruction-Free
16
16 Conclusions Managed languages are also important Simple flow analysis goes a long way Do not rule out non-blocking algorithms yet
17
17 Clip Art
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.