190 likes | 317 Views
Dynamic Changes Of Transactional Memory Update Policies. Nikola Vuji ć email: nikola.vujic@gmail.com. /22. Introduction. Memory accessing - the most expensive operation in Transactional Memory systems Updating values in memory’s locations – the most significant problem in TM systems
E N D
Dynamic Changes Of Transactional Memory Update Policies Nikola Vujić email: nikola.vujic@gmail.com /22
Introduction • Memory accessing - the most expensive operation in Transactional Memory systems • Updating values in memory’s locations – the most significant problem in TM systems • Two update policies • direct-updated policy • deferred-update policy 2/15 /22
Deferred-Update policy • A transaction uses a private copies of objects opened for updating • Changes to objects opened by a transaction are not visible outside the transaction until transaction commits • Actual object must be updated from private copy when transaction commits 3/15 /22
Direct-Update policy • A transaction directly modifies the object itself • Changes to objects opened by transaction are visible outside the transaction • If the transaction aborts, old values of the modified objects must be restored 4/15 /22
Herlihy, Luchangco, Moir and Scherer, PODC 2003 • Deferred-update system • Software transactional memory designed to support dynamic-sized data structures (DSTM) • Every object must be wrapped in transactional object • Example of Atomic Counter: Counter counter = new Counter(0) TMObject tmObject = new TMObject(counter) 5/15 /22
Harris, Plesko, Shinnar, Tarditi, PLDI06 • Direct-update system • This system is from Microsoft and is called BSTM and is similar with McRT-STM system from Intel • Two-phase lock • Shared lock is used in read mode and exclusive lock is used in write mode • Every object which will be accessed by transaction has one additional field of type STMWord 6/15 /22
Advantages of direct-update systems • Decreases the cost of committing a transaction, by eliminating the need to copy from a private copy to an object • Eliminates one or two memory references per read or write 7/15 /22
Drawbacks of direct-update systems • Increases the cost of aborting a transaction • Requires a recording of the undo log • Cascade rollback 8/15 /22
Advantages of deferred-update systems • Decreases the cost of aborting a transaction • Transaction can concurrently modify its private copies 9/15 9/15 /22
Drawbacks of deferred-update systems • Increases the cost of committing a transaction. • Increases a program’s memory usage by making private copies of every object which a transaction modifies 10/15 /22
Proposed solution • In which case is one of them better then another one? • By analyzing the past of the execution we will predict which approach will be more efficient in the future. • This solution we call: Dynamic Changes Of Transactional Memory Update Policies 11/15 /22
update policy direct update deferred update 1 A/C K2 Max Min K1 Algorithm • Initial value of relation A/C will be Min,and update policy will be direct-update. After initialization system will start to count number of committing and aborting 14/22 12/15
update policy direct update deferred update 1 A/C K2 Max Min K1 Algorithm • Small variations of the A/C relation value must not trigger system to switch between update policies because it waste processor’s time. 12/15 /22
update policy direct update deferred update 1 A/C K2 Max Min K1 Algorithm What would happen if value of A/C could go to infinity? • Value of A/C is not only important, speed of changing value A/C is also important feature. 12/15 /22
update policy direct update deferred update 1 A/C K2 Max Min K1 Algorithm • Values K1 and K2 are features of our system 12/15 /22
update policy direct update deferred update 1 A/C K2 Max Min K1 Algorithm • Changing of update policy depends on: • Work load • Structure of the application 12/15 /22
Algorithm • Two approaches on when update policy can be changed in run-time: • Structural, after synchronization barrier • On time quantum, periodically when it is needed 13/15 /22
Conclusion • Implementation of the proposed solution • Writing test applications for our system in order to establish values K1 and K2 • Solution can be extended • Many optimizations can be added 14/15 /22
Questions? Dynamic Changes Of Transactional Memory Update Policies Nikola Vujić email: nikola.vujic@gmail.com 15/15 /22