You are on page 1of 35


What is Real Time?
1) Real time is a level of responsiveness that a user senses as sufficiently immediate or that enables the computer to keep up with some external process. 2) Real time describes a human rather than machine sense of time. 3) It is the class of computers systems that interacts with the external world in a time frame defined by the external world. 4) It is the system in which the correctness of the computations not only depends upon the logical correctness of the computation but also upon the time at which the result is produced. 5) If the timing constraints of the system are not met system failure is said to have occurred.

There are two aspects ralated to timeliness : 1) Objective : The degree to which an entity (application,system,thread) operates in real time has acceptable timeliness properties according to timeliness specification. 2) Means To that Objective: Achieving an acceptable degree of timeliness may or may not involve the second aspect of real time computing.(Real time resource management)

What is RTOS? • A real time operating system (RTOS) is an operating system that guarantees a certain capability within a specified time constraint. 2) An OS is a system program that provides an interface between application programs and the computer system (hardware) 3) The applications where dependability that a certain task will finish before a particular deadline is just as obtaining the correct results. 4) Besides meeting deadlines RTOS must also be able to respond predictably to unpredictable events and process multiple events concurrently.

5) A system application/computer/operating system operates in real time to the degree that those of its actions which have time constraints are performed with acceptable timeliness. 6) A system is real time the degree that it employs real time resource management.The resources are explicitly managed for the purpose of operating in real time. 7) The system operating in real time needs an appropriate balance of real time resource management & hardware resource capacity.

OS Basics
Four main tasks of OS • Process Management  Process creation  Process loading  Process execution control  Interaction of the process with signal events  Process monitoring  CPU allocation  Process termination

OS Basics

Interprocess Communication Synchronization and coordination Deadlock detection Process Protection Data Exchange Mechanisms Memory Management Services for file creation, deletion, reposition and protection Input/Output Management  Handles requests and release subroutines for a variety of peripherals and read, write and reposition programs

Types Of RTOS
1) Hard Real Time Systems: a) If it has a hard deadline for the completion of an action meaning that the deadline must always be met,otherwise the task has failed. b) This types of systems deployed in embedded safety-critical systems in which missed deadline can be catastrophic. c) Examples: aircraft ,train,car,missile and nuclear reactor control systems.

2) Soft Real Time Systems : a) Soft real time by default as “Not Hard Real Time.” b) Missing some deadlines by some amount under some circumstances may be acceptable rather than failure. c) In this systems there is usually a rising cost associated with lateness. d) Soft real time means systems which have reduced constraints on “lateness” but still must operate very quickly and repeatably.

Architecture of RTOS The basic architecture of multitasking RTOS includes a) Program interface b) The Kernal c)Device Drivers d) Optional service modules 1) The Kernal provides an interrupt handler, task scheduler , resource sharing flags and memory management. 2) Primary function : To process interrupts that external and internal events cause. 3) Scheduler :That sets up the order of execution of your application code.

Command Interpreter Graphics Interface Posix and Unix Graphics Programming Interface
Kernal Services Interrupt Dispatch Logic and character I/O File Management Memory Management Scheduling Real Time Clock ANSI Compliant C Library Networking Network File System Remote Procedure Calls

Graphics Support Library

Interprocess Communication Support



Device Drivers Disc Miscellaneous Network Parallel Serial

Requirement for Good RTOS
1) Multitasking Capabilities: A RT application is divided into multiple tasks. The separation into tasks helps to keep the CPU busy. 2) Short Interrupt Latency : Interrupt Latency = Hardware delay to get interrupt signal to the processor + time to complete the current instruction + time executing system code in preparation for transferring execution to the devices interrupt handler. 3) Fast Context Switch : The time between the OS recognizing that the awaited event has arrived and the beginning of the waiting task is called context switch time(dispatch latency).This switching time should be minimum.

4) Control Of Memory Management :an OS should provide way for task to lock its code and data into real memory so that it can guarantee predictable response to a interrupt. 5) Proper scheduling : OS must provide facility to schedule properly time constrained tasks. 6) Fine granularity Timer Services : Millisecond resolution is bare minimum . Microseconds resolution is required in some cases. 7) Rich set of Inter Task Communication Mechanism : Message queues,shared memory , Synchronisation –Semaphores,event flags

Fundamental RTOS capabilities : a) RTOS vendor must provide worst case execution times for all times for all OS routines. b) RTOS must include scheduling and resource sharing algorithms that enables deterministic behavior. c) Effective RTOS must also be able to handle preemptive scheduling.It enables high priority tasks to execute without being blocked by lower priority tasks.

RTOS Concepts
1) Scheduling and Dispatching : a) Scheduling is the creation of a schedule ie. A ordered list specifying how contending accesses to one or more sequentially reusable resources will be granted. b) A schedule is some criteria such as timeliness. c) Dispatching is granting access to the currently most eligible contending entity. d) Eligibility is the entities position in a schedule or in the absence of schedule , other eligibility parameters such as priority and deadline.

e) More commonly RTOS/OS they can be used for dispatching from a heap of unscheduled contending entities (highest prority or earliest deadline) this is called dispatching rule. 2) Schedulable and Non-Schedulable Entities : A computing system has a mixture has schedulable & Non-schedulable entities. a) Schedulable Entities : Threads, tasks, processes in application and system s/w are scheduled by scheduler. b) Non-Schedulable Entities: Interrupt handlers,OS commands,packet level N/W communication services ,OS scheduler. They execute continuously , periodically or in response to events,their timeliness is the responsibility of the system design and implementation not of the scheduler.

3) Timeliness Specification : There are two levels a) For Individual Entities : Schedulable ones such as threads ,non schedulable ones such as interrupt routines. b) For sets of Entities : For sets of entities have collective timeliness specification. 4) Schedulable Entity Timeliness Specifications a) First level of timeliness specification for a schedulable entity (thread) is that it may have one or more completion time constraints(deadlines). b) Second level of timeliness specification is that currently runnable set of such threads is scheduled such that to optimize collective meet all deadlines.

5) Completion Time Constraint : It is predicate which applies to some portion(frequently all) of a threads locus of execution, that portion is called the time constraints scope.It is the part of the logic of the application. 6) Deadline : It is the completion time constraint which specifies the timeliness of the threads transit through the deadline scope whether the threads execution point reaches the end of the scope before the deadline time has occurred ie.whether the deadline is met.

7) Hard Deadline: It is completion time constraint ie.the threads execution point reaches the end of the deadline scope before the deadline time occurs,then time constrained portion of threads execution is timely otherwise that portion is not timely. 8) Soft Deadline: It is completion time constraint ie.the threads execution point reaches the end of the deadline scope before the deadline time occurs,then time constrained portion of threads execution is more timely otherwise that portion is less timely. 9) Soft Time Constraint : a) It is any relationship between the time when the threads execution point reaches the end of the that time constraints scope and the utility to the system of when it does so. b) A thread for which there is no relationship between the timing of its execution and its utility to the system is a non real-time system.

10) Non-schedulable Entity Timeliness Specifications : a) The completion time constraints of non-schedulable entities are Hard & soft upper bounds on their execution latencies(duration) which correspond to hard and soft deadlines of schedulable entities. 11) Upper Bound: An upper bound is completion time constraint.It specifies the timeliness of Non-schedulable entity’s execution point reaches the end of the scope before the upper bound time has occurred in which case the upper bound is satisfied.

a) Hard Upper Bound : Non-schedulable entity’s execution point reaches the end of the upper bound scope before the upper bound time occurs.Time constrained portion of the entity’s execution is timely,otherwise the portion is not timely. b) Soft Upper Bound : Non-schedulable entity’s execution point reaches the end of the upper bound scope before the upper bound time occurs.Time constrained portion of the entity’s execution is more timely,otherwise the portion is less timely.

12) Predictability : a) It is to the degree that is known in advance. b) Determinism : the property is known exactly in advance. c) Maximum Entropy : Nothing at all is known in advance about the property. 13) Predictability of Timeliness Optimality : a) It’s the performance of the system of whole. all deadlines , minimize the number of missed deadlines. b) The predictability of collective timeliness optimality,rather than predictability of each individual threads completion with respect to its own time constraint.

14) Hard Real Time : a) Case where for schedulable entities some time constraints are hard deadlines. b)Timeliness component of scheduling criterion is always meet all hard deadlines. c)For non-schedulable entities some upper bounds are hard,system has designed & implemented so that all hard upper bounds are always satisfied. 15) Soft Real Time : a) Time constraints are soft such as classical lateness function. b) Any scheduling criteria may be used such as minimizing the no. of missed deadlines.

Features Of RTOS
1) Mulitasking : There are two ways to acheieve Multitasking to share CPU time between two or more tasks. A) Pre-emptive Multitasking : a) An external tick interrupt ,interrupts task at an indeterminate point and passes control to kernal program. b) The kernal will save the state of the interrupted task ad then determine which task it should run next. c) The Kernal restore the state of task and pass control of the CPU to that task. d) Task will continue to run until it is interrupted by next external tick interrupt or voluntarily gives up allotted time slice.

Preemptive Kernel

B) Non-preemptive Multitasking : a) In Non-preemptive multitasking a task is designed to relinquish control of the CPU to the kernal at regular intervals. b) To the implementation of non-preemptive multitasking is the use of a message queue. c) The kernal manages the message queue which is essentially a queue of message numbers & small amount of data. .

Non Preemptive Kernel

2) Process thread can be prioritized : a) A OS schedules threads/or processes based on their relative priorities. b) Processes are forced to relinquish the processor if a higher priority process becomes ready to run. c) Highest priority runnable process will be executing on the system at all times 3) Sufficient number of interrupt levels : a) Advantage of interrupt threads is that they permit the OS to be more responsive to the devices it services. b) ISR typically disable other interrupts while executing using interrupt threads permits interrupts to be responded to at more regular intervals

Task Management The main function of tasks within a Real-Time Multitasking Executive is the time-critical processing of external or internal events
 Task States  Task Switching

Task States

Process Scheduling Types

Types of Scheduling Policies Deadline driven – ideal but not available Cooperative – relies on current process to give up the CPU Pre-emptive priority scheduling – higher priority tasks may interrupt lower priority tasks Static – priorities are set before the system begins execution Dynamic – priorities can be redefined at run time

Process Scheduling Types
Many priorities levels in a RTOS is better to have for complex systems with many threads  At least 128 levels  A different priority level can be set for each task or thread Round Robin – give each task an equal share of the processor  Implemented when all tasks or threads have the same priority level  May be implemented within a priority range

Real time Applications Used Today: 1) Military : For gathering data from a wide variety of real time sensors (satellite,air,surface,subsurface) and delivering it to analysis capabilities and weapon systems 2) Telecommunications: Real Time access to information from vast array of devices including computers,set top boxes,PDAs,Pagers and wireless phones. 3) Aviation: Improved real time capabilities will increase safety and efficiency by identifying dangerous situations and enabling flexible routing to relieve congestion and prevent collisions.

4)Automotive : Commuters will receive real time data , GPS location information and operational data via ground stations and satellites , thus routing the driver around accidents , roadwork or traffic congestion in real time. 5) Scientific : For monitoring and instrument information is increasingly distributed on a vast scale ,enabling scientist to verify even small scale nuclear detonations as well as helping smaller remote countries prepare for weather and seismic disastors.

Thank You!!