• Save
Real Time Systems & RTOS
Upcoming SlideShare
Loading in...5
×
 

Real Time Systems & RTOS

on

  • 4,022 views

An introduction on Real Time Systems, RTOS and its characteristics.

An introduction on Real Time Systems, RTOS and its characteristics.

Statistics

Views

Total Views
4,022
Views on SlideShare
3,931
Embed Views
91

Actions

Likes
14
Downloads
0
Comments
1

6 Embeds 91

http://embedded-concept.blogspot.in 46
http://embedded-concept.blogspot.com 34
http://www.techgig.com 8
http://embetron.blogspot.com 1
http://embedded-concept.blogspot.kr 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Definition comes from Ben Ari Implementation of parallelism is a topic in computer systems (hardware and software) that is essentially independent of concurrent programming. The topic has been around for a long time. |Can we traced back to Conway and Dijkstra in the early 60’s. Perhaps its defining moment was the publications of Dijkstra’s paper on Co-operating Sequential Processesin 1965 First concurrent programming language Simula 66? Not under 1983 until we see the first international standard concurrent programming language - Ada. This Department via Ian Pyle and Ian Wand were involved in that development Indeed is not Universally accepted that programming languages should be concurrent
  • Generally speaking, RTOSs are a subset of embedded operating systems. While you can solve many application challenges with an embedded operating system, some challenges can only be solved with the determinism afforded by a hard RTOS.
  • VxWorks uses Micro kernel with minmal set of utilities. (In the early days OS uses Monolithic kernel , It is a big kernel putting all together) VxWorks's default scheduler comes with two possible scheduling algorithms : A preemptive prioritybased scheduler (with 256 priority levels) and a round-robin scheduler . It is also possible to use a POSIX scheduler with both a first-in first-out (FIFO) and a round-robin algorithm. eCOS is an RTOS from Redhat. RT Linux consists of LynxOS from LynxWorks and BlueHat Linux.
  • High-speed control applications, such as hardware-in-the-loop simulations and motion control systems, typically require ISR and IST times to be less than 10 µs.
  • Context switch latency is the amount of time it takes to switch control to a high-priority process in response to an event that makes it run-able
  • Can you assign those algorithms on a per-thread basis, or does the RTOS force you into assigning one algorithm to all threads in your system? In Rate-Monotonic scheduling sets static priorities to the periodic tasks which it's scheduling. If a task has a short period - that is, it will be executed often, the scheduler will give it a higher priority . Tasks with longer period gets a lower priority . The draw backs of this schedule algorithm is it can't always guarantee that it's possible to schedule a set of tasks, or more correctly, it can't always maximize the CPU utilization EDF (Earliest Deadline First) scheduling case tasks always have dynamic priorities. The tasks with earliest deadlines will have always high priority. POSIX 1.b Scheduler are SCHEDULE_FIFO (First in First out) and SCHEDULE_RR (Round Robin) Does the RTOS support a partitioning scheduler that provides tasks with a guaranteed percentage of CPU time, regardless of what other tasks, including higher-priority tasks, are doing? They also ensure that critical tasks can remain available and meet their deadlines, even when the system is subjected to denial of service attacks and other malicious exploits. Can you easily customize the GUI's look-and-feel? Can the GUI display and input multiple languages (Chinese, Korean, Japanese, English, Russian, etc.) simultaneously? Can 2D and 3D applications easily share the same screen? Does the RTOS support an up-to-date suite of preintegrated protocol stacks, such as IPv4, IPv6, IPsec, SCTP, and IP filtering with NAT? Does it also support an embedded Web browser? The browser should have a scalable footprint and be capable of rendering standard Web pages on very small screens. It should also support standards such as HTML 4.01, SSL 3.0, CSS 1 and 2, OMA , JavaScript, WAP, and WML. Does the RTOS lock you into a proprietary API, or does it provide full support for a standard API like POSIX, which makes it easier to port code to and from other OSs? Does the RTOS vendor provide well-documented source and customization kits to help tailor the RTOS to your specific requirements? Does the vendor also offer driver development kits,

