Real Time Operating System (RTOS)

Learn via video courses

Overview

There are many situations in the computing system in which there are multiple events that need to be executed within a certain deadline and to deal with such situations we come across a concept known as Real-Time Operating System (RTOS).

What is a Real-Time Operating System (RTOS)?

Let us start our discussion with a real-life scenario. Suppose a driver is driving a car and the car meets with an accident. Now we want the airbags of the car to immediately open up. Even if there is a slight delay, the driver could get injured and the whole purpose of the airbags gets destroyed.

A real-time operating system (RTOS) is an operating system that is used in computing systems that needs strict completion deadlines for all the tasks that need to be performed on it.

Here the system is connected to an external event, whenever that event is completed a signal is sent to the system with the help of a sensor. Now that signal is communicated to the system as an interrupt. After the operating system receives an interrupt, it initiates a process that is associated with it. Once the interrupt is completed, the operating system handles the power back to the CPU. Now since all this is happening in real-time and there's a need for a quick response from the system speed is very important here.

Why Use an RTOS?

There are certain fields like flight control, telephone switching equipment, and real-time simulations that require a large number of external events to be processed in a short period of time. In these cases we use RTOS.

These processes are connected to the real-time operating system, these operating system executes these tasks quickly.

Some examples of these fields are Airline traffic control systems, Command Control Systems, airline reservation systems, Heart Pacemaker, Network Multimedia Systems, etc.

Types of Real-Time Operating System

Types of Real-Time Operating Systems

The Real-Time Operating System is of three types:

1. Hard Real-Time Operating System:

A hard real-time operating system is used when we need to complete tasks by a given deadline. If the task is not completed on time then the system is considered to be failed.

For example, the pacemaker. A pacemaker has flexible, insulated wires (leads) that are placed in one or more chambers of the heart. These wires deliver electrical pulses to adjust the heart rate. And these wires require a hard real-time operating system.

2. Soft Real-Time Operating System

A soft real-time operating system is used where few delays in time duration are acceptable. That is if the given task is taking a few seconds more than the specified time then also no critical damage takes place.

For example,, telephone switches, the sending or receiving of the call can take some time. It will not be considered a failure.

3. Firm Real-Time Operating System

A firm real-time operating system lies between the hard and soft real-time operating system. A firm real-time system is one in which a few missed deadlines will not lead to total failure, but missing more than a few may lead to complete or catastrophic system failure. However, unlike a hard real-time task, even if a firm real-time task is not completed within its deadline, the system doesn’t fail but the late results are merely discarded.

For example, in Video Conferencing, when a certain frame is being played, if some preceding frame arrives at the receiver, then this frame is of no use and is discarded.

Components of Real-Time Operating System (RTOS)

An RTOS may have the following components: Components of RTOS

  • Scheduler: Scheduler guarantees the highest priority process that is executing.
  • Critical Region: Used for context switching using Mutexes, Locks, etc.
  • Timer: Time of process execution is maintained with the help of Clocks, Timers, etc.
  • Power Management: The RTOS system has multiple devices of varying power requirements thus their management is very important.
  • Communication Process: With the help of Semaphores, Queues, etc. the process order is decided.
  • Memory Management: Memory management is used by the real-time operating system to use virtual memory. Using techniques like paging etc., we can save hardware space by keeping the process that is not in use outside the RAM.
  • Peripheral Drivers: As we know in real time system, the system is connected to external events, and in order to send the interrupt from the external system to the operating system we need device drivers.
  • Device Management: RTOS system contains multiple devices including the internal system as well as many peripheral devices and they need to be in sync with each other in order to make the system perform its task. Thus their management is essential.

Features of Real-Time Operating System (RTOS)

The important features of RTOS are:

  • The response time of RTOS is highly predictable. That is we can guess the time system will take to complete the task.
  • All the interrupt requests go to the Kernel. The kernel is responsible for making all the decisions.
  • Kernel saves the state of each task and decides which task to execute next. Task management and task scheduling are done by the kernel.
  • After the interrupt task is executed, the kernel gives control back to the CPU. Then CPU carries on with other processes.
  • RTOS occupies very little space. Since the size of programs used in RTOS is small.
  • RTOS consumes very less resources. Since maximum utilization of resources (memory, registers, clocks, etc.) happens in RTOS, we can also start our system with fewer resources.

Applications of Real-time Operating System (RTOS)

Some real-life applications of RTOS are:

  • Systems that provide immediate updating.
  • Used in any system that provides up-to-date and minute information on stock prices.
  • Defense application systems like RADAR.
  • Airlines reservation system.
  • Command Control Systems.
  • Air traffic control system.
  • Networked Multimedia Systems.
  • Internet Telephony.
  • Heart Pacemaker.
  • Anti-lock Brake Systems.

Factors for Selecting an RTOS

A few factors to be considered while selecting RTOS are:

1. Security Since the real-time application needs to be connected to the internet most of the time, security becomes the most important factor in selecting RTOS.

2. Environment It's very important to check whether the RTOS that we are using goes well with our other systems. We should consider the latest RTOS with good support features.

3. Features Before selecting an RTOS, it is advised to look into all of its specifications. Like memory allocations, resources required, number of tasks to be processed, etc., and should select the one which matches our requirements.

4. Middleware In order to integrate the RTOS into our present system, we need some middleware. Middleware is software that lies between an operating system and the applications running on it. Thus good middleware can save our time and make the integration fast.

5. Performance Since RTOS is all about real-time application performance becomes a very important criterion it. The better the performance, the better the system.

Examples of Real-time Operating System (RTOS)

Some popular real-life examples of RTOS are:

  • PCOS: RTOS is widely used in embedded applications and PCOS is one example of embedded RTOS.

  • RT Linux: RT Linux stands for Real-time Linux. It operates on a Linux system. The real-time operating system is used between the Linux system and the hardware.

  • Lynx: Lynx is a microkernel-based RTOS that is fully Linux-compatible, a Linux program’s binary image can be effectively run on Lynx.

Advantages of Real-time Operating System

A few advantages of a Real-time operating system are:

  • Easy to use: It is easy to develop and execute real-time applications in real-time operating systems. Since it allows to break complex problems into multiple simple tasks that are easy to define and process.

  • Optimal Resource Utilization: Due to good resource management of the RTOS system by Kernel, resources like devices and systems are utilized most efficiently.

  • Less space requirement: The real-time systems are very compact thus they need very less space.

  • Used in Embedded System: Since the Real-time systems are compact in size they can easily be used in the embedded systems.

  • Error Free: The real-time systems are usually error-free since the RTOS error manager, EM(), is called whenever an error is detected by an RTOS service or by the RTOS itself.

Disadvantages of Real-time Operating System

A few disadvantages of a Real-time operating system are:

  • Costly: The hardware requirements like device drivers are a bit expensive.

  • Complex: The algorithms and programs used in real-time systems are complex.

  • Limited Tasks: The tasks or programs that real-time systems can process at a given time are limited.

Conclusion

So far we have discussed the real-time operating system in detail. Following are some important points that one should keep in mind about RTOS:

  • RTOS is an operating system that is used for real-time applications.
  • RTOS is compact in size and requires fewer resources.
  • There are three types of RTOS: 1) Hard RTOS, 2) Soft RTOS, and 3) Firm RTOS.
  • Important components of RTOS are Scheduler, Communication Mechanism, Critical Region Mechanisms, Timing Services, Power Management, and Memory Management.
  • Performance is the most important factor in RTOS.
  • RTOS is used in Defense application systems like RADAR, and airline reservation systems.