Fakultät für informatik informatik 12 technische universität dortmund Resource Access Protocols Peter Marwedel Informatik 12 TU Dortmund Germany 2008/12/06.

Slides:



Advertisements
Similar presentations
Technische universität dortmund fakultät für informatik informatik 12 Models of computation Peter Marwedel TU Dortmund Informatik 12 Graphics: © Alexandra.
Advertisements

Fakultät für informatik informatik 12 technische universität dortmund Optimizations - Compilation for Embedded Processors - Peter Marwedel TU Dortmund.
1 Concurrency: Deadlock and Starvation Chapter 6.
Technische universität dortmund fakultät für informatik informatik 12 Specifications and Modeling Peter Marwedel TU Dortmund, Informatik 12 Graphics: ©
fakultät für informatik informatik 12 technische universität dortmund Additional compiler optimizations Peter Marwedel TU Dortmund Informatik 12 Germany.
Evaluation and Validation
Fakult ä t f ü r informatik informatik 12 technische universit ä t dortmund Data flow models Peter Marwedel TU Dortmund, Informatik 12 Graphics: © Alexandra.
Fakultät für informatik informatik 12 technische universität dortmund Specifications and Modeling Peter Marwedel TU Dortmund, Informatik 12 Graphics: ©
Fakultät für informatik informatik 12 technische universität dortmund Standard Optimization Techniques Peter Marwedel Informatik 12 TU Dortmund Germany.
Fakultät für informatik informatik 12 technische universität dortmund SDL Peter Marwedel TU Dortmund, Informatik 12 Graphics: © Alexandra Nolte, Gesine.
Technische universität dortmund fakultät für informatik informatik 12 Specifications and Modeling Peter Marwedel TU Dortmund, Informatik
Concurrency control 1. 2 Introduction concurrency more than one transaction have access to data simultaneously part of transaction processing.
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
fakultät für informatik informatik 12 technische universität dortmund Optimizations - Compilation for Embedded Processors - Peter Marwedel TU Dortmund.
Chapter 1 Introduction Copyright © Operating Systems, by Dhananjay Dhamdhere Copyright © Introduction Abstract Views of an Operating System.
Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
Real Time Scheduling.
Real Time Versions of Linux Operating System Present by Tr n Duy Th nh Quách Phát Tài 1.
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Priority Inheritance and Priority Ceiling Protocols
Washington WASHINGTON UNIVERSITY IN ST LOUIS Resource and Resource Access Control Fred Kuhns Applied Research Laboratory Computer Science and Engineering.
Outline Introduction Assumptions and notations
Introduction to Embedded Systems Resource Management - III Lecture 19.
Priority Inversion BAE5030 Advanced Embedded Systems 9/13/04.
Real-time Embedded Systems Complex RMS and deadline monotonic scheduling.
Priority INHERITANCE PROTOCOLS
Operating Systems: Monitors 1 Monitors (C.A.R. Hoare) higher level construct than semaphores a package of grouped procedures, variables and data i.e. object.
Processes Management.
Executional Architecture
Global Analysis and Distributed Systems Software Architecture Lecture # 5-6.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 14: Simulations 1.
Fakultät für informatik informatik 12 technische universität dortmund Lab 3: Scheduling Solution - Session 10 - Heiko Falk TU Dortmund Informatik 12 Germany.
Håkan Sundell, Chalmers University of Technology 1 Evaluating the performance of wait-free snapshots in real-time systems Björn Allvin.
Technische universität dortmund fakultät für informatik informatik 12 Specifications, Modeling, and Model of Computation Jian-Jia Chen (slides are based.
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 8 SCHEDULING.
Hardware/ Software Partitioning 2011 年 12 月 09 日 Peter Marwedel TU Dortmund, Informatik 12 Germany Graphics: © Alexandra Nolte, Gesine Marwedel, 2003 These.
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
0 Synchronization Problem Resource sharing –Requires mutual exclusion –Critical section A code section that should be executed mutually exclusively by.
CS5270 Lecture 31 Uppaal, and Scheduling, and Resource Access Protocols CS 5270 Lecture 3.
Resource Access Protocols
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Resource Access Control Protocols.
Interprocess Communication
Universität Dortmund Middleware Peter Marwedel TU Dortmund, Informatik 12 Germany Graphics: © Alexandra Nolte, Gesine Marwedel, 2003 These slides use Microsoft.
Embedded & Real-time Operating Systems Peter Marwedel TU Dortmund, Informatik 12 Germany Graphics: © Alexandra Nolte, Gesine Marwedel, 2003 These slides.
UCDavis, ecs150 Fall /23/2007ecs150, fall Operating System ecs150 Fall 2007 : Operating System #3: Priority Inversion (a paper on the class.
UCDavis, ecs150 Spring /21/2006ecs150, spring Operating System ecs150 Spring 2006 : Operating System #3: Priority Inversion (paper) Dr. S.
Fakultät für informatik informatik 12 technische universität dortmund Universität Dortmund Middleware Peter Marwedel TU Dortmund, Informatik 12 Germany.
Fakultät für informatik informatik 12 technische universität dortmund Classical scheduling algorithms for periodic systems Peter Marwedel TU Dortmund,
UCDavis, ecs251 Fall /23/2007ecs251, fall Operating System Models ecs251 Fall 2007 : Operating System Models #3: Priority Inversion Dr. S.
Introduction to Embedded Systems
Universität Dortmund Technische Universität Dortmund Embedded & Real-time Operating Systems Peter Marwedel TU Dortmund, Germany.
1 Announcements The fixing the bug part of Lab 4’s assignment 2 is now considered extra credit. Comments for the code should be on the parts you wrote.
Embedded & Real-time Operating Systems Peter Marwedel TU Dortmund, Informatik 12 Germany 2012 年 11 月 27 日 These slides use Microsoft clip arts. Microsoft.
Deadlocks Silberschatz Ch. 7 and Priority Inversion Problems.
© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems Operating systems. 1.
Kernel Locking Techniques by Robert Love presented by Scott Price.
15-410, F’ Scheduling on Mars Oct. 29, 2004 Dave Eckhardt Bruce Maggs L22b_Mars “Delayed Impact”
Deadlock Detection and Recovery
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Periodic scheduling For periodic scheduling, the best that we can do is to.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Introduction to Embedded Systems Rabie A. Ramadan 5.
Lab 4 : Real-Time OS Team #7 P 李彥勳 P 謝嵩淮 R 侯凱文.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
REAL-TIME OPERATING SYSTEMS
RTOS Scheduling 2.0 Problems - Solutions
Scheduling and Resource Access Protocols: Basic Aspects
Embedded & Real-time Operating Systems
First slide Rest of project 2 due next Friday Today:
Presentation transcript:

fakultät für informatik informatik 12 technische universität dortmund Resource Access Protocols Peter Marwedel Informatik 12 TU Dortmund Germany 2008/12/06 Graphics: © Alexandra Nolte, Gesine Marwedel, 2003

- 2 - technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Structure of this course New clustering 2: Specifications 3: Embedded System HW 4: Standard Software, Real- Time Operating Systems 5: Scheduling, HW/SW-Partitioning, Applications to MP- Mapping 6: Evaluation 8: Testing 7: Optimization of Embedded Systems Application Knowledge

- 3 - technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Resource access protocols Critical sections: sections of code at which exclusive access to some resource must be guaranteed. Can be guaranteed with semaphores S or mutexes. P(S) V(S) P(S) V(S) P(S) checks semaphore to see if resource is available and if yes, sets S to used. Uninterruptible operations! If no, calling task has to wait. V(S): sets S to unused and starts sleeping task (if any). P(S) checks semaphore to see if resource is available and if yes, sets S to used. Uninterruptible operations! If no, calling task has to wait. V(S): sets S to unused and starts sleeping task (if any). Mutually exclusive access to resource guarded by S Task 1 Task 2

- 4 - technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Priority inversion Priority T 1 assumed to be > than priority of T 2. If T 2 requests exclusive access first (at t 0 ), T 1 has to wait until T 2 releases the resource (time t 3 ), thus inverting the priority: In this example: duration of inversion bounded by length of critical section of T 2.

- 5 - technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Duration of priority inversion with >2 tasks can exceed the length of any critical section Priority of T1 > priority of T2 > priority of T3. T2 preempts T3: T2 can prevent T3 from releasing the resource. critical sectionnormal execution

- 6 - technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund

- 7 - technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund The MARS Pathfinder problem (1) But a few days into the mission, not long after Pathfinder started gathering meteorological data, the spacecraft began experiencing total system resets, each resulting in losses of data. The press reported these failures in terms such as "software glitches" and "the computer was trying to do too many things at once". …

- 8 - technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund The MARS Pathfinder problem (2) VxWorks provides preemptive priority scheduling of threads. Tasks on the Pathfinder spacecraft were executed as threads with priorities that were assigned in the usual manner reflecting the relative urgency of these tasks. Pathfinder contained an "information bus", which you can think of as a shared memory area used for passing information between different components of the spacecraft. A bus management task ran frequently with high priority to move certain kinds of data in and out of the information bus. Access to the bus was synchronized with mutual exclusion locks (mutexes).

- 9 - technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund The MARS Pathfinder problem (3) The meteorological data gathering task ran as an infrequent, low priority thread, … When publishing its data, it would acquire a mutex, do writes to the bus, and release the mutex... The spacecraft also contained a communications task that ran with medium priority. High priority: retrieval of data from shared memory Medium priority: communications task Low priority: thread collecting meteorological data

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund The MARS Pathfinder problem (4) Most of the time this combination worked fine. However, very infrequently it was possible for an interrupt to occur that caused the (medium priority) communications task to be scheduled during the short interval while the (high priority) information bus thread was blocked waiting for the (low priority) meteorological data thread. In this case, the long-running communications task, having higher priority than the meteorological task, would prevent it from running, consequently preventing the blocked information bus task from running. After some time had passed, a watchdog timer would go off, notice that the data bus task had not been executed for some time, conclude that something had gone drastically wrong, and initiate a total system reset. This scenario is a classic case of priority inversion.

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Coping with priority inversion: the priority inheritance protocol Tasks are scheduled according to their active priorities. Tasks with the same priorities are scheduled FCFS. If task T1 executes P(S) & exclusive access granted to T2: T1 will become blocked. If priority(T2) < priority(T1): T2 inherits the priority of T1. T2 resumes. Rule: tasks inherit the highest priority of tasks blocked by it. When T2 executes V(S), its priority is decreased to the highest priority of the tasks blocked by it. If no other task blocked by T2: priority(T2):= original value. Highest priority task so far blocked on S is resumed. Transitive: if T2 blocks T1 and T1 blocks T0, then T2 inherits the priority of T0.

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Example T3 inherits the priority of T1 and T3 resumes. How would priority inheritance affect our example with 3 tasks? V(S)

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund P(b) P(a) V(a)V(b) V(a) V(b) P(b)P(a) [P/V

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund P(a) P(b) V(a) P(a) P(b) V(b) V(a) [P/V

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Priority inversion on Mars Priority inheritance also solved the Mars Pathfinder problem: the VxWorks operating system used in the pathfinder implements a flag for the calls to mutex primitives. This flag allows priority inheritance to be set to on. When the software was shipped, it was set to off. The problem on Mars was corrected by using the debugging facilities of VxWorks to change the flag to on, while the Pathfinder was already on the Mars [Jones, 1997].

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Remarks on priority inheritance protocol Possible large number of tasks with high priority. Possible deadlocks. Ongoing debate about problems with the protocol: Victor Yodaiken: Against Priority Inheritance, Sept. 2004, Finds application in ADA: During rendez-vous, task priority is set to the maximum. More sophisticated protocol: priority ceiling protocol.

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Impact on access methods for remote objects Software packages for access to remote objects; Example: CORBA (Common Object Request Broker Architecture). Information sent to Object Request Broker (ORB) via local stub. ORB determines location to be accessed and sends information via the IIOP I/O protocol. Access times not predictable.

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Real-time (RT-) CORBA A very essential feature of RT-CORBA is to provide end-to-end predictability of timeliness in a fixed priority system. This involves respecting thread priorities between client and server for resolving resource contention, and bounding the latencies of operation invocations. Thread priorities might not be respected when threads obtain mutually exclusive access to resources (priority inversion). RT-CORBA includes provisions for bounding the time during which such priority inversion can happen.

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Real-time CORBA - Thread priority management - RT-CORBA includes facilities for thread priority management. Priority independent of the priorities of the underlying OS, even though it is compatible with the RT-extensions of the POSIX standard for OSs [Harbour, 1993]. The thread priority of clients can be propagated to the server side. Priority management for primitives for mutually exclusive access to resources. Priority inheritance protocol must be available in implementations of RT-CORBA. Pools of preexisting threads avoid the overhead of thread creation and thread-construction.

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Similar issues for message passing interface (MPI) Message passing interface (MPI): alternative to CORBA MPI/RT: a real-time version of MPI [MPI/RT forum, 2001]. MPI-RT does not cover issues such as thread creation and termination. MPI/RT is conceived as a potential layer between the operating system and standard (non real-time) MPI.

technische universität dortmund fakultät für informatik p. marwedel, informatik 12, 2008 TU Dortmund Summary Priority inversion is a (nasty) effect resulting from the combination of preemptive scheduling with mutual exclusion. Protocols such as the priority inheritance protocol (PIP) avoid some problems resulting from priority inheritance. However, PIP adds some complexity to the software and, ideally, we would prefer not to have to care about this effect (e.g. by using a dataflow model of computation).