Real Time Systems & RTOS Real Time Systems & RTOS Presentation Transcript

  • Concepts on Real Time Systems & RTOS By Ch. Vishwa Mohan Software Consultant & Trainer
  • Who am I anyway?
    • Name : Ch.Vishwa Mohan
    • Qualification : M.E ( Inst ) passed in 1994.
    • Experience : Over 13+ Years of Software development experience specially in Embedded/ Real Time systems in Industrial Automation, Process Control,
    • Semiconductor related areas.
  • What is an Real Time System ?
    • A Real time system is one, Correctness of the computations not only depends on logical correctness but also the time at which the result is produced. If the timing constrains are not meet, system failure is said to have occurred.
    • Computer systems those operates in an environment in which they are required to response to external events, not only in a functionally correct way, but also in a correct timely way are labeled real-time systems.
    • Real Time systems are one in which timelines, performance, and schedulability are essential to correctness.
    • Real-time systems are generally reactive in nature, usually responding to external events via interrupts.
  • What is an Real Time System ?
    • A real-time system is any information processing system which has to respond to externally generated input stimuli within a finite and specified period
      • The correctness depends not only on the logical result but also the time it was delivered.
      • Failure to respond in time is as bad as the wrong response!
    • The computer is a component in a larger engineering system => EMBEDDED COMPUTER SYSTEM
    • 99% of all processors are for the embedded systems market
  • A simple fluid control system Pipe Flow meter Valve Interface Computer Time Input flow reading Processing Output valve angle
  • A Widget-Packing Station Line controller Computer Switch Assembly line Box 0 = stop 1 = run Bell Switch
  • A Typical Embedded System Algorithms for Digital Control Data Logging Data Retrieval and Display Operator Interface Interface Engineering System Remote Monitoring System Real-Time Clock Database Operator’s Console Display Devices Real-Time Computer
  • Characteristics of Real Time Systems
    • Large and complex — vary from a few hundred lines of assembler or C to 20 million lines of Ada estimated for the Space Station Freedom
    • Concurrent control of separate system components* — devices operate in parallel in the real-world; better to model this parallelism by concurrent entities in the program
    • Facilities to interact with special purpose hardware — need to be able to program devices in a reliable and abstract way
    • Extreme reliability and safe — embedded systems typically control the environment in which they operate; failure to control can result in loss of life, damage to environment or economic loss
    • Guaranteed response times — we need to be able to predict with confidence the worst case response times for systems; efficiency is important but predictability is essential.
  • Concurrent Programming
    • The name given to programming notation and techniques for expressing potential parallelism and solving the resulting synchronization and communication problems
    • Virtually all real-time systems are inherently concurrent. ( Devices operate in parallel in the real world ).
    • Implementation of parallelism is a topic in computer systems (hardware and software) that is essentially independent of concurrent programming.
      • To allow the expression of potential parallelism so that more than one computer can be used to solve the problem.
  • Why we need Concurrent Programming ?
    • To fully utilise the processor
    Response time in seconds 10 -7 10 -6 10 -5 10 -4 10 -3 10 -2 10 -1 10 2 10 1 10 -8 10 -9 10 0 human tape floppy CD memory processor
  • Parallelism Between CPU and I/O Devices CPU Initiate I/O Operation Interrupt I/O Routine I/O Finished I/O Device Process I/O Request Signal Completion Continue with Outstanding Requests
  • Airline Reservation System VDU VDU VDU VDU P P P P Process Database
  • Air Traffic Control
  • Terminology
    • A concurrent program is a collection of autonomous sequential processes, executing (logically) in parallel
    • The actual implementation (i.e. execution) of a collection of processes usually takes one of three forms.
    • Multiprogramming
      • Processes multiplex their executions on a single processor
    • Multiprocessing
      • Processes multiplex their executions on a multiprocessor system where there is access to shared memory
    • Distributed Processing
      • Processes multiplex their executions on several processors which do not share memory
  • Reliability, Failure and Faults
    • The reliability of a system is a measure of the success with which it conforms to some authoritative specification of its behaviour.
    • When the behaviour of a system deviates from that which is specified for it, this is called a failure
    • Failures result from unexpected problems internal to the system which eventually manifest themselves in the system's external behaviour
    • These problems are called errors and their mechanical or algorithmic cause are termed faults
    • Systems are composed of components which are themselves systems: hence
      • > failure -> fault -> error -> failure -> fault
  • Real Time S/W design include of:
    • Identification of Real time tasks.
    • Co-ordination between real time tasks.
    • Processing of system interrupts.
    • I/O handling to ensure no data loss.
    • Specifying internal/external constrains of system.
    • Ensuring the accuracy of data.
  • Topics interest in RT System Includes:
    • Responding to external events
    • Priorities and scheduling
    • Synchronization requirements
    • Deterministic response times.
  • Metrics of Real Time Systems Include:
    • Predictability fast responses to urgent events: The device should perform its intended function in a predictable manner, while supporting other functions.
    • High degree of schedulability: The timing requirements of the system must be satisfied at high degrees of utilization.
    • Stability under transient overload: When the system is overloaded by events and it is impossible to meet all the deadlines, the deadlines of selected critical tasks must still be guaranteed.
  • Problems for Real Time Software Developers:
    • Real-time software developers have all the problems of non-real time developers plus several more:
      • Timeliness:
        • This timeliness is the key difference in real time systems. Many people thing of real time system as really-fast, but it is a misconception.
        • In real-time systems, the right answer at the wrong time is the wrong answer.
        • Designers can distinguish hard, soft and firm real time systems*.
      • Low Resource Availability ( Memory, CPU speed, etc.,)
      • Reliability Issues: Should be more reliable, No Ctrl + Alt + Del
      • Safety Issues: Need to use Dual memory storage, CRC, Watch dog timer, etc.,
      • Compiler and Tool Availability:
  • Hard, Soft & Firm Real Time Systems:
    • Hard Real Time Systems: In Hard real time systems the processing deadlines are missed, the system had said to be failed.
    • (Eg: Missile may not attack the target. Aircraft may crash, Nuclear Power plant may explode).
    • Soft Real Time Systems: In soft real time systems must meet the deadline but only in the average case.
    • (Eg: Screen switching at 250 m sec, Maintain and update of flight plans in commercial airlines, Live audio/Video systems)
      • A soft real-time operating system is one that has reduced constraints on 'lateness,' but still must operate quickly within fairly consistent time constraints."
    • Firm Real Time Systems: These systems that are primarily soft, but do have a hard deadline as well.
  • Hard, Soft & Firm Real Time Systems:
    • It is important to note that hard versus soft real-time does not necessarily relate to the length of time available.
      • A machine may overheat if a processor does not turn on cooling within 15 minutes . Still it is a Hard real time system.
      • A network interface card may lose buffered data if it is not read within a fraction of a second , but the data can be resent over the network without major adverse consequences. It is a Soft Real time system.
  • Hard, Soft & Firm Real Time Systems:
    • Hard real-time — systems where it is absolutely imperative that responses occur within the required deadline. E.g. Flight control systems.
    • Soft real-time — systems where deadlines are important but which will still function correctly if deadlines are occasionally missed. E.g. Data acquisition system.
    • Real real-time — systems which are hard real-time and which the response times are very short. E.g. Missile guidance system.
    • Firm real-time — systems which are soft real-time but in which there is no benefit from late delivery of service.
    • A single system may have all hard, soft and real real-time subsystems, In reality many systems will have a cost function associated with missing each deadline.
    • RTOS
    • ( Real Time Operating Systems )
  • RTOS ( Real Time Operating System )
    • What is an RTOS?
      • RTOS is the brain of the Real Time System.
      • Respond to predictable way to unpredictable events.
      • Strict timing constraints.
      • Which would ensure fast interrupt response and real time scheduling.
    • Primary role of an OS is to manage resources so as to meet the demand of target applications. In addition to this Real time applications demands Timelines and Predictability . The OS targeting real time applications meet the above demands by paying special attention to a host of OS features Like:
      • Multitasking & Synchronization
      • Interrupt and Event Handling
      • Inter Task Communication
      • Timer & Clocks
      • Input/Output
      • Memory Management.
    • Modern real time systems are based on complementary concept of multitasking and Inter task communication.
  • Different RTOS’s available :
    • VxWorks
    • QNX
    • pSOS
    • RT Linux
    • eCOS
    • Win CE (& Win CE.NET)
    •  C/OS-II
    • etc.,
  • Real-time Programming Languages
    • Assembly languages
    • Sequential systems implementation languages — e.g. RTL/2, C.
    • Both normally require operating system support.
    • High-level concurrent languages. Impetus from the software crisis. e.g. Ada, Chill, Modula-2, Java.
    • No operating system support! We will consider:
      • Java/Real-Time Java
      • C and Real-Time POSIX
      • Ada 95
      • Also Modula-1 for device driving
  • RTOS Characteristics:
    • The OS must be multithreaded and preemptive*.
    • The notion of thread priority must exists.
    • A system of Priority inheritance* must be exists.
    • The OS must support predictable thread synchronization mechanism.
    • Mechanism to avoid Priory Inversion*.
    • Sufficient Priority levels.
    • The interrupt latency must be predictable.
    • In addition to all the above, OS behavior must be predictable,
    • Contd…,
  • RTOS Characteristics:
    • In addition to previous characteristics, Real time system developers must have detailed information about the system interrupt levels, system calls and timings.
      • The maximum time during which interrupt are masked by the OS and device drivers must be known.
      • The maximum time the device drivers use to process an interrupt and specific IRQ information relating to these device drivers must be known.
      • The interrupt latency* ( time from interrupt occur to interrupt task run) must be predictable and compatible with application requirements.
      • The time for every system call should be predictable and must be independent of no of objects present in the system.
  • Different Types of Multitasking Systems:
    • Preemptive Multitasking system
      • The task can be stopped by its execution whenever higher priority task is ready to execute called preemptive multi tasking .
    • Non-Preemptive Multitasking System
    • Co-operative Multitasking System
  • Priority Inheritance
    • Priority Inversion: It refers to a situation where the use of a resource by a low-priority thread delays the execution of a high-priority thread, when both are contending for the same resources. To address this you have following solutions:
      • Priority Inheritance Protocol: It temporarily raises the priority of the low-priority thread to match that of the blocked thread until low priority thread releases the resource.
      • Priority Ceiling Protocol: Here the priority of the low-priority thread is raised immediately when it lock the resource, rather then waiting for a sub sequent lock attempt by a high priority thread.
  • Deadlocks and Race Conditions
    • Deadlocks: A deadlock occurs when each thread is waiting for the other to complete an action.
    • Race Condition: A race condition occurs when the threads are sharing a value and the final result of the value depends on the scheduling order of the thread.
  • Definition on Latencies & Delays:
    • Interrupt Latency: The amount of time that elapses from the time that an external interrupt arrives at the processor until the time that the interrupt processing* begins.
    • Context Switch Delay: The amount of time required to scheduling a task. It involves scheduler determines which task to run saving the current task context and restoring the new task.
    • ISR Latency: Time from the point when an IRQ is set at the CPU to the point when the ISR begins to run.
    • IST Latency: IST latency is the period from the point when an ISR finishes execution (signals a thread) to the point when the IST begins execution.
  • Interrupt Latencies:
    • In a typical RTOS these ISR and IST latencies are measured in single digit micro seconds.
  • Interrupt & Context Switch Latency:
  • Steps Involved in Interrupt Processing:
    • Suspends the active thread.
    • Saves thread-related data that will be needed when the thread is resumed.
    • Transfers control to an ISR.
    • Performs some processing in the ISR to determine what action is needed.
    • Retrieves and saves any critical (incoming) data associated with the interrupt.
    • Sets any required device-specific (output) values.
    • Determines which thread should execute given the change in environment created by the interrupt and its processing.
    • Clears the interrupt hardware to allow the next interrupt to be recognized.
    • Transfers control to the selected thread, including retrieval of its environmental data that was saved when it was last interrupted.
  • Considerations Selecting RTOS
    • Real Time Capabilities
    • ( Hard real time interrupt handling and Premptive scheduling services).
    • Foot Print
    • Target CPU
    • Interrupt Latencies & Context Switch times.
    • Available API’s
    • BSP’s
    • Development Environment and Debugging Tools
    • Licensing
  • Considerations Selecting RTOS
    • Flexible Choice of Scheduling Algorithms ( Eg: FIFO, Round Rabin, Rate-Monotonic, EDF, POSIX 1.b Scheduler, Sporadic, etc., )
    • Guaranteed CPU availability : ( RTOS supporting Partitioning Scheduler, etc., ).
    • GUI Support: ( Eg: Win CE)
    • Tools for remote diagnostics:
    • Internet capabilities:
    • Standard APIs:
    • Source code and Driver Development Kit support:
  • Factors Selecting Commercial Operating Systems:
  • Thank you ! You can reach me at: