RTOS Concepts and Defn From Pseudokernels to Operating Systems

Slides:



Advertisements
Similar presentations
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 8 SCHEDULING.
Advertisements

A Sample RTOS Presentation 4 Group A4: Sean Hudson, Manasi Kapadia Syeda Taib.
Real-Time Library: RTX
Real-Time Kernels and Operating Systems Basic Issue - Purchase commercial “off-the- shelf” system or custom build one Basic Functions –Task scheduling.
© Copyright 2004 Dr. Phillip A. Laplante 1 Kernel Architectures  Polled Loop  Synchronized Polled Loop  State-Based Model  Cyclic Executives  Foreground/Background.
CENG 324 Embedded Computer Systems Lecture 3 General Concepts of RTOS (Real-Time Operating System) Asst. Prof. Tolga Ayav, Ph.D. Department of Computer.
CMPE-443 Real-Time Systems Design1 Real-Time Operating Systems Real-Time Kernels Theoretical Foundations of RTOS Intertask Communication & Synchronization.
Chapter 3: CPU Scheduling
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
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.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
© Copyright 2004 Dr. Phillip A. Laplante 1 Real-time operating systems: I  Operating systems taxonomy  Pseudo-kernels  Interrupt driven systems  Preemptive.
MicroC/OS-II Embedded Systems Design and Implementation.
Performance Evaluation of Real-Time Operating Systems
Advanced Embedded Systems Design Pre-emptive scheduler BAE 5030 Fall 2004 Roshani Jayasekara Biosystems and Agricultural Engineering Oklahoma State University.
Introduction to Embedded Systems
Real-Time Kernel (Part 1)
Chapter 6: CPU Scheduling
1 EE514 – Real-Time Computing Basic Concepts on Real-Time Systems EE514 – Real-Time Computing Basic Concepts of Real-Time Systems Department of Electrical.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Introduction to Embedded Systems Rabie A. Ramadan 6.
Chapter 6 Scheduling. Basic concepts Goal is maximum utilization –what does this mean? –cpu pegged at 100% ?? Most programs are I/O bound Thus some other.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
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:
What Does Real-Time Mean? Main difference to other computation: time time means that correctness of system depends - not only on logical results - but.
Scheduling policies for real- time embedded systems.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
Real Time Operating Systems Michael Thomas Date: Rev. 1.00Date.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
Real Time Operating Systems Lecture 4 1MHA,2015,AAiT.
Unit - I Real Time Operating System. Content : Operating System Concepts Real-Time Tasks Real-Time Systems Types of Real-Time Tasks Real-Time Operating.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Real-Time Operating Systems RTOS For Embedded systems.
SE3910 Week 8, Class 3 Week 4 Lab: Please return your graded Lab 4 to me so I can enter it in my gradebook Week 9 Lab: Individual demos of working sub-modules.
Advanced Operating Systems CIS 720
Real time systems RTS Engineering.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
RTS: Kernel Design and Cyclic Executives
Real-time Software Design
RTS: Kernel Design and Cyclic Executives
Process management Information maintained by OS for process management
An Embedded Software Primer
Chapter 6: CPU Scheduling
Operating System Concepts
RTS: Kernel Design 11/30/2018.
CSCI1600: Embedded and Real Time Software
RTS: Kernel Design and Cyclic Executives
RTS: Kernel Design 1/2/2019.
RTS: Kernel Design and Cyclic Executives
RTS: Kernel Design and Cyclic Executives
CSCI1600: Embedded and Real Time Software
Process.
Real-Time Process Scheduling Concepts, Design and Implementations
Real-Time Process Scheduling Concepts, Design and Implementations
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

RTOS Concepts and Defn From Pseudokernels to Operating Systems Miscellaneous Pseudokernels Interrupt-Only Systems Preemptive Priority Systems Hybrid Scheduling Systems The Task Control Block Model Theoretical Foundations of   Scheduling Scheduling Framework Round-Robin Scheduling Cyclic Code Scheduling Fixed-Priority Scheduling: Rate-Monotonic Approach Dynamic Priority Scheduling: Earliest Deadline First Approach System Services for Application Programs Linear Buffers Ring Buffers Mailboxes Semaphores Deadlock and Starvation Problems Priority Inversion Problem

Process Abstraction of running program The logical unit schedule to be executed by OS Represented by data strcuture State Identity Attributes (exe time) Resources

RTOS functionality Process Provided by the OS kernel Schedule Dispatch Intercommunication & Synch Provided by the OS kernel

Illustrates real-time executive is a kernel that includes privatized memory blocks, I/O services, and other complex features. Most commercial real-time kernels are executives

Pseudokernel Polled loop- a single and a repetitive instruction is used to test a flag that indicates whether or not some event has occurred. If the event has not occurred, then the polling continues for(;;) { /* do forever */ if (packet_here) /* check flag */ { process_data(); /* process data */ packet_here=0; /* reset flag */ }

Synchronized Polled Loop Such a system is used to treat events that exhibit switch bounce for(;;) { /* do forever */ if(flag) /* check flag */ { pause(20); /* wait 20 ms */ process_event(); /* process event */ flag=0; /* reset flag */ }

Cyclic Executives for(;;) { /* do forever */ Process_1(); Process_2(); Cyclic executives are noninterrupt-driven systems that can provide the illusion of simultaneity by taking advantage of relatively short processes on a fast processor in a continuous loop. for(;;) { /* do forever */ Process_1(); Process_2(); ... Process_N(); } for(;;) { /* do forever */ Process_1(); Process_2(); Process_3(); }

State-Driven Code uses nested if–then statements,case statements, to break up the processing of functions into code segments. The separation of processes allows each to be temporarily suspended before completion, without loss of critical data State-driven code works well in conjunction with cyclic executives when the processes are too long or non-uniform in size Not all processes lend themselves naturally to division into states; some processes are therefore unsuitable for this technique.

Coroutines

Interrupt Driven The various tasks in the system are scheduled via either hardware or software interrupts, whereas dispatching is performed by the interrupt-handling routines. Interrupt Service Routines Hardware Interrupt A signal generated by a peripheral device and sent to the CPU. In turn, the CPU executes an interrupt service routine (ISR), which takes action in response to the interrupt. Software Interrupt Similar to the hardware interrupt, in that it causes one code module to pass control to another.

Reentrant code can execute simultaneously in two or more contexts Reentrant code can execute simultaneously in two or more contexts. An ISR is said to be reentrant if, while the ISR is handling an interrupt, the same interrupt can occur again and the ISR can process the second occurrence of the interrupt before it has finished processing the first. Context Switching Context switching is the process of saving and restoring sufficient information for a real-time task so that it can be resumed after being interrupted. The context is ordinarily saved to a stack data structure. Context-switching time is a major contributor to response time and therefore must be minimized. The rule for saving context is simple: save the minimum amount of information necessary to safely restore any process after it has been interrupted. This information ordinarily includes Contents of general registers Contents of the program counter Contents of coprocessor registers (if present) Memory page register Images of memory-mapped I/O locations (mirror images)

void main(void) { /. initialize system, load interrupt handlers void main(void) { /*initialize system, load interrupt handlers */ init(); while(TRUE); /* infinite wait loop */ } void intl (void) { /* interrupt handler 1 */ save(context); /* save context on stack */ task1(); /* execute task 1 */ restore(context); /* restore context from stack */ } void int2(void) { /* interrupt handler 2 */ task2(); /* execute task 2 */ restore(context); /* restore context from stack */} void int3(void) { /* interrupt handler 3 */ task3(); /* execute task 3 */

Preemptive-Priority Systems A higher-priority task is said to preempt a lower-priority task if it interrupts the lower-priority task. The priorities assigned to each interrupt are based on the urgency of the task associated with the interrupt. Prioritized interrupts can be either fixed priority or dynamic priority. Fixed priority systems are less flexible, since the task priorities cannot be changed. (Rate/Deadline Monotonic) Dynamic-priority systems can allow the priority of tasks to be adjusted at runtime to meet changing process demands. ( Earliest Deadline First)

Hybrid System Hybrid systems include interrupts that occur at both fixed rates and sporadically. The sporadic interrupts can be used to handle a critical error that requires immediate attention, and thus have highest priority. This type of system is common in embedded applications Another type of hybrid system found in commercial operating systems is a combination of round-robin and preemptive systems.

Types of Hybrid System Foreground/Background Systems Foreground/background systems are an improvement over the interrupt-only systems in that the polled loop is replaced by code that performs useful processing. Foreground/background systems are the most common architecture for embedded applications. They involve a set of interrupt-driven or real-time processes called the foreground and a collection of noninterrupt-driven processes called the background. The foreground tasks run in round-robin, preemptive priority, or hybrid fashion. The background task is fully preemptable by any foreground task and, in a sense, represents the lowest priority task in the system.

..cont All real-time solutions are just special cases of the foreground/ background systems. For example, the polled loop is simply a foreground/background system with no foreground, and a polled loop as a background. Adding interrupts for synchronization yields a full foreground/ background system. State-driven code is a foreground/background system with no foreground and phase-driven code for a background. Coroutine systems are just a complicated background process. Finally, interrupt-only systems are foreground/ background systems without background processing.

The Task-Control Block Model The task-control block model is the most popular method for implementing commercial, full-featured, real-time operating systems because the number of real-time tasks can vary. This architecture is used in interactive on-line systems where tasks (associated with users) come and go. Implement thru data structure, called a task control block. This data structure contains at least a PC, register contents, an identification string or number, a status, and a priority if applicable. The system stores these TCBs in one or more data structures, such as a linked list. Task State, Task Management, Resource Management

RTOS Theory Process State

Process Schuduling In order to meet a program’s timing requirements in real-time systems a strategy is needed for ordering the use of system resources, and a mechanism needed for predicting the worst case performance (or response time) when a particular scheduling policy is applied. There are two general classes of scheduling policies: pre-run-time and run-timescheduling. The goal of both types of scheduling is to satisfy time constraints. In pre-run-time scheduling, the objective is to create a feasible schedule offline, which guarantees the execution order of processes and prevents simultaneous access to shared resources. Pre-run-time scheduling also takes into account and reduces the cost of context switching overhead, increasing the chance that a feasible schedule can be found. In run-time scheduling, static priorities are assigned and resources are allocated on a priority basis. Run-time scheduling relies on a complex run-time mechanism for process synchronization and communication. This approach allows events to interrupt processes and demand resources randomly. In terms of performance analysis, engineers must rely on stochastic simulations to verify these types of system designs.

Task Characteristics of a Real Workload Precedence Constraints Specify if any task(s) needs to precede other tasks. Release or Arrival Time ri , j The release time of the j th instance of task τi . Phase φi The release time of the first instant of task τi . Response Time Time span between the task activation and its completion. Absolute Deadline di The instant by which the task must complete. Relative Deadline Di The maximum allowable response time of the task. Laxity Type Notion of urgency or leeway in a task’s execution. Period pi The minimum length of intervals between the release times of consecutive tasks. Execution Time ei The (maximum) amount of time required to complete the execution of a task i when it executes alone and has all the resources it requires.

Do the mAthS

Scheduling Algo Round Robin Cyclic Executive Fixed-Priority Scheduling–Rate-Monotonic Dynamic-Priority Scheduling: Earliest-Deadline–First

Inter Task Communication & Synch