Dynamic Changes Of Transactional Memory Update Policies Nikola

  • Slides: 19
Download presentation
Dynamic Changes Of Transactional Memory Update Policies Nikola Vujić email: nikola. vujic@gmail. com 1

Dynamic Changes Of Transactional Memory Update Policies Nikola Vujić email: nikola. vujic@gmail. com 1 /22

Introduction q q q Memory accessing - the most expensive operation in Transactional Memory

Introduction q q q 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 q q direct-updated policy deferred-update policy /22 22/15

Deferred-Update policy q q q A transaction uses a private copies of objects opened

Deferred-Update policy q q q 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 /22 33/15

Direct-Update policy q q q A transaction directly modifies the object itself Changes to

Direct-Update policy q q q 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 /22 44/15

Herlihy, Luchangco, Moir and Scherer, PODC 2003 q q Deferred-update system Software transactional memory

Herlihy, Luchangco, Moir and Scherer, PODC 2003 q q 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 tm. Object = new TMObject(counter) /22 55/15

Harris, Plesko, Shinnar, Tarditi, PLDI 06 q q q Direct-update system This system is

Harris, Plesko, Shinnar, Tarditi, PLDI 06 q q q Direct-update system This system is from Microsoft and is called BSTM and is similar with Mc. RT-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 /22 66/15

Advantages of direct-update systems q q Decreases the cost of committing a transaction, by

Advantages of direct-update systems q q 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 /22 77/15

Drawbacks of direct-update systems q q q Increases the cost of aborting a transaction

Drawbacks of direct-update systems q q q Increases the cost of aborting a transaction Requires a recording of the undo log Cascade rollback /22 88/15

Advantages of deferred-update systems q q Decreases the cost of aborting a transaction Transaction

Advantages of deferred-update systems q q Decreases the cost of aborting a transaction Transaction can concurrently modify its private copies 9/15 /22 99/15

Drawbacks of deferred-update systems q q Increases the cost of committing a transaction. Increases

Drawbacks of deferred-update systems q q 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 10

Proposed solution q q q In which case is one of them better then

Proposed solution q q q 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 11

Algorithm update policy direct update deferred update Min q K 1 1 K 2

Algorithm update policy direct update deferred update Min q K 1 1 K 2 Max A/C 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 12

Algorithm update policy direct update deferred update Min q K 1 1 K 2

Algorithm update policy direct update deferred update Min q K 1 1 K 2 Max A/C 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 13

Algorithm update policy What would happen if value of A/C could go to infinity?

Algorithm update policy What would happen if value of A/C could go to infinity? direct update deferred update Min q K 1 1 K 2 Max A/C Value of A/C is not only important, speed of changing value A/C is also important feature. 12/15 /22 14

Algorithm update policy direct update deferred update Min q K 1 1 K 2

Algorithm update policy direct update deferred update Min q K 1 1 K 2 Max A/C Values K 1 and K 2 are features of our system 12/15 /22 15

Algorithm update policy direct update deferred update Min q K 1 1 K 2

Algorithm update policy direct update deferred update Min q K 1 1 K 2 Max A/C Changing of update policy depends on: q q Work load Structure of the application 12/15 /22 16

Algorithm q Two approaches on when update policy can be changed in run-time: q

Algorithm q Two approaches on when update policy can be changed in run-time: q q Structural, after synchronization barrier On time quantum, periodically when it is needed 13/15 /22 17

Conclusion q q Implementation of the proposed solution Writing test applications for our system

Conclusion q q Implementation of the proposed solution Writing test applications for our system in order to establish values K 1 and K 2 Solution can be extended Many optimizations can be added 14/15 /22 18

Questions? Dynamic Changes Of Transactional Memory Update Policies Nikola Vujić email: nikola. vujic@gmail. com

Questions? Dynamic Changes Of Transactional Memory Update Policies Nikola Vujić email: nikola. vujic@gmail. com 15/15 /22 19