Presentation is loading. Please wait.

Presentation is loading. Please wait.

Håkan Sundell, Chalmers University of Technology 1 Simple and Fast Wait-Free Snapshots for Real-Time Systems Håkan Sundell Philippas.

Similar presentations


Presentation on theme: "Håkan Sundell, Chalmers University of Technology 1 Simple and Fast Wait-Free Snapshots for Real-Time Systems Håkan Sundell Philippas."— Presentation transcript:

1 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Simple and Fast Wait-Free Snapshots for Real-Time Systems Håkan Sundell Philippas Tsigas Yi Zhang Computing Science Chalmers University of Technology

2 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 2 Schedule Real-Time System Synchronization Algorithm Bounding Experiments Conclusions Future work

3 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 3 Real-Time System Multiprocessor system Interconnection Network Shared memory CPU

4 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 4 Real-Time System Cooperating Tasks Timing constraints Need synchronization –Shared Data Objects In this paper: Atomic Snapshot

5 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 5 Synchronization Synchronization methods –Lock Uses semaphores, spinning, disabling interrupts Negative –Blocking –Priority inversion –Risk of deadlock Positive –Execution time guarantees easy to do Take lock... do operation... Release lock

6 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 6 Synchronization Synchronization methods –Lock-free Retries until not interfered by other operations Usually uses some kind of shared flag variable Write flag with unique value... do operation... Check flag value and maybe retry

7 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 7 Synchronization 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

8 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 8 Synchronization Synchronization methods –Wait-free Uses atomic synchronization primitives Uses shared memory Negative –Complex algorithms –Memory consuming Test&SetCompare&SwapCopyingHelpingAnnouncingSplitoperation???

9 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 9 Synchronization 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

10 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 10 Snapshot Shared variables Read / Write registers Some values are related together

11 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 11 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

12 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 12 Linearizability Atomicity / Linearizability criteria Write cici cjcj t NO t t Write Read Write Read YES cici cici = returned by scanner

13 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 13 Linearizability Atomicity / Linearizability criteria t Write Read cici t Write Read cici NO = returned by scanner

14 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 14 Linearizability If all of those criteria are fulfilled then our snapshot algorithm are linearizable All operations can be transformed into a serial sequence of atomic operations t Read Write titi tjtj tktk ser

15 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 15 Algorithm Wait-Free Snapshot Algorithm –Unbounded memory –Each component represented by an infinite nil- value-initialized array, higher index for more recent values –A global index register where all component writers writes the updated value –The reader scans all component arrays backwards from current position

16 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 16 Algorithm Unbounded Snapshot Protocol t v????wnil v????w v????w c1c1 cici c Snapshotindex ? = previous values / nil w = writer position

17 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 17 Bounding We must recycle the array indexes in some way Keep track of the scanner versus the updaters positions Previous solution by Ermedahl et. al –Synchronized using atomic Test and Set operations

18 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 18 Bounding Solution in real-time systems –Using timing information! int TestAndSet(int *p) atomic { if(!*p) {*p=1;return 1} else {return 0} }

19 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 19 Bounding Assuming system with periodic fixed-priority scheduling Notations from Standard Real-Time Response Time Analysis Use information about –Periods, T –Computation time, C –Response times, R

20 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 20 Bounding Use cyclical buffers Keep track that updater position is always behind the scanner so that new positions are always free

21 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 21 Bounding Needed buffer length is dependent on how fast the updaters is compared to the scanner Each component can have different buffer lengths

22 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 22 Bounding Needed buffer length for component k Can be refined even further where T s is the period for the snapshot task T w is the period for the writer tasks

23 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 23 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

24 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 24 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

25 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 25 Experiments 7 different scenarios ScenarioScan Period (us) Update Period (us) Buffer Length 1500503 2200503 3100503 4 4 5 1006 65020010 75050022

26 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 26 Experiments Scan operation - Average Response Time

27 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 27 Experiments Update operation – Average Response Time

28 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 28 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

29 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 29 Future work Investigations of other wait-free synchronization methods Implementations in RTOS kernels


Download ppt "Håkan Sundell, Chalmers University of Technology 1 Simple and Fast Wait-Free Snapshots for Real-Time Systems Håkan Sundell Philippas."

Similar presentations


Ads by Google