RTOS Introduction

Hello everyone, This is a series of articles that I am going to write here about RTOS. This is the first article in this series and this article, I am going to introduce you about RTOS, it’s functionalities, categories of RTOS. So let’s get started.

RTOS Background

 In earlier days,  microcontrollers are designed to perform a mostly single task only. Modern microcontrollers are more sophisticated and they have lots of GPIOs, Timers, ADC, Communication Protocol support like USB, USART. These microcontrollers can perform a bit more complex program. The more task and computing are involved, the more is the need for an Operating system.

What is RTOS?

I am sure you guys are familiar with Operating Systems. Well, Operating Systems are capable to perform multiple tasks at the same time. There is a critical component of an OS is Scheduler. A scheduler decides the order of the processes that are running.

The Scheduler in RTOS is designed to provide a predictable executing pattern. This is particularly useful in embedded systems because embedded systems often have real-time requirements. It means that a microcontroller needs to respond to certain events within a fixed time.

Please understand RTOS is a concept that can be implemented anywhere. We use this concept in Embedded systems.

How does the RTOS know which task to Execute?

You might wonder this. In RTOS, tasks are based out of Priority. Since there are multiple tasks of varied priority, the Scheduler gives importance to the tasks based on the priority of the tasks defined by you. The task can be High priority, minimum priority and low priority.

Components of RTOS

We are going to discuss more on this in further articles. For now, I wanted to list down the components of RTOS. 

  • Scheduler: PSceduler which runs the threads.
  • Communication Mechanism: Semaphores, Message Queues, Queues, etc.
  • Critical Region Mechanisms: Mutexes, Gates, Locks, etc.
  • Timing Services: Clocks, Timers, etc.
  • Power Management: Because it is generally used in Embedded systems, it has to be power efficient.
  • Memory Management: Variable-size heaps, fixed-size heaps, etc.
  • Peripheral Drivers: UART, SPI, I2C, etc.
  • Protocol stacks: Network protocol stacks like BLE, WiFi, etc.
  • File System: There could be a file system like FatFS.
  • Device Management: Exception Handling, Boot, etc.

Types of RTOS

RTOS is generally divided into two types:

  • Hard RTOS: It is used in the place where timing is critical and failing it can cause life. For example in a Nuclear Power Plant, in Health Care. Therefore not meeting a deadline is unacceptable.
  • Soft RTOS: This type of RTOS is used where the failure of a meeting the deadline is acceptable. For example Online Database.

Advantages of using RTOS

Let’s look into some advantages of using RTOS. 

  • Because it is a small size, it is used in Embedded Systems. 
  • It takes very little time to switch between tasks.
  • It can be used in 24-7 applications because it performs fewer tasks and gives maximum output.

These are very basic advantages of RTOS. Of Course, there are more but I don’t want to add the complexity of this article. I may add another article discussing more on this.

I guess this is it for this article. If you have any suggestions or feedback on this, please let me know in the comment section below.

Leave a Comment

Your email address will not be published. Required fields are marked *

Share This
Scroll to Top