Real-Time Systems Design1 Priority Inversion When a low-priority task blocks a higher-priority one, a priority inversion is said to occur Assume that priorities:

Slides:



Advertisements
Similar presentations
Real Time Scheduling.
Advertisements

Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Part IV: Memory Management
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 8 SCHEDULING.
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Virtual Memory Operating System Concepts chapter 9 CS 355
Real-Time Kernels and Operating Systems Basic Issue - Purchase commercial “off-the- shelf” system or custom build one Basic Functions –Task scheduling.
 A quantum is the amount of time a thread gets to run before Windows checks.  Length: Windows 2000 / XP: 2 clock intervals Windows Server systems: 12.
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
Chapter 5 Processes and Threads Copyright © 2008.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Operating System. Main goal of OS: –Run programs efficiently –Make the computer easier to use Provide a user-friendly interface –Improve the efficiency.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
CMPT 300: Operating Systems Review THIS REIVEW SHOULD NOT BE USED AS PREDICTORS OF THE ACTUAL QUESTIONS APPEARING ON THE FINAL EXAM.
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
Final Review Monday, May 5th. Functional Components Process Manager: creates/removes processes Scheduler: allocates processes to processors Memory Manager:
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
CS-3013 & CS-502, Summer 2006 Review Topics1 CS-3013 & CS-502 Operating Systems.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
©Brooks/Cole, 2003 Chapter 7 Operating Systems Dr. Barnawi.
Computer Organization and Architecture
1 Virtual Memory Management B.Ramamurthy Chapter 10.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
UCDavis, ecs251 Fall /23/2007ecs251, fall Operating System Models ecs251 Fall 2007 : Operating System Models #3: Priority Inversion Dr. S.
Introduction to Embedded Systems
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
MEMORY MANAGEMENT Presented By:- Lect. Puneet Gupta G.P.C.G. Patiala.
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Introduction to Embedded Systems Rabie A. Ramadan 6.
What Does Real-Time Mean? Main difference to other computation: time time means that correctness of system depends - not only on logical results - but.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
6 Memory Management and Processor Management Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
Chapter 7 Operating Systems. Define the purpose and functions of an operating system. Understand the components of an operating system. Understand the.
30 October Agenda for Today Introduction and purpose of the course Introduction and purpose of the course Organization of a computer system Organization.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
1 Chapter 10 : Case Study - UNIX History Overview Processes Memory management Input/output in The unix file system Security Note: This case study covers.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Introduction to Embedded Systems Rabie A. Ramadan 5.
Challenges in Porting & Abstraction. Getting Locked-In Applications are developed with a particular platform in mind The software is locked to the current.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator –Control program.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Operating Systems: Summary INF1060: Introduction to Operating Systems and Data Communication.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Multiprogramming. Readings r Chapter 2.1 of the textbook.
REAL-TIME OPERATING SYSTEMS
Memory Management.
Chapter 2 Memory and process management
Topics Covered What is Real Time Operating System (RTOS)
ITEC 202 Operating Systems
William Stallings Computer Organization and Architecture
Section 10: Last section! Final review.
Main Memory Management
Page Replacement.
Main Memory Background Swapping Contiguous Allocation Paging
Operating Systems.
Process Description and Control
Major Topics in Operating Systems
COMP755 Advanced Operating Systems
Structure of Processes
Presentation transcript:

Real-Time Systems Design1 Priority Inversion When a low-priority task blocks a higher-priority one, a priority inversion is said to occur Assume that priorities: p1>p2>p3, and tasks 1 and 3 share the same critical resource

Real-Time Systems Design2 Priority Inheritance Protocol In the PIP the priorities of tasks are dynamically changed so that the priority of any task in a critical section gets the priority of the highest task pending on that same critical resource.

Real-Time Systems Design3 Priority Inheritance Protocol

Real-Time Systems Design4 Priority Inheritance Protocol

Real-Time Systems Design5 Priority Ceiling Protocol Each resource is assigned a priority ceiling equal to the priority of the highest priority task that can use it

Real-Time Systems Design6 Priority Ceiling Protocol

Real-Time Systems Design7 Priority Ceiling Protocol

Real-Time Systems Design8 ORIGINAL CEILING PRIORITY PROTOCOL (OCPP) Each process has a static default priority assigned (for example, by deadline monotonic scheme: less deadline – greater priority, or by rate monotonic scheme: less period – greater priority). Each resource has a static ceiling value defined, this is the maximum priority of the processes that use it (assume that greater priority is represented by greater value). A process has a dynamic priority which is the maximum of its own static priority and any it inherits due to it blocking higher-priority processes (when process blocks higher-priority task it gets temporarily this higher priority). A process can only lock a resource if its dynamic priority is higher than the ceiling of any currently locked resource (excluding any that it has already locked).

