21
Reactive Reactive Synchronization Synchronization Algorithms for Algorithms for Multiprocessors Multiprocessors Beng-Hong Lim and Anant Agarwal Beng-Hong Lim and Anant Agarwal Laboratory of Computer Science Laboratory of Computer Science Massachusetts Institute of Technology Massachusetts Institute of Technology Zahid Irfan Zahid Irfan Department of Computer Science Department of Computer Science Lahore University of Management Sciences Lahore University of Management Sciences 1 st st February 2003 February 2003

Reactive Synchronization Algorithms for Multiprocessors

  • Upload
    liseli

  • View
    26

  • Download
    0

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

Page 1: Reactive Synchronization Algorithms for Multiprocessors

Reactive Synchronization Reactive Synchronization Algorithms for Algorithms for

MultiprocessorsMultiprocessorsBeng-Hong Lim and Anant AgarwalBeng-Hong Lim and Anant Agarwal

Laboratory of Computer ScienceLaboratory of Computer ScienceMassachusetts Institute of TechnologyMassachusetts Institute of Technology

Zahid IrfanZahid IrfanDepartment of Computer ScienceDepartment of Computer Science

Lahore University of Management SciencesLahore University of Management Sciences11stst February 2003 February 2003

Page 2: Reactive Synchronization Algorithms for Multiprocessors

IntroductionIntroduction

Multiprocessors Multiprocessors Alewife – Shared memory Multiprocessor Alewife – Shared memory Multiprocessor

SynchronizationSynchronization Shared Memory ProtocolsShared Memory Protocols Message Passing ProtocolsMessage Passing Protocols

Reactive Synchronization AlgorithmsReactive Synchronization Algorithms Dynamically select the protocolDynamically select the protocol

Page 3: Reactive Synchronization Algorithms for Multiprocessors

Synchronizations Algorithms Synchronizations Algorithms

Passive Spin-Lock Passive Spin-Lock AlgorithmsAlgorithms Test & Set with Test & Set with

Exponential BackoffExponential Backoff Queue LocksQueue Locks

Page 4: Reactive Synchronization Algorithms for Multiprocessors

… … Synchronization AlgorithmsSynchronization Algorithms

Passive Fetch & Op AlgorithmPassive Fetch & Op Algorithm Lock-based Fetch & OpLock-based Fetch & Op Software Combining TreeSoftware Combining Tree

Page 5: Reactive Synchronization Algorithms for Multiprocessors

ProblemsProblems

Variation in performance at different Variation in performance at different contention levels…contention levels… Spin Locks Spin Locks

Low Contention Low Contention Test & Set with Exponential Back offTest & Set with Exponential Back off

High ContentionHigh Contention MCS Queue Lock MCS Queue Lock

Page 6: Reactive Synchronization Algorithms for Multiprocessors

… … ProblemsProblems

Variation in performance at different Variation in performance at different contention levels…contention levels… Fetch and OpFetch and Op

Low Contention Low Contention Test & Test & Set LockTest & Test & Set Lock

High ContentionHigh Contention Software Combining TreeSoftware Combining Tree

Page 7: Reactive Synchronization Algorithms for Multiprocessors

Need.. Justifies .. SolutionNeed.. Justifies .. Solution

Solution for synchronizationSolution for synchronization Select Protocol Dynamically… Select Protocol Dynamically…

- How to detect?How to detect?

- How to change the protocol?How to change the protocol?

- When to switch the protocol?When to switch the protocol?

Page 8: Reactive Synchronization Algorithms for Multiprocessors

Reactive synchronization AlgorithmReactive synchronization Algorithm

Synchronization AlgorithmSynchronization Algorithm Protocol Selection AlgorithmProtocol Selection Algorithm

Selects the appropriate protocolSelects the appropriate protocol

Waiting AlgorithmWaiting Algorithm Selects the mechanism to wait for synchronizationSelects the mechanism to wait for synchronization

Page 9: Reactive Synchronization Algorithms for Multiprocessors

Algorithm BuildingAlgorithm Building

Main Difficulty lies in Multiple ProcessesMain Difficulty lies in Multiple Processes Processes with “correct” protocol should be Processes with “correct” protocol should be

preferredpreferred

