Reactive Multiword Synchronization for Multiprocessors - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Reactive Multiword Synchronization for Multiprocessors

Description:

Reduce contentions. Favor to release words with high contention. When and how far to move back? ... Measure in an efficient way the contentions on the words, ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 22
Provided by: philippa4
Category:

less

Transcript and Presenter's Notes

Title: Reactive Multiword Synchronization for Multiprocessors


1
Reactive Multi-word Synchronization for
Multiprocessors
  • Phuong Hoai Ha
  • Philippas Tsigas

PACT 03, New Orleans, Louisiana Sept. 27th
Oct. 1st, 2003
2
Overview
  • Motivation
  • Synchronization primitives in hardware or in
    software ?
  • Lock-free synchronization
  • Previous works
  • Recursive helping policy
  • Software transactional memory
  • Our contributions
  • Reactive multi-word compare-and-swap operations
  • Results
  • Conclusion

3
Hardware or Software ?
  • Programmers need high-level synchronization
    operations
  • multi-word read-modify-write
  • Hardware systems can support only a limited
    number of synchronization primitives
  • single-word primitives

synchronization primitives
4
Hardware synch. primitives
  • A common hardware synchronization primitive used
    in implementing concurrent data structures is
    compare-and-swap.
  • compareswap( w, old, new)
  • atomically
  • if( w old)
  • w ? new
  • return( true)
  • else return( false)

5
Lock-free synchronization
  • Lock-free implementations guarantee that always
    at least one operation will progress.
  • Example
  • counter0
  • Increment()
  • t counter
  • counter t 1
  • return t

Thread 1
Result 0
Thread 2
Result 0 ?
6
Example (cont.)
  • counter0 lock free
  • Increment()
  • while( testset( lock, busy) ! free)
    //synchronization point
  • t counter
  • counter t 1
  • release( lock)
  • return t

Result 0
Thread 1
waiting
Thread 2
Result 1 ?
7
Example (cont.)
crash
Thread 1
wait forever
Thread 2
  • counter0
  • Increment()
  • do
  • t counter
  • new t 1
  • while( !compareswap( counter, t, new))
    //lock-free
  • return t

8
Is CAS handy enough ?
  • Example inserting cells and deleting cells from
    linked list data structure occur concurrently

t1
t2
? The cell C has not been inserted correctly
9
Overview
  • Motivation
  • Synchronization primitives in hardware or in
    software ?
  • Lock-free synchronization
  • Previous works
  • Recursive helping policy
  • Software transactional memory
  • Our contributions
  • Reactive multi-word compare-and-swap operations
  • Results
  • Conclusion

10
Multi-word compareswap Specifications
  • CASN Atomic read-modify-write to a set of
    locations
  • CASN( ( x1, a1, b1), ( x2, a2, b2), , ( xn,
    an,bn) )
  • atomically
  • if( ( x1 a1) ( xn an)) x1 b1
    xn bn return( true)
  • else return( false)
  • Useful building blocks in the implementations of
    concurrent data structures
  • Many existing designs (queue, stack, etc.) use
    CAS2 directly
  • A higher abstraction like transactions is
    provided

11
Methods
  • Requirements
  • Non-blocking
  • Low contentions

? Use locks again! How non-blocking is it ?
12
Helping technique
  • All threads write down in shared variables what
    they are doing
  • Whenever ti needs a location already locked by
    tj, ti helps tj complete its own work
  • Recursive helping policy (A. Israeli et al)

4
5
3
6
7
8
2
1
...
words
T1( 1, 2, 3, 4)
help T2
T2( 3, 6, x, x)
help T3
T3( 6, 7, 8, x)
13
Helping technique (cont.)
  • Software transactional memory (N. Shavit et al)

4
5
3
6
7
8
2
1
9
...
words
T1( 1, 2, 8, x)
help T2
T2( 2, 3, 5, 6)
T3( 6, 7, 8, 9)
14
Overview
  • Motivation
  • Synchronization primitives in hardware or in
    software ?
  • Lock-free synchronization
  • Previous works
  • Recursive helping policy
  • Software transactional memory
  • Our contributions
  • Reactive multi-word compare-and-swap operations
  • Results
  • Conclusion

15
Reactive CASN
CASNs
RCASN states
RCASN data structure
16
Reactive CASN illustration
? word
? conflict
?
?
?
?
?
?
?
?
?
?
17
First RCASN
When to move back?
  • How to calculate the threshold?
  • Mapping
  • ri blockedi / kepti average contention
  • blockedi ? 1, P-2, kepti ? 1, N-1
  • Threshold r sqrt( (P-2) / (N-1))
  • Competitive ratio c sqrt((P-2)(N-1))
  • Advantages
  • Reduce contentions
  • Favor RCASNs
  • closer to completion
  • with a small number of conflicts

18
Second RCASN
When and how far to move back?
Rules (c.f. thread-based algorithm)
  • Advantages
  • Reduce contentions
  • Favor to release words with high contention.

19
Results from our experiments
20
Conclusions
  • We have presented two reactive, lock-free
    multi-word compare-and-swap that
  • Measure in an efficient way the contentions on
    the words,
  • Reactively decide whether and how many words need
    to be released,
  • Promote the CASN operations with high probability
    of success,
  • Are competitive and run fast.
  • Future work
  • Look into new reactive schemes that allow faster
    reaction and better execution time.
  • Incorporate the algorithms in the NOBLE, a
    library of non-blocking synchronization
    protocols.
  • http//www.noble-library.org

21
Thank you!
Write a Comment
User Comments (0)
About PowerShow.com