Top Banner
Simple Wait-Free Snapshots for Real- Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas
23

Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

Dec 28, 2015

Download

Documents

Gregory Higgins
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks

Håkan Sundell

Philippas Tsigas

Page 2: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

2

Outline

Real-Time System Snapshot Synchronization Methods Algorithm

New version after Bounding Experiments Conclusions

Page 3: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

3

Real-Time System

Multiprocessor system Interconnection Network Shared memory Scheduler

Periodic TasksSporadic Tasks

CPUCPU CPUCPU

CPUCPU CPUCPU

Page 4: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 5: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 6: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

6

Blocking Synchronization

DrawbacksBlockingPriority InversionRisk of deadlock

Locks: Semaphores, spinning, disabling interrupts etc.Reduced efficiency because of

reduced parallelism

Page 7: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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.

Page 8: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 9: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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 :

Page 10: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 11: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

11

Linearizability for Snapshots

Atomicity / Linearizability criteria

tWrite Write

Read

ci

tWrite Write

Read

ci

NO

NO

= returned by scanner

Page 12: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 13: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 14: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 15: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 16: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 17: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 18: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 19: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 20: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

20

Experiments

Page 21: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

21

Experiments

Page 22: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

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

Page 23: Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.

23

Questions?

Contact Information: Address:

Håkan Sundell vs. Philippas TsigasComputing ScienceChalmers University of Technology

Email:<phs , tsigas> @ cs.chalmers.se

Web: http://www.cs.chalmers.se/~phs/warp