180 likes | 198 Views
Introducing Chain Clocks as an efficient alternative to Vector Clocks for event tracking in shared memory systems, including Dynamic Chain Clock and Antichain-based Chain Clock. Explore experiments, implementations, and conclusions.
E N D
Efficient Dependency Tracking for Relevant Events in Shared-Memory Systems by Anurag Agarwal and Vijay K. Garg 2008-01-24 OS Lab Ok-Kyoon Ha 2005 ACM
AgGa05 Contents • Introduction • Chain Clocks • Dynamic Chain Clock • Antichain-based Chain Clock • Chain Clock for Shared Memory System • Experimental Results • Conclusion
Introduction 1 • Vector Clock Algorithm • captures happened-before relation by assigning a timestamp to every events • strong clock condition: e→ f⇔ e.V< f.V • O(N) operations making the algorithm unscalable • become inefficient and cumbersome in systems where the number of processes can change with time
(1,0) (0,1) (1) (2,0) (0,2) (2) (3,0) (2,3) (3) (4,0) (2,4) (4) Introduction 2 • Chain Clocks • a class of timestamping algorithms to alleviate some of the problems with vector clocks for applications like predicate detection • only the order between the relevant events needs to be tracked • these relevant events constitute a small percentage of the total events • some chain clocks can decompose a computation into fewer than N chains in many cases
(1) (2) (3) (0,1) (0,2) (0,3) Chain Clocks 1 • Key Idea • any chain in the computation poset can function as a process (4,1) (4,4) the chain clock satisfies the strong clock condition
k+1 2 Chain Clocks 2 • Instances of Chain Clocks • DCC (Dynamic Chain Clock) - finds a chain decomposition of the poset such that the number of chains in the decomposition is bounded by N • ACC (Antichain-based Chain Clock) - gives a partition where the number of chains is bounded by • VCC (Variable based Chain Clock) - uses chains based on access events of relevant variables in a shared memory system (instead of processes in the system) • these chain clocks adapt automatically to process creation • termination as the components of the clock are not bound to specific processes
Z: a vector of integer - shared data structure - add a new component Dynamic Chain Clock 1 • An implementation of GI for chain clocks
The relevant subcomputation Dynamic Chain Clock 2 • A problem of DCC
F: vector of integer - shared data structure • - the last process to increment Z Dynamic Chain Clock 3 • Bounding the number of chains for DCC
k+1 2 Antichain-based Chain Clock 1 • Optimal Chain Decomposition • antichain: set of pairwise concurrent elements • width: maximum size of an antichain • Online Chain Decomposition • elements of poset presented in a total order consistent with the poset • requires the lower bound of chains to partition a poset of width k
- B1 … Bk : |Bi| = i - For an element z: - Insert into the first queue q in Bi with head < z - Swap queues in Bi and Bi-1 leaving q in its place y z x u k+1 2 Antichain-based Chain Clock 2 • Chain Partitioning Algorithm • partitions a poset of width k into at most chains y y z z Elements x u u Queues B1 B2
Chain Clocks for Shared Memory System 1 • Shared Memory System • accesses to shared variables incur dependencies • e<f : e.p = f.p and e is executed before f • e<f : e and f are access events on the same variable and e was executed before f • Variable-based Chain Clocks (VCC) • associate a component with every variables • the set of relevant events can be decomposed in terms of chains based on the variables • very useful for predicate detection in shared memory systems
Chain Clocks for Shared Memory System 2 • VCC Application: Predicate Detection • predicate: (x = 2) ∧ (y = 2) • only events changing x and y are relevant • Associate a component of VCC with x and other with y
Experimental Results 1 • Components vs Threads Events = 100 a = 1%
Experimental Results 2 • Time vs Threads Events = 100 a = 1%
Experimental Results 3 • Components vs Events Threads = 100 a = 1%
Experimental Results 4 • Components vs Relevant Event Fraction Threads = 100 Events = 100
Conclusion • Generalized vector clocks to a class of algorithms called Chain Clocks • Dynamic Chain Clock (DCC) can provide tremendous speedup and reduce memory requirement for applications • Variable based Chain Clock (VCC) provide efficient dependency tracking for relevant events in shared memory system