0
RTOS BY  P.RAMASUBBU
Contents <ul><li>Real Time System Fundamentals  </li></ul><ul><li>Real Time Operating System (RTOS) </li></ul><ul><li>Linu...
What are Real-time Systems ? <ul><li>Real-time systems </li></ul><ul><li>Those systems in which the  correctness  of the s...
Types of Real Time Systems <ul><li>Based on Hard deadline : Penalty due to missing deadline is a higher order of magnitude...
A Sample Real Time System (1) (c) Telecommunications Consultants India Limited
A Sample Real Time System (2) <ul><li>Mission:  Reaching the destination safely.  </li></ul><ul><li>Controlled System:  Ca...
A Sample Real Time System (3) <ul><li>Controls:  Accelerator, Steering wheel, Break-pedal.  </li></ul><ul><li>Actuators:  ...
A Sample Real Time System (4) <ul><li>Performance  is not an absolute one. It measures the goodness of the outcome relativ...
Contents <ul><li>Real Time System Fundamentals  </li></ul><ul><li>Real Time Operating System (RTOS) </li></ul><ul><li>Linu...
RTOS Kernel <ul><li>RTOS Kernel provides an Abstraction layer that hides from application software the hardware details of...
RTOS Kernel Functions (c) Telecommunications Consultants India Limited
Task Management <ul><li>Set of services used to allow application software developers to design their software as a number...
Task Scheduling <ul><li>Non Real -time systems usually use  Non-preemptive Scheduling  </li></ul><ul><ul><li>Once a task s...
Priority based Preemptive Task Scheduling  <ul><li>Every Task in a software application is assigned a priority. </li></ul>...
Nested Preemption (c) Telecommunications Consultants India Limited Timeline for Priority-based Preemptive Scheduling
Task Switch (1) <ul><li>Each time the priority-based preemptive scheduler is alerted by an External world trigger / Softwa...
Task Switch (2) <ul><li>A Non Real time operating system might do task switching only at timer tick times.  </li></ul><ul>...
Task Switch (3) <ul><li>Task Switching  Timing  </li></ul>(c) Telecommunications Consultants India Limited
Intertask Communication & Synchronization  <ul><li>These services makes it possible to pass information from one task to a...
Inter-Task communication  & Synchronization <ul><li>The most  important communication b/w tasks in an OS is the passing of...
Message passing in OS <ul><li>Most General Purpose OS actually copy messages twice as they transfer them from task to task...
Message passing in RTOS <ul><li>In RTOS, the OS copies a pointer to the message, delivers the pointer to the message-recei...
D ynamic  M emory  A llocation  in General Purpose OS <ul><li>Non-real-time operating systems offer memory allocation serv...
D ynamic  M emory  A llocation  in RTOS <ul><li>RTOS does it by a mechanism known as Pools.  </li></ul><ul><li>Pools memor...
Contents <ul><li>Real Time System Fundamentals  </li></ul><ul><li>Real Time Operating System (RTOS) </li></ul><ul><li>Linu...
Dark Side of Linux  in Real-Time <ul><li>The Linux kernel (< version  2.6) is  neither preemptive nor reentrant  by user p...
Typical Solutions for Linux <ul><li>3 ways to deal with Linux’ s  poor real-time performance : </li></ul><ul><ul><li>Ignor...
Ignore the problem Approach <ul><li>The most popular approach is to  ignore the problem . </li></ul><ul><li>Mostly works f...
Work Around Approach <ul><li>Linux kernel runs as a task under a small real-time executive.  </li></ul><ul><li>Real-time t...
Work Around - Advantages <ul><li>The real-time executive can be small and simple making it easier to verify its real-time ...
Work Around - Disadvantages <ul><li>Not applicable if real-time part of the software is large / not easily separated from ...
Adapt Linux <ul><li>The original Linux kernel is  replaced with a compatible kernel  with hard real-time performance chara...
Adapt Linux Approach  Advantages & Disadvantages <ul><li>Advantages: </li></ul><ul><ul><li>No limits on the size and compl...
Any Questions?
Thank You   !
Upcoming SlideShare
Loading in...5
×

