håkan sundell, [email protected] chalmers university of technology 1 evaluating the performance of...
TRANSCRIPT
![Page 1: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/1.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
1
Evaluating the performance of wait-free snapshots in real-time
systemsBjörn Allvin
Andreas Ermedahl
Hans Hansson
Marina Papatriantafilou
Håkan Sundell
Philippas Tsigas
![Page 2: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/2.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
2
Schedule
• What are we evaluating
• How did we do the evaluation
• Evaluation platform
• Analysis
• Experiments
• Conclusions
• Future work
![Page 3: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/3.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
3
• Snapshot– A consistent momentous state of a set of several
shared variables– One reader
• Reads the whole set of variables in one atomic step
– Many writers• Writes to only one variable each time
What are we evaluating
![Page 4: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/4.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
4
What are we evaluating
• Synchronization methods– Lock
• Uses semaphores, spinning, disabling interrupts
• Negative– Blocking
– Priority inversion
– Risk of deadlock
• Positive– Execution time guarantees easy to do
Take lockTake lock
... do operation ...... do operation ...
Release lockRelease lock
![Page 5: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/5.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
5
What are we evaluating
• Synchronization methods– Lock-free
• Retries until not interfered by other operations
• Usually uses some kind of shared flag variable
Write flagWrite flag
... do operation ...... do operation ...
Check flag and maybe retryCheck flag and maybe retry
![Page 6: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/6.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
6
What are we evaluating
• Synchronization methods– Lock-free
• Negative– No execution time guarantees, can continue forever - thus
can cause starvation
• Positive– Avoids blocking and priority inversion
– Avoids deadlock
– Fast execution when low contention
![Page 7: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/7.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
7
What are we evaluating
• Synchronization methods– Wait-free
• Uses atomic synchronization primitives
• Uses shared memory
• Negative– Complex algorithms
– Memory consuming
Test&SetTest&Set
CompareCompare&Swap&Swap
CopyingCopying
HelpingHelping
AnnouncingAnnouncing
SplitSplitoperationoperation
??????
![Page 8: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/8.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
8
What are we evaluating
• Synchronization methods– Wait-free
• Positive– Execution time guarantees
– Fast execution
– Avoids blocking and priority inversion
– Avoids deadlock
– Avoids starvation
– Same implementation on both single- and multiprocessor systems
![Page 9: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/9.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
9
What are we evaluating
• Wait-free snapshot algorithm– Several register copies– Uses Test&Set for synchronization
Used by writerUsed by writer
Used by readerUsed by reader
![Page 10: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/10.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
10
How did we do the evaluation
• Analytically– Single-processor system– Measured schedulability
![Page 11: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/11.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
11
How did we do the evaluation
• Experimentally– Single-processor system
• Measured schedulability
– Multi-processor system with CAN-bus• Measured snapshot response time
![Page 12: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/12.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
12
Evaluation platform
• Hardware– CAN-bus , 1 Mhz– Nodes
• 1 processor , Motorola 68020 , 20 MHz
• Single wait-state memory
• CAN-controller
![Page 13: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/13.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
13
Evaluation platform
• Software– RTOS– Device tasks (interrupts)– Updater tasks– Local snapshot tasks– System snapshot task
![Page 14: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/14.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
14
Evaluation platform
• Additional parameters– Snapshot algorithm timings from WCET
analysis• Cross-compiling
• Cycle counting
– CAN-bus timing from estimation
![Page 15: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/15.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
15
Analysis
• Parameters– 10 tasks– 15 devices– Snapshot of 5 components
![Page 16: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/16.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
16
Analysis
• Response time formulas
RRii CCii CCjjRRii
TTjj
==jjhp(i)hp(i)
++
......
......
![Page 17: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/17.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
17
Analysis
• Generation of 100 random scenarios for each of 31 different CPU loads
• Each scenario schedulable without any synchronization method
![Page 19: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/19.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
19
Experiments
• Simulation– RT-simulator in Erlang
• Fixed priority preemptive scheduler
• Execution time
• Semaphores
• Memory
• Messages
![Page 20: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/20.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
20
Experiments
• Single-node– Parameters
• 10 tasks
• 15 devices
• Snapshot of 5 components
![Page 21: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/21.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
21
Experiments
• Single-node– Simulator programming
• Using subset of scenarios used for the analysis
• Lock– Execution and semaphores
• Lock-free– Execution and shared memory
• Wait-free– Execution
![Page 22: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/22.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
22
Experiments
• Single-node– Results
![Page 23: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/23.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
23
Experiments
• Multi-node– CAN-simulation
• Sending– Execution
• Receiving– Execution of highest priority task
– Execution
![Page 24: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/24.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
24
Experiments
• Multi-node– Parameters
• 10 nodes
• 10 tasks on each node
• 15 devices on each node
• Local snapshot of 24 components on each node
• 1 super snapshot task on last node
![Page 25: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/25.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
25
Experiments
• Multi-node– Simulator programming
• Using subset of scenarios used for the analysis
• Lock– Execution, semaphores and messages
• Lock-free– Execution, shared memory and messages
• Wait-free– Execution and messages
![Page 26: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/26.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
26
Experiments
• Multi-node– Results
![Page 27: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/27.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
27
Experiments
• Multi-node– Results
![Page 28: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/28.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
28
Conclusions
• Wait-free is always better than lock
• Lock-free mostly performs better than lock – Single-node
• Lock-free performs best in practice
• Wait-free performs very good
– Multi-node• Lock-free performs poor
• Wait-free performs best
![Page 29: Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin](https://reader035.vdocuments.net/reader035/viewer/2022070308/551bf93f550346a34f8b4822/html5/thumbnails/29.jpg)
Håkan Sundell, [email protected]
Chalmers University of Technology
29
Future work
• Investigations of other wait-free synchronization methods
• Implementations in RTOS kernels, by Enea and NRTG
• WARPing project - http://www.cs.chalmers.se/~phs/warp