Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas...
-
Upload
gregory-higgins -
Category
Documents
-
view
217 -
download
0
Transcript of Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas...
2
Outline
Real-Time System Snapshot Synchronization Methods Algorithm
New version after Bounding Experiments Conclusions
3
Real-Time System
Multiprocessor system Interconnection Network Shared memory Scheduler
Periodic TasksSporadic Tasks
CPUCPU CPUCPU
CPUCPU CPUCPU
4
Snapshot – Shared Data Structure
Shared variables Snapshot
A consistent momentous state of a set of related shared variables
In this paper:• One reader (scanner)
• Reads the whole set of variables in one atomic step
• Many writers (updaters)• Writes to only one variable each time
5
Synchronization
Shared data structures needs synchronization
Synchronization using Locks Mutually exclusive access to whole or parts
of the data structure
P1P2
P3
P1P2
P3
6
Blocking Synchronization
DrawbacksBlockingPriority InversionRisk of deadlock
Locks: Semaphores, spinning, disabling interrupts etc.Reduced efficiency because of
reduced parallelism
7
Non-blocking Synchronization
Lock-Free Synchronization Optimistic approach (i.e. assumes no
interference)1. The operation is prepared to later take effect
(unless interfered) using hardware atomic primitives
2. Possible interference is detected via the atomic primitives, and causes a retry• Can cause starvation
Wait-Free Synchronization The operation always finishes in a finite
number of its own steps.
8
Non-blocking Synchronization
Lock-Free SynchronizationAvoids problems with locks Simple algorithmsFast when having low contention
Wait-Free SynchronizationAlways finishes in a finite number of
its own steps.• Complex algorithms• Memory consuming• Less efficient in average than lock-free
9
Linearizability
For every concurrent execution there should exist an equal and valid sequential execution that respects the partial order of the operations in the concurrent execution
t
Read
Write
WriteTi :
Tj :
Tk :
Sequential :
10
Linearizability for Snapshots
Atomicity / Linearizability criteriaWrite Write
Write
ci
cj tNO
t
t
Write Write
Read
Write Write
Read
YES
YES
ci
ci
= returned by scanner
11
Linearizability for Snapshots
Atomicity / Linearizability criteria
tWrite Write
Read
ci
tWrite Write
Read
ci
NO
NO
= returned by scanner
12
Algorithm
Wait-Free Snapshot Algorithm [Kirousis et al.] Unbounded Memory
tv ? ? ? ? w nil nil
v ? ? ? ? w nil nil
v ? ? ? ? w nil nilc1
ci
cc
Snapshotindex ? = previous values / nilw = writer position
…
…
…
13
Bounding
We must recycle the array indexes in some way
Keep track of the scanner versus the updaters’ positions.
Make sure that the updaters’ positions are always behind the scanner so that new positions are always free
Previous general solution [Ermedahl et al.] Synchronized using atomic Test-and-Set
hardware primitives Single updater per component
14
Bounding in Real-Time Systems
Assuming system with periodic or sporadic tasks
Use notations from Standard Real-Time Response Time Analysis
Use timing information about Periods , T Worst-case Computation time , C Worst-case Response times , R
)(ihpjj
j
iii C
T
RCR - for fixed priority scheduling
15
Bounding in Real-Time Systems
Needed buffer length is dependent on how fast the updaters is compared to the scanner
Each component can have different buffer lengths
16
Bounding in Real-Time Systems
Needed buffer length for component k :
2min
minmax )(
S
SSWkwrik T
RTRl i
where Ts is the period for the scanner taskRw is the response time for the updater tasksRs is the response time for the scanner task
17
Experiments
Using a Sun Enterprise 10000 multiprocessor computer
1 scanner task and 10 updater tasks, one on each cpu
Comparing two wait-free snapshot algorithms Using timing information Using test and set synchronization
18
Experiments
Measuring response time for scan versus update operations
All updaters have the same period All 10 components have the same
buffer lengths for the algorithm using timing information
The algorithm using Test-and-Set synchronization uses a buffer of length 3
19
Experiments
7 different scenariosScenario Scan
Period (s)Update Period (s)
Buffer Length
1 500 50 3
2 200 50 3
3 100 50 3
4 50 50 4
5 50 100 6
6 50 200 10
7 50 500 22
22
Conclusions
Update operation Using timing information gives up to 400 % better
performance Scan operation
Using timing information gives up to 20 % better performance in common practical scenarios
Update operation is much more frequent than Scan Timing information can improve the performance
significantly Simpler algorithm