Real-Time Systems Design9 Original Ceiling Priority Protocol

Real-Time Systems Design10

Real-Time Systems Design11 Memory Management Stack management: Ideally, provision of at least one more task than anticipated should be allocated to the stack to allow for spurious interrupts and time overloading

Real-Time Systems Design12 Memory Management

Real-Time Systems Design13 Swapping A process is saved to an external device when its time expires. The next process is loaded instead Overlays Main(){ a(); b(); c() } This program can be represented as a root segment always resident in memory, and three overlay segments a, b, c Memory required in this case is max(mem_a,mem_b,mem_c) instead of mem_a+mem_b+mem_c

Real-Time Systems Design14 Partitions Static partitions with absolute addresses Number of partitions and the sizes are fixed. Tasks are compiled for the particular partition. There may be a skew in partitions loading Static partitions with relative addresses Number of partitions and the sizes are fixed. Tasks are compiled for any partition, need adjustment. Happens internal fragmentation Dynamic partitions Number of partitions vary, tasks get partition of the necessary size. External fragmentation can occur => garbage collection (de-fragmentation)

Real-Time Systems Design15 De-fragmentation

Real-Time Systems Design16 Virtual Memory Segmented: virtual address = (segment, offset) Address=start(segment)+offset Paged: (page, offset) Address=start(page)+offset Segmented-paged: (segment, page, offset) Address=start(segment)+start(page)+offset Replacement algorithms FIFO, LRU (Least recently used) If we have 4 page memory and is a a page reference string (page 2 is the least and page 8 is the most recently used) then will lead to page thrashing Memory locking, Working sets

Real-Time Systems Design17 I/O Problems Disk fragmentation Contiguous file allocation: place parts of a file in adjacent sectors Elevator algorithm: reorder queries so that they will be served with minimal magnetic head replacement Criteria for RTOS 1.Interrupt latency 2.Number of processes system can maintain 3.Memory for OS 4.Scheduling mechanisms set (round-robin, preemptive, etc) 5.Available communication methods (mutexes, semaphores, etc) 6.After sale support

Real-Time Systems Design18 RTOS Criteria 7.Software development kits available 8.Hardware platforms support 9.Source code availability 10.Task context switch time 11.RTOS cost 12.Compatibility with other RTOS 13.Networks and network protocols supported by RTOS A fitness metric can be

Real-Time Systems Design19

Real-Time Systems Design20

Real-Time Systems Design21 POSIX (Portable Operating System Interface for Computer Environments, IEEE Standard) 1.Threads – each process can contain several threads 2.Mutexes and Condition variables - It is essential to associate a mutex with a condition variable. A thread locks the mutex for some shared data and then checks whether data are in the proper state. If no, the thread waits on the appropriate condition variable. Waiting on the condition variable automatically unlocks the mutex. When some thread puts the data in the proper state, it wake a waiting thread by signaling. One thread comes out of its wait state with the mutex locked

Real-Time Systems Design22 POSIX Semaphores Binary and counting

Real-Time Systems Design23 POSIX Messages

Real-Time Systems Design24 Real-Time POSIX Signals Signals are software representation of interrupts or exception occurrences. No routine should be called from a signal handler that might cause the handler to block. Signals are used for Exception handling Process notification of asynchronous event occurrence Process termination in an abnormal situation Interprocess communication

Real-Time Systems Design25 Real-Time POSIX Signals

Real-Time Systems Design26 Real-Time POSIX Signals

Real-Time Systems Design27 System POSIX Signals

Real-Time Systems Design28 Clocks and Timers Typically the system time is represented by a 32 bit unsigned integer, while tick value (time resolution) is represented by a float-point value If k denotes system tick, and n is the value stored in sys_clock, then the actual time elapsed is kn

Real-Time Systems Design29 POSIX Clocks POSIX allows many clocks to be used by an application. Each clock has its own identifier of type clockid_t. Commonly supported and used identifier is CLOCK_REALTIME that is systemwide clock visible for all processes. Data structure timespec has two fields of the long integer type representing the value in number of seconds since the Epoch (tv_sec) and in nano-seconds (tv_nsec). Epoch started 00:00:

Real-Time Systems Design30 POSIX Clocks

Real-Time Systems Design31 POSIX Timers

Real-Time Systems Design32 POSIX Timers

Real-Time Systems Design33 POSIX Asynchronous Input/Output AIO operations use AIO Control Block aiocb:

Real-Time Systems Design34 POSIX Memory Locking