Friday, September 27, 2019

Real Time Operating Systems

A real time operating system (RTOS) guarantees that a user defined task will always take the same amount of time (determinism), there won't be surprise OS tasks interrupting and delaying the user task. The RTOS scheduler takes only task priorities into account, duration is the responsibility of the developer. If a task takes too long, you have two options: Simplify the task or use better hardware.

When dealing with low resource embedded systems, the OS should also be lightweight.

Using a kernel or OS ported to your target hardware liberates you from knowing the details of the hardware and writing device drivers.

Consider Windows: It might have higher priority tasks than yours which will cause your task to vary in duration at every run and it is not light weight. These are the reasons why Windows can't be used in low resource systems with real time constraints. See this StackOverflow post.

If you know basic kernel concepts like task scheduling, you don't need to know anything extra to understand an RTOS. For a good RTOS intro, see
  • Real Time Application Design Tutorial
    • Tasks will block until an event indicates that processing is required. Events can either be external (such as a key being pressed), or internal (such as a timer expiring). This event driven approach means that no CPU time is wasted polling for events that have not occurred. Priorities are allocated to tasks in accordance to their timing requirements. The stricter the timing requirement the higher the priority... The kernel will immediately suspend an executing task should a higher priority task become available... The kernel tick frequency should be set at the slowest value that provides the required time granularity.
  • Getting Started with Micrium OS.

No comments: