Presentation is loading. Please wait.

Presentation is loading. Please wait.

Håkan Sundell, Chalmers University of Technology 1 Using Timing Information on Wait-Free Algorithms in Real-Time Systems (2 papers)

Similar presentations


Presentation on theme: "Håkan Sundell, Chalmers University of Technology 1 Using Timing Information on Wait-Free Algorithms in Real-Time Systems (2 papers)"— Presentation transcript:

1 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 1 Using Timing Information on Wait-Free Algorithms in Real-Time Systems (2 papers) 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 Algorithms (Snapshot + Buffer) 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 (with or without constraints) 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 presentation: Atomic Snapshot and Atomic Buffer

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 –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

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

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

13 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 13 Algorithm (Buffer) Constructing an Atomic Buffer N-readers and N-writers Constraints, non-uniform memory Constructing of simple components - register that can be written by processor i and read by processor j

14 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 14 Algorithm Wait-Free Atomic Shared Buffer by Vitanyi et. al A Matrix of 1-reader 1-writer registers... R 21 R 22 … R 11 R 12... Readers Writers R ij - written by i read by j

15 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 15 Algorithm The tag increases with each write operation Unbounded maximum size for the tag field in the value/tag pair Assume 8 writer tasks with 10 ms period –Maximum tag after one hour is 2880000 which needs 22 bits! Memory size is very important, 8 bit computers are still most common

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

17 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 17 Bounding (Snapshot) 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 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

19 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 19 Bounding (Buffer) Recycling of the tags is necessary Timing information is available in real-time systems (J. Chen, A. Burns) Analysing the maximum difference between tags possible observable by a task at two consecutive invocations of the algorithm Using notations from the standard response time analysis for periodic fixed priority scheduling

20 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 20 Bounding In any possible execution: Where –T max is the longest period –R max is the longest response time –T wr is the period of the writer tasks

21 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 21 Bounding Analyse how to recycle the tags Newer tags can restart from zero when we reach a certain tag value In order to be able to decide if newer tags are newer we need to have:

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

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

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

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

26 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 26 Examples (Buffer) Example Task Scenario on 8 processors TaskPeriodTaskPeriod Wr11000Rd1500 Wr2900Rd2450 Wr3800Rd3400 Wr4700Rd4350 Wr5600Rd5300 Wr6500Rd6250 Wr7400Rd7200 Wr8300Rd8150

27 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 27 Examples T max = R max = 1000 MaxTagDiff = 38 TagFieldSize = 76 TagFieldBits = 7 Unbounded algorithm would have reached tag 68400 in one hour, needing >16 bits

28 Håkan Sundell, phs@cs.chalmers.se Chalmers University of Technology 28 Conclusions (Snapshot) 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 Conclusions (Buffer) We have presented an atomic n-reader n- writer shared buffer. Usage of timing information enables us to recycle the tags and thus bound the memory usage The modified algorithm has small space requirements

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


Download ppt "Håkan Sundell, Chalmers University of Technology 1 Using Timing Information on Wait-Free Algorithms in Real-Time Systems (2 papers)"

Similar presentations


Ads by Google