RTOS

5,013

Published on

Presentation

Published in: Education, Technology, Business
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,013
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
455
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide
  • Real Time Operating Systems (c) Telecommunications Consultants India Limited
  • Transcript of "RTOS"

    1. 1. RTOS BY P.RAMASUBBU
    2. 2. Contents <ul><li>Real Time System Fundamentals </li></ul><ul><li>Real Time Operating System (RTOS) </li></ul><ul><li>Linux as RTOS </li></ul>(c) Telecommunications Consultants India Limited
    3. 3. What are Real-time Systems ? <ul><li>Real-time systems </li></ul><ul><li>Those systems in which the correctness of the system depends not only on the logical result of computation, but also on the time at which the results are produced. </li></ul>(c) Telecommunications Consultants India Limited
    4. 4. Types of Real Time Systems <ul><li>Based on Hard deadline : Penalty due to missing deadline is a higher order of magnitude than the Reward in meeting the deadline. </li></ul><ul><li>Based on Soft deadline : Penalty often equal / lesser magnitude than Reward. </li></ul>(c) Telecommunications Consultants India Limited
    5. 5. A Sample Real Time System (1) (c) Telecommunications Consultants India Limited
    6. 6. A Sample Real Time System (2) <ul><li>Mission: Reaching the destination safely. </li></ul><ul><li>Controlled System: Car. </li></ul><ul><li>Operating environment: Road conditions. </li></ul><ul><li>Controlling System </li></ul><ul><li>- Human driver: Sensors - Eyes and Ears of the driver. </li></ul><ul><li>- Computer: Sensors - Cameras, Infrared receiver, and Laser telemeter. </li></ul>(c) Telecommunications Consultants India Limited
    7. 7. A Sample Real Time System (3) <ul><li>Controls: Accelerator, Steering wheel, Break-pedal. </li></ul><ul><li>Actuators: Wheels, Engines, and Brakes. </li></ul><ul><li>Critical tasks: Steering and breaking </li></ul><ul><li>Non-critical tasks: Turning on radio </li></ul>(c) Telecommunications Consultants India Limited
    8. 8. A Sample Real Time System (4) <ul><li>Performance is not an absolute one. It measures the goodness of the outcome relative to the best outcome possible under a given circumstance. </li></ul><ul><li>Cost of fulfilling the mission -> Efficient solution. </li></ul><ul><li>Reliability of the driver -> Fault-tolerance is a must. </li></ul>(c) Telecommunications Consultants India Limited
    9. 9. Contents <ul><li>Real Time System Fundamentals </li></ul><ul><li>Real Time Operating System (RTOS) </li></ul><ul><li>Linux as RTOS </li></ul>(c) Telecommunications Consultants India Limited
    10. 10. RTOS Kernel <ul><li>RTOS Kernel provides an Abstraction layer that hides from application software the hardware details of the processor / set of processors upon which the application software shall run. </li></ul>(c) Telecommunications Consultants India Limited Application Software RTOS Hardware
    11. 11. RTOS Kernel Functions (c) Telecommunications Consultants India Limited
    12. 12. Task Management <ul><li>Set of services used to allow application software developers to design their software as a number of separate chunks of software each handling a distinct topic, a distinct goal, and sometimes its own real-time deadline. </li></ul><ul><li>Main service offered is Task Scheduling </li></ul><ul><ul><li>controls the execution of application software tasks </li></ul></ul><ul><ul><li>can make them run in a very timely and responsive fashion. </li></ul></ul>(c) Telecommunications Consultants India Limited
    13. 13. Task Scheduling <ul><li>Non Real -time systems usually use Non-preemptive Scheduling </li></ul><ul><ul><li>Once a task starts executing, it completes its full execution </li></ul></ul><ul><li>Most RTOS perform priority-based preemptive task scheduling. </li></ul><ul><li>Basic rules for priority based preemptive task scheduling </li></ul><ul><ul><li>The Highest Priority Task that is Ready to Run, will be the Task that Must be Running. </li></ul></ul>(c) Telecommunications Consultants India Limited
    14. 14. Priority based Preemptive Task Scheduling <ul><li>Every Task in a software application is assigned a priority. </li></ul><ul><li>Higher Priority = Higher Need for Quick Response. </li></ul><ul><li>Follows nested preemption </li></ul>(c) Telecommunications Consultants India Limited
    15. 15. Nested Preemption (c) Telecommunications Consultants India Limited Timeline for Priority-based Preemptive Scheduling
    16. 16. Task Switch (1) <ul><li>Each time the priority-based preemptive scheduler is alerted by an External world trigger / Software trigger it shall go through the following steps that constitute a Task Switch : </li></ul><ul><ul><li>Determine whether the currently running task should continue to run. </li></ul></ul><ul><ul><li>Determine which task should run next. </li></ul></ul><ul><ul><li>Save the environment of the task that was stopped (so it can continue later). </li></ul></ul><ul><ul><li>Set up the running environment of the task that will run next. </li></ul></ul><ul><ul><li>Allow the selected task to run. </li></ul></ul>(c) Telecommunications Consultants India Limited
    17. 17. Task Switch (2) <ul><li>A Non Real time operating system might do task switching only at timer tick times. </li></ul><ul><li>Even with preemptive schedulers a large array of tasks is searched before a task switch. </li></ul><ul><li>A Real time OS shall use Incrementally arranged tables to save on time. </li></ul>(c) Telecommunications Consultants India Limited
    18. 18. Task Switch (3) <ul><li>Task Switching Timing </li></ul>(c) Telecommunications Consultants India Limited
    19. 19. Intertask Communication & Synchronization <ul><li>These services makes it possible to pass information from one task to another without information ever being damaged. </li></ul><ul><li>Makes it possible for tasks to coordinate & productively cooperate with each other. </li></ul>(c) Telecommunications Consultants India Limited
    20. 20. Inter-Task communication & Synchronization <ul><li>The most important communication b/w tasks in an OS is the passing of data from one task to another. </li></ul><ul><li>If messages are sent more quickly than they can be handled, the OS provides message queues for holding the messages until they can be processed. </li></ul>(c) Telecommunications Consultants India Limited Message Producer Task Message Receiver Task
    21. 21. Message passing in OS <ul><li>Most General Purpose OS actually copy messages twice as they transfer them from task to task via a message queue. </li></ul>(c) Telecommunications Consultants India Limited Message Sender Task RAM Message RAM Message Receiver Task Message
    22. 22. Message passing in RTOS <ul><li>In RTOS, the OS copies a pointer to the message, delivers the pointer to the message-receiver task, and then deletes the copy of the pointer with message-sender task. </li></ul>(c) Telecommunications Consultants India Limited Message Sender Task RAM Message Receiver Task RTOS msg_ptr msg_ptr Message Message
    23. 23. D ynamic M emory A llocation in General Purpose OS <ul><li>Non-real-time operating systems offer memory allocation services from what is termed a Heap. </li></ul><ul><li>Heaps suffer from a phenomenon called External Memory Fragmentation. </li></ul><ul><li>Fragmentation problem is solved by Garbage collection / Defragmentation. </li></ul><ul><li>Garbage collection algorithms are often wildly non-deterministic. </li></ul>(c) Telecommunications Consultants India Limited
    24. 24. D ynamic M emory A llocation in RTOS <ul><li>RTOS does it by a mechanism known as Pools. </li></ul><ul><li>Pools memory allocation mechanism allows application software to allocate chunks of memory of 4 to 8 different buffer sizes per pool. </li></ul><ul><li>Pools avoid external memory fragmentation, by not permitting a buffer that is returned to the pool to be broken into smaller buffers in the future. </li></ul><ul><li>When a buffer is returned the pool, it is put onto a free buffer list of buffers of its own size that are available for future re-use at their original buffer size </li></ul>(c) Telecommunications Consultants India Limited
    25. 25. Contents <ul><li>Real Time System Fundamentals </li></ul><ul><li>Real Time Operating System (RTOS) </li></ul><ul><li>Linux as RTOS </li></ul>(c) Telecommunications Consultants India Limited
    26. 26. Dark Side of Linux in Real-Time <ul><li>The Linux kernel (< version 2.6) is neither preemptive nor reentrant by user processes. </li></ul><ul><li>Processes are heavy-weight : Linux has insufficient resource handling . </li></ul><ul><li>Fair share scheduling algorithm . </li></ul><ul><li>Unbound amount of CPU time used by interrupt handlers under Linux, and these run at a higher priority than any user process. </li></ul>(c) Telecommunications Consultants India Limited
    27. 27. Typical Solutions for Linux <ul><li>3 ways to deal with Linux’ s poor real-time performance : </li></ul><ul><ul><li>Ignore the problem (only for soft real-time). </li></ul></ul><ul><ul><li>Work around and run real-time applications under an RTOS with Linux itself as a separate task. e.g. RT-Linux. </li></ul></ul><ul><ul><li>Adapt Linux and run a Linux compatible RTOS kernel instead of the Linux kernel. </li></ul></ul>(c) Telecommunications Consultants India Limited
    28. 28. Ignore the problem Approach <ul><li>The most popular approach is to ignore the problem . </li></ul><ul><li>Mostly works for soft real-time systems. </li></ul><ul><li>Design recommendations to reduce latency </li></ul><ul><ul><li>If possible, address all real-time response needs directly with interrupt service routines. </li></ul></ul><ul><ul><li>Avoid known excessive interrupt-off periods in Linux. </li></ul></ul><ul><ul><li>If a process component is required in the real-time control path, then consider aggregate system loading & Adapt processes . </li></ul></ul>(c) Telecommunications Consultants India Limited
    29. 29. Work Around Approach <ul><li>Linux kernel runs as a task under a small real-time executive. </li></ul><ul><li>Real-time tasks are run directly under the real-time executive </li></ul><ul><li>Non-real-time tasks are run under Linux. </li></ul><ul><li>Applications that work on such a system can include machine control, process control, and instrumentation applications. </li></ul>(c) Telecommunications Consultants India Limited
    30. 30. Work Around - Advantages <ul><li>The real-time executive can be small and simple making it easier to verify its real-time performance. </li></ul><ul><li>The Linux kernel running non-real-time tasks is &quot;standard&quot; Linux so it is compatible with other Linux distributions and can easily be updated. </li></ul><ul><li>Supports hard real-time applications. </li></ul>(c) Telecommunications Consultants India Limited
    31. 31. Work Around - Disadvantages <ul><li>Not applicable if real-time part of the software is large / not easily separated from the code that needs a Linux environment </li></ul><ul><li>Tasks running under the real-time executive do not have access to the Linux facilities, device drivers, etc. </li></ul><ul><li>Tasks running under the Linux kernel and can access the facilities are not real-time. </li></ul><ul><li>Programmers tend to increase the number of facilities in the real-time kernel until the real-time executive replicates facilities of Linux. </li></ul>(c) Telecommunications Consultants India Limited
    32. 32. Adapt Linux <ul><li>The original Linux kernel is replaced with a compatible kernel with hard real-time performance characteristics. </li></ul><ul><li>The kernel is only a small part of a whole operating system. If just the Linux kernel is replaced and the libraries, utilities, and file structure remain the same. </li></ul><ul><li>The real-time kernel must support all the facilities of a Linux kernel while still remaining fully preemptive and reentrant. </li></ul>(c) Telecommunications Consultants India Limited
    33. 33. Adapt Linux Approach Advantages & Disadvantages <ul><li>Advantages: </li></ul><ul><ul><li>No limits on the size and complexity of the real-time application code. </li></ul></ul><ul><ul><li>Third party software not originally envisioned for real-time use can be invoked by real-time tasks </li></ul></ul><ul><ul><li>With the same programming interfaces, programmers who understand Linux would already be experts in the real-time environment. </li></ul></ul><ul><li>Disadvantages: </li></ul><ul><ul><li>With modified Linux you are NOT sure of full compatibility with standard Linux application </li></ul></ul>(c) Telecommunications Consultants India Limited
    34. 34. Any Questions?
    35. 35. Thank You !
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×