November 29th, 2016 by
What differentiates a real-time operating system from operating systems like UNIX or Windows in embedded computing is its response time to the external events. A typical operating system provides a soft, non-deterministic real-time response in instances without guarantees regarding the completion of a task. However, it tries to remain responsive to users. An RTOS is different from these systems because it provides hard real-time responses. It provides a highly deterministic and fast reaction to an external event.
When switching tasks, an RTOS chooses the most appropriate task and loads it next. Several algorithms for scheduling are available, including: Co-operative, Hybrid and Round Robin scheduling. Nevertheless, most RTOS’s employ a pre-emptive algorithm for scheduling, while providing a response system. A pre-emptive system entails giving every task individual priority value. When the required response has to be faster, the assigned priority level is higher. The chosen task in a pre-emptive mode is usually the one with the highest priority value and this makes the system highly responsive.
Why use a real-time operating system?
RTOS benefits are more apparent in more complex software solutions. Some of the reasons for using an RTOS include:
- Extensibility: This is when easier maintenance is required. For instance, abstracting timing reliance and task-based designs, cause fewer interdependencies between the modules.
- Priority-based scheduling: This is when the separation of non-critical processes from critical processing is required.
- Abstracting timing data: An RTOS provides timing and API functions allowing for smaller and cleaner application code.
- Modularity: Naturally, task-based API encourages the development of modular as the role is typically defined clearly.
- Team development: An RTOS allows separate teams or designers to operate independently on the project.
- Easier testing: An RTOS is the best option when you want to make testing easier. This is because it allows for testing of modular tasks.
- Enhanced efficiency: The operating system can be event driven fully. This means that no processing time will be wasted on polling for an event that does not happen.
- Code reuse: Modularity allows for the development of standard tasks library, since similar applications are used on similar platforms.
- Idle processing: Idle or background processing can be performed in idle tasks. As such, things like background CRC checking and CPU load measurement do not affect the primary processing.
These are some of the reasons why you may use a real-time operating system. It is important however that you choose the right RTOS for your application.