On October 23rd, 2014, we updated our
By continuing to use LinkedIn’s SlideShare service, you agree to the revised terms, so please take a few minutes to review them.
REAL TIME OPERATING SYSTEM (RTOS) CONCEPTSPantech Prolabs India Pvt Ltd
What is Real Time? 1) Real time is a level of responsiveness that a user sensesas sufficiently immediate or that enables the computer tokeep up with some external process.2) Real time describes a human rather than machine sense oftime.3) It is the class of computers systems that interacts with theexternal world in a time frame defined by the external world.4) It is the system in which the correctness of thecomputations not only depends upon the logical correctnessof the computation but also upon the time at which theresult is produced.5) If the timing constraints of the system are not met systemfailure is said to have occurred.
There are two aspects related 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?1) 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 realtime to the degree that those of its actions which have timeconstraints are performed with acceptable timeliness.6) A system is real time the degree that it employs real time resourcemanagement. The resources are explicitly managed for the purpose ofoperating in real time.7) The system operating in real time needs an appropriate balance ofreal 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 Inter-process 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 RTOS1) Hard Real Time Systems:a) If it has a hard deadline for the completion of an action meaningthat the deadline must always be met, otherwise the task has failed.b) This types of systems deployed in embedded safety-criticalsystems in which missed deadline can be catastrophic.c) Examples: aircraft , train, car, missile and nuclear reactor controlsystems.
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 acceptablerather 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 stillmust operate very quickly and repeatable.
Architecture of RTOSThe basic architecture of multitasking RTOS includesa) Program interface b) The Kernel c)Device Driversd) Optional service modules1) The Kernel provides an interrupt handler, task scheduler ,resource sharing flags and memory management.2) Primary function : To process interrupts that external and internalevents cause.3) Scheduler :That sets up the order of execution of your applicationcode.
Command Interpreter Graphics Interface Posit and Unix Graphics Programming Interface Kernal Services Networking Interrupt Memory Scheduling Network File Dispatch Management Graphics System ANSI Remote Support Compliant Logic and Real Time Procedure Library Ccharacter I/O Interposes Clock Calls Library Communication File Support LoaderManagement Streams Device Drivers Disc Miscellaneous Network Parallel Serial
Requirement for Good RTOS1) Multitasking Capabilities: A RT application is divided into multipletasks. The separation into tasks helps to keep the CPU busy.2) Short Interrupt Latency :Interrupt Latency = Hardware delay to get interrupt signal to theprocessor + time to complete the current instruction + time executingsystem code in preparation for transferring execution to the devicesinterrupt handler.3) Fast Context Switch : The time between the OS recognizing that theawaited event has arrived and the beginning of the waiting task is calledcontext switch time(dispatch latency).This switching time should beminimum.
4) Control Of Memory Management :an OS should provide way for taskto lock its code and data into real memory so that it can guaranteepredictable response to a interrupt.5) Proper scheduling : OS must provide facility to schedule properlytime constrained tasks.6) Fine granularity Timer Services : Millisecond resolution is bareminimum . Microseconds resolution is required in some cases.7) Rich set of Inter Task Communication Mechanism : Message queues, shared memory , Synchronization –Semaphores, event flags
Fundamental RTOS capabilities :a) RTOS vendor must provide worst case execution times for all timesfor all OS routines.b) RTOS must include scheduling and resource sharing algorithms thatenables deterministic behavior.c) Effective RTOS must also be able to handle preemptive scheduling.It enables high priority tasks to execute without being blocked bylower priority tasks.
RTOS Concepts1) Scheduling and Dispatching :a) Scheduling is the creation of a schedule Ie. A ordered list specifyinghow contending accesses to one or more sequentially reusableresources will be granted.b) A schedule is some criteria such as timeliness.c) Dispatching is granting access to the currently most eligiblecontending entity.d) Eligibility is the entities position in a schedule or in the absence ofschedule , other eligibility parameters such as priority and deadline.
e) More commonly RTOS/OS they can be used for dispatching from aheap of unscheduled contending entities (highest priority or earliestdeadline) this is called dispatching rule.2) Schedulable and Non-Schedulable Entities : A computing system hasa mixture has schedulable & Non-schedulable entities.a) Schedulable Entities : Threads, tasks, processes in application andsystem s/w are scheduled by scheduler.b) Non-Schedulable Entities: Interrupt handlers,OS commands, packetlevel N/W communication services ,OS scheduler. They executecontinuously , periodically or in response to events, their timeliness isthe responsibility of the system design and implementation not of thescheduler.
3) Timeliness Specification : There are two levelsa) For Individual Entities : Schedulable ones such as threads ,nonschedulable ones such as interrupt routines.b) For sets of Entities : For sets of entities have collective timelinessspecification.4) Schedulable Entity Timeliness Specificationsa) First level of timeliness specification for a schedulable entity(thread) is that it may have one or more completion timeconstraints(deadlines).b) Second level of timeliness specification is that currently unableset of such threads is scheduled such that to optimize collectivetimeliness.ie.to meet all deadlines.
5) Completion Time Constraint : It is predicate which applies to some portion(frequently all) ofa threads locus of execution, that portion is called the time constraints scope. It is the part ofthe logic of the application.6) Deadline : It is the completion time constraint which specifies the timeliness of the threadstransit through the deadline scope whether the threads execution point reaches the end of thescope before the deadline time has occurred ie.whether the deadline is met.
7) Hard Deadline: It is completion time constraint ie.the threadsexecution point reaches the end of the deadline scope before thedeadline time occurs, then time constrained portion of threadsexecution is timely otherwise that portion is not timely.8) Soft Deadline: It is completion time constraint ie.the threadsexecution point reaches the end of the deadline scope before thedeadline time occurs, then time constrained portion of threadsexecution is more timely otherwise that portion is less timely.9) Soft Time Constraint :a) It is any relationship between the time when the threads executionpoint reaches the end of the that time constraints scope and the utilityto the system of when it does so.b) A thread for which there is no relationship between the timing of itsexecution 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 pointreaches the end of the upper bound scope before the upper bound timeoccurs. 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 reachesthe 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. ie.meet all deadlines , minimize the number ofmissed deadlines.b) The predictability of collective timeliness optimality, rather than predictability of eachindividual 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 RTOS1) Multitasking : There are two ways to achieve Multitaskingto share CPU time between two or more tasks.A) Pre-emptive Multitasking :a) An external tick interrupt ,interrupts task at anindeterminate point and passes control to kernel program.b) The kernel will save the state of the interrupted task adthen determine which task it should run next.c) The Kernel restore the state of task and pass control of theCPU to that task.d) Task will continue to run until it is interrupted by nextexternal tick interrupt or voluntarily gives up allotted timeslice.
B) Non-preemptive Multitasking :a) In Non-preemptive multitasking a task is designed to relinquishcontrol of the CPU to the kernel at regular intervals.b) To the implementation of non-preemptive multitasking is the useof a message queue.c) The kernal manages the message queue which is essentially aqueue 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 torun.c) Highest priority unable process will be executing on the system at all times3) Sufficient number of interrupt levels :a) Advantage of interrupt threads is that they permit the OS to be more responsive to thedevices it services.b) ISR typically disable other interrupts while executing using interrupt threads permitsinterrupts 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
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 realtime sensors (satellite, air,surface,subsurface) and deliveringit to analysis capabilities and weapon systems2) Telecommunications: Real Time access to informationfrom vast array of devices including computers,set topboxes,PDAs,Pagers and wireless phones.3) Aviation: Improved real time capabilities will increasesafety and efficiency by identifying dangerous situations andenabling flexible routing to relieve congestion and preventcollisions.
4)Automotive : Commuters will receive real time data , GPS location information andoperational data via ground stations and satellites , thus routing the driver aroundaccidents , roadwork or traffic congestion in real time.5) Scientific : For monitoring and instrument control.eg.seismic information isincreasingly distributed on a vast scale ,enabling scientist to verify even small scalenuclear detonations as well as helping smaller remote countries prepare for weather andseismic disasters.
For more details www.pantechsolutions.net http://www.slideshare.net/pantechsolutions http://www.scribd.net/pantechsolutions http://www.youtube.net/pantechsolutions