RTOS Basic Concepts

download RTOS Basic Concepts

of 37

  • date post

    17-May-2015
  • Category

    Education

  • view

    8.712
  • download

    1

Embed Size (px)

description

RTOS BASIC CONCEPTS

Transcript of RTOS Basic Concepts

  • 1. REAL TIME OPERATING SYSTEM (RTOS) CONCEPTSPantech Prolabs India Pvt Ltd

2. 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. 3. There are two aspects related to timeliness :1) Objective : The degree to which an entity (application, system, thread) operates inreal time has acceptable timeliness properties according to timeliness specification.2) Means To that Objective: Achieving an acceptable degree of timeliness may or maynot involve the second aspect of real time computing.(Real time resource management) 4. What is RTOS?1)A real time operating system (RTOS) is an operating system that guarantees a certaincapability within a specified time constraint.2) An OS is a system program that provides an interface between application programs andthe computer system (hardware)3) The applications where dependability that a certain task will finish before a particulardeadline is just as obtaining the correct results.4) Besides meeting deadlines RTOS must also be able to respond predictably to unpredictableevents and process multiple events concurrently. 5. 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. 6. OS BasicsFour main tasks of OS Process Management Process creation Process loading Process execution control Interaction of the process with signalevents Process monitoring CPU allocation Process termination 7. 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 subroutinesfor a variety of peripherals and read, writeand reposition programs 8. 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. 9. 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. 10. 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. 11. Command Interpreter Graphics InterfacePosit and Unix Graphics Programming InterfaceKernal Services NetworkingInterrupt Memory SchedulingNetwork FileDispatchManagementGraphics SystemANSI Remote SupportCompliant Logic and Real TimeProcedureLibraryCcharacter I/O Interposes Clock Calls LibraryCommunication File SupportLoaderManagementStreams Device Drivers DiscMiscellaneousNetwork ParallelSerial 12. 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. 13. 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 14. 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. 15. 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. 16. 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. 17. 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. 18. 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. 19. 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. 20. 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 entitys executionpoint reaches the end of the scope before the upper bound timehas occurred in which case the upper bound is satisfied. 21. a) Hard Upper Bound : Non-schedulable entitys execution pointreaches the end of the upper bound scope before the upper bound timeoccurs. Time constrained portion of the entitys execution is timely,otherwise the portion is not timely.b) Soft Upper Bound : Non-schedulable entitys execution point reachesthe end of the upper bound scope before the upper bound time occurs.Time constrained portion of the entitys execution is more timely,otherwise the portion is less timely. 22. 12) Predictabi