210 likes | 304 Views
Reactive Synchronization Algorithms for Multiprocessors. Beng-Hong Lim and Anant Agarwal Laboratory of Computer Science Massachusetts Institute of Technology. Zahid Irfan Department of Computer Science Lahore University of Management Sciences 1 st February 2003. Introduction.
E N D
Reactive Synchronization Algorithms for Multiprocessors Beng-Hong Lim and Anant Agarwal Laboratory of Computer Science Massachusetts Institute of Technology Zahid Irfan Department of Computer Science Lahore University of Management Sciences 1st February 2003
Introduction • Multiprocessors • Alewife – Shared memory Multiprocessor • Synchronization • Shared Memory Protocols • Message Passing Protocols • Reactive Synchronization Algorithms • Dynamically select the protocol
Synchronizations Algorithms • Passive Spin-Lock Algorithms • Test & Set with Exponential Backoff • Queue Locks
… Synchronization Algorithms • Passive Fetch & Op Algorithm • Lock-based Fetch & Op • Software Combining Tree
Problems • Variation in performance at different contention levels… • Spin Locks • Low Contention • Test & Set with Exponential Back off • High Contention • MCS Queue Lock
… Problems • Variation in performance at different contention levels… • Fetch and Op • Low Contention • Test & Test & Set Lock • High Contention • Software Combining Tree
Need.. Justifies .. Solution • Solution for synchronization • Select Protocol Dynamically… • How to detect? • How to change the protocol? • When to switch the protocol?
Reactive synchronization Algorithm • Synchronization Algorithm • Protocol Selection Algorithm • Selects the appropriate protocol • Waiting Algorithm • Selects the mechanism to wait for synchronization
Algorithm Building • Main Difficulty lies in Multiple Processes • Processes with “correct” protocol should be preferred • Assumption : Contention levels are “fairly” constant • Contention time is highly architecture dependent • Switching policy will be Architecture optimized
Reactive Spin Lock • A combination of Test-Test-Set Lock + MCS Queue Lock • Mode Variable determines which protocol to use. • Protocol Detection Scheme • Cached-mode variable which provides hints of level of contention
Reactive Spin Lock • Protocol Change • Lock holders can update the mode variable i.e., effectively change protocols • When to change • Level of lock contention crosses a threshold switch to the Queue Lock • The queue is empty switch to the TTS Lock
Reactive Spin Lock • Consensus Object • Unique for each protocol (valid or invalid) ensures single protocol. • Complete the execution of the protocol. • State is modified only by the process having consensus object.
Reactive Fetch & Op • Mode variable selecting between • Test-Test-Set and Lock • Queue Lock • Software Combining Tree • Only one consensus object is valid • Process with consensus object is allowed to change the protocol.
Reactive Fetch & Op • Queue gives a good estimate of contention level if high switch to Combining Tree. • If number the number of successive Fetch & Op reach the root without combining switch to TTS-Lock.
Message Passing Protocols • Most Shared Memory on top of Message Passing Machines • Use Message Passing Combining Tree • Message Passing Queue Lock
Applications Tested • Gamteb • Traveling Sales Man Problem • Adaptive Quadrature (AQ) • MP3D • Cholesky
Performance Spin Lock Algorithms
Performance Fetch “&” Op Algorithms
Performance Variations in Contention
Performance Variations in Contention
Conclusions • Proved that managing different protocols is not prohibitive • Efficient Selection of protocols through consensus object • Performance modest for Spin Locks and significant for Fetch & Op For source listings: ftp://hing.lcs.mit.edu