Assumption : Contention levels are “fairly” Assumption : Contention levels are “fairly” constantconstant

Contention time is highly architecture Contention time is highly architecture dependentdependent Switching policy will be Architecture optimizedSwitching policy will be Architecture optimized

Page 10: Reactive Synchronization Algorithms for Multiprocessors

Reactive Spin LockReactive Spin Lock

A combination of A combination of Test-Test-Set Lock + Test-Test-Set Lock + MCS Queue LockMCS Queue Lock Mode Variable Mode Variable

determines which determines which protocol to use.protocol to use.

Protocol Detection Protocol Detection SchemeScheme Cached-mode variable Cached-mode variable

which provides hints of which provides hints of level of contentionlevel of contention

Page 11: Reactive Synchronization Algorithms for Multiprocessors

Reactive Spin LockReactive Spin Lock

Protocol ChangeProtocol Change Lock holders can update the mode variable Lock holders can update the mode variable

i.e., effectively change protocolsi.e., effectively change protocols

When to change When to change Level of lock contention crosses a threshold Level of lock contention crosses a threshold

switch to the Queue Lockswitch to the Queue Lock The queue is empty switch to the TTS LockThe queue is empty switch to the TTS Lock

Page 12: Reactive Synchronization Algorithms for Multiprocessors

Reactive Spin Lock Reactive Spin Lock

Consensus ObjectConsensus Object Unique for each protocol (valid or invalid) Unique for each protocol (valid or invalid)

ensures single protocol.ensures single protocol. Complete the execution of the protocol.Complete the execution of the protocol. State is modified only by the process having State is modified only by the process having

consensus object.consensus object.

Page 13: Reactive Synchronization Algorithms for Multiprocessors

Reactive Fetch & OpReactive Fetch & Op

Mode variable selecting betweenMode variable selecting between Test-Test-Set and LockTest-Test-Set and Lock Queue LockQueue Lock Software Combining TreeSoftware Combining Tree

Only one consensus object is validOnly one consensus object is valid Process with consensus object is allowed Process with consensus object is allowed

to change the protocol.to change the protocol.

Page 14: Reactive Synchronization Algorithms for Multiprocessors

Reactive Fetch & OpReactive Fetch & Op

Queue gives a good estimate of Queue gives a good estimate of contention level if high switch to contention level if high switch to Combining Tree.Combining Tree.

If number the number of successive Fetch If number the number of successive Fetch & Op reach the root without combining & Op reach the root without combining switch to TTS-Lock.switch to TTS-Lock.

Page 15: Reactive Synchronization Algorithms for Multiprocessors

Message Passing ProtocolsMessage Passing Protocols

Most Shared Memory Most Shared Memory on top of Message on top of Message Passing MachinesPassing Machines Use Message Passing Use Message Passing

Combining Tree Combining Tree Message Passing Message Passing

Queue Lock Queue Lock

Page 16: Reactive Synchronization Algorithms for Multiprocessors

Applications TestedApplications Tested

GamtebGamteb Traveling Sales Man ProblemTraveling Sales Man Problem Adaptive Quadrature (AQ)Adaptive Quadrature (AQ) MP3DMP3D CholeskyCholesky

Page 17: Reactive Synchronization Algorithms for Multiprocessors

PerformancePerformance

Spin Lock AlgorithmsSpin Lock Algorithms

Page 18: Reactive Synchronization Algorithms for Multiprocessors

PerformancePerformance

Fetch “&” Op AlgorithmsFetch “&” Op Algorithms

Page 19: Reactive Synchronization Algorithms for Multiprocessors

PerformancePerformance

Variations in Variations in ContentionContention

Page 20: Reactive Synchronization Algorithms for Multiprocessors

PerformancePerformance

Variations in Variations in ContentionContention

Page 21: Reactive Synchronization Algorithms for Multiprocessors

ConclusionsConclusions

Proved that managing different protocols Proved that managing different protocols is not prohibitiveis not prohibitive

Efficient Selection of protocols through Efficient Selection of protocols through consensus objectconsensus object

Performance modest for Spin Locks and Performance modest for Spin Locks and significant for Fetch & Opsignificant for Fetch & Op

For source listings: ftp://hing.lcs.mit.eduFor source listings: ftp://hing.lcs.mit.edu