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

Slides:



Advertisements
Similar presentations
Symmetric Multiprocessors: Synchronization and Sequential Consistency.
Advertisements

1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Priority INHERITANCE PROTOCOLS
Fast and Lock-Free Concurrent Priority Queues for Multi-Thread Systems Håkan Sundell Philippas Tsigas.
Operating Systems Part III: Process Management (Process Synchronization)
Håkan Sundell, Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin.
Synchronization. How to synchronize processes? – Need to protect access to shared data to avoid problems like race conditions – Typical example: Updating.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: Process Synchronization
Background Concurrent access to shared data can lead to inconsistencies Maintaining data consistency among cooperating processes is critical What is wrong.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Multiprocessor Synchronization Algorithms ( ) Lecturer: Danny Hendler The Mutual Exclusion problem.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Interprocess Communication
Scalable and Lock-Free Concurrent Dictionaries
Wait-Free Reference Counting and Memory Management Håkan Sundell, Ph.D.
Håkan Sundell, Chalmers University of Technology 1 Space Efficient Wait-free Buffer Sharing in Multiprocessor Real-time Systems Based.
Informationsteknologi Wednesday, September 26, 2007 Computer Systems/Operating Systems - Class 91 Today’s class Mutual exclusion and synchronization 
Avishai Wool lecture Introduction to Systems Programming Lecture 4 Inter-Process / Inter-Thread Communication.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Process Synchronization.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
1 Lock-Free Linked Lists Using Compare-and-Swap by John Valois Speaker’s Name: Talk Title: Larry Bush.
Practical and Lock-Free Doubly Linked Lists Håkan Sundell Philippas Tsigas.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings 1.
Parallel Programming Philippas Tsigas Chalmers University of Technology Computer Science and Engineering Department © Philippas Tsigas.
Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Håkan Sundell, Chalmers University of Technology 1 Using Timing Information on Wait-Free Algorithms in Real-Time Systems (2 papers)
Håkan Sundell, Chalmers University of Technology 1 NOBLE: A Non-Blocking Inter-Process Communication Library Håkan Sundell Philippas.
Håkan Sundell, Chalmers University of Technology 1 Applications of Non-Blocking Data Structures to Real-Time Systems Seminar for the.
6.3 Peterson’s Solution The two processes share two variables: Int turn; Boolean flag[2] The variable turn indicates whose turn it is to enter the critical.
The Performance of Spin Lock Alternatives for Shared-Memory Multiprocessors THOMAS E. ANDERSON Presented by Daesung Park.
Midterm 1 – Wednesday, June 4  Chapters 1-3: understand material as it relates to concepts covered  Chapter 4 - Processes: 4.1 Process Concept 4.2 Process.
Challenges in Non-Blocking Synchronization Håkan Sundell, Ph.D. Guest seminar at Department of Computer Science, University of Tromsö, Norway, 8 Dec 2005.
Non-blocking Data Structures for High- Performance Computing Håkan Sundell, PhD.
Maged M.Michael Michael L.Scott Department of Computer Science Univeristy of Rochester Presented by: Jun Miao.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 Contention Management and Obstruction-free Algorithms Niloufar Shafiei.
Chapter 6 – Process Synchronisation (Pgs 225 – 267)
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Wait-Free Multi-Word Compare- And-Swap using Greedy Helping and Grabbing Håkan Sundell PDPTA 2009.
Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure the orderly execution.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-5 Process Synchronization Department of Computer Science and Software.
Operating Systems CSE 411 CPU Management Dec Lecture Instructor: Bhuvan Urgaonkar.
CS510 Concurrent Systems Jonathan Walpole. RCU Usage in Linux.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
CSCI1600: Embedded and Real Time Software Lecture 17: Concurrent Programming Steven Reiss, Fall 2015.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Process Synchronization.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Process Synchronization
Process Synchronization: Semaphores
Background on the need for Synchronization
Håkan Sundell Philippas Tsigas
A Lock-Free Algorithm for Concurrent Bags
Anders Gidenstam Håkan Sundell Philippas Tsigas
Topic 6 (Textbook - Chapter 5) Process Synchronization
Semaphore Originally called P() and V() wait (S) { while S <= 0
Module 7a: Classic Synchronization
Lecture 2 Part 2 Process Synchronization
NOBLE: A Non-Blocking Inter-Process Communication Library
CSCI1600: Embedded and Real Time Software
Chapter 6: Synchronization Tools
CSCI1600: Embedded and Real Time Software
CSE 542: Operating Systems
Presentation transcript:

Håkan Sundell, 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

Håkan Sundell, Chalmers University of Technology 2 Schedule Real-Time System Synchronization Algorithm Bounding Experiments Conclusions Future work

Håkan Sundell, Chalmers University of Technology 3 Real-Time System Multiprocessor system Interconnection Network Shared memory CPU

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

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, 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???

Håkan Sundell, 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

Håkan Sundell, Chalmers University of Technology 10 Snapshot Shared variables Read / Write registers Some values are related together

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, Chalmers University of Technology 13 Linearizability Atomicity / Linearizability criteria t Write Read cici t Write Read cici NO = returned by scanner

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, 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} }

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, 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

Håkan Sundell, Chalmers University of Technology 23 Experiments Using a Sun Enterprise 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

Håkan Sundell, 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

Håkan Sundell, Chalmers University of Technology 25 Experiments 7 different scenarios ScenarioScan Period (us) Update Period (us) Buffer Length

Håkan Sundell, Chalmers University of Technology 26 Experiments Scan operation - Average Response Time

Håkan Sundell, Chalmers University of Technology 27 Experiments Update operation – Average Response Time

Håkan Sundell, 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

Håkan Sundell, Chalmers University of Technology 29 Future work Investigations of other wait-free synchronization methods Implementations in RTOS kernels