≡ Menu

What is RTOS? – Real Time Operating Systems Basics

Suppose a person is driving a car on a highway at a speed of 70 miles per hour. Now, somehow the car meets with an accident. Fortunately the airbag deployed at the right time and saved the life of the driver.

So, we see that airbag is a very good feature in a car which can save a life someday. But, did we think what would have happened if the airbag would have deployed a few seconds late? Yes, we would have lost a life. So just imagine the dependency on the accuracy of opening of the airbag.

So, what makes that airbag deploy at the right time? Well, welcome to the world of RTOS.

RTOS stands for Real time operating systems.

In modern times we have seen an evolution of embedded systems. Nowadays embedded systems can be found all around us. Be it on cellphones, air conditioners, digital homes, cars etc. Little we realize their contribution in making our life comfortable and safe. Safety is one aspect in which we are now depending more and more on these computerized embedded systems. The heart of these systems is the OS they use. Most of these systems use RTOS.

What is an RTOS?

As the name suggests, there is a deadline associated with tasks and an RTOS adheres to this deadline as missing a deadline can cause affects ranging from undesired to catastrophic. The example we discussed in the beginning of this article is an example of catastrophic affect of an RTOS missing a deadline.

As discussed above that the embedded systems are becoming more and more complex today and with each passing generation their intrusion in our daily lives will become deeper. This means they will bear more and more responsibilities on their shoulders to solve real time problems to make our life easier. But, this requires more and more complex real time applications that RTOS will have to manage effectively.

Some of the most widely used RTOS are :

  • LynxOS
  • OSE
  • QNX
  • RTLinux
  • VxWorks
  • Windows CE

Classification of RTOS

RTOS can be classified into three types :

  1. Hard RTOS : These type of RTOS strictly adhere to the deadline associated with the tasks. Missing on a deadline can have catastrophic affects. The air-bag example we discussed in the beginning of this article is example of a hard RTOS as missing a deadline there could cause a life.
  2. Firm RTOS : These type of RTOS are also required to adhere to the deadlines because missing a deadline may not cause a catastrophic affect but could cause undesired affects, like a huge reduction in quality of a product which is highly undesired.
  3. Soft RTOS  :  In these type of RTOS, missing a deadline is acceptable. For example On-line Databases.

Features of RTOS

An RTOS must be designed in a way that it should strike a balance between supporting a rich feature set for development and deployment of real time applications and not compromising on the deadlines and predictability.

The following points describe the features of an RTOS (Note that this list is not exhaustive) :

  • Context switching latency should be short. This means that the time taken while saving the context of current task and then switching over to another task should be short.
  • The time taken between executing the last instruction of an interrupted task and executing the first instruction of interrupt handler should be predictable and short. This is also known as interrupt latency.
  • Similarly the time taken between executing the last instruction of the interrupt handler and executing the next task should also be short and predictable. This is also known as interrupt dispatch latency.
  • Reliable and time bound inter process mechanisms should be in place for processes to communicate with each other in a timely manner.
  • An RTOS should have support for multitasking and task preemption. Preemption means to switch from a currently executing task to a high priority task ready and waiting to be executed.
  • Real time Operating systems but support kernel preemption where-in a process in kernel can be preempted by some other process.

Some Misconceptions related to RTOS

  • RTOS should be fast. This is not true. An RTOS should have a deterministic behavior in terms of deadlines but its not true that the processing speed of an RTOS is fast. This ability of responsiveness of an RTOS does not mean that they are fast.
  • All RTOS are same. As already discussed we have three types of RTOS (Hard, firm and soft).
  • RTOS cause considerable amount of CPU overhead. Well, again this is not true. Only 1%-4% of CPU time is required by an RTOS.

In the future article of the RTOS series, we will discuss in detail about the architecture of an RTOS.

Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Alan Smith February 6, 2012, 5:30 am

    Where does an OS become realtime?

    HP NonStop machines can process thousands of transactions per second.
    Now that is pretty fast, but not classed as realtime.

  • Russell February 6, 2012, 10:22 am

    Thanks for the write-up.

  • Matteo February 7, 2012, 4:49 am

    Good and deep intro.
    However, the airbag example is a bit misleading, and gives the opportunity to clarify: most people, upon hearing the RTOS name, think about “low-latency”, which is the case for the airbag system. You don’t expect the airbag sensor to be activated, but you must be able to respond to it with bounded latency. An RTOS is not necessarily low-latency, but it needs to be low-jitter: the tasks could be scheduled to run every hour, but you must be dead sure that it will really be every hour. Of course, the ability to be low-latency helps a lot, since you can be sure that when your once-an-hour timer elapses, you will be able to preempt anything you’re doing and serve it in bounded time, but it’s not a mandatory feature. Schedulability theorems and real-time schedulers will help you determine if your system can schedule the periodic tasks you’re planning to run, be it once every microsecond or every hour, like a PID control or a sensor data logger.

  • Ron February 7, 2012, 8:43 am

    good article.

    qnx (www.qnx.com) for blackberry playbook is unix flavored RTOS.


  • bartek February 8, 2012, 3:23 pm

    good introduction to RTOS, I finally known what is all about.

  • ramsse February 8, 2012, 6:32 pm

    good article. like your intro.

  • manisha July 16, 2012, 8:14 am

    thanx for RTOS……!!!!

  • Rajeswari August 6, 2012, 7:18 am

    Ya!Is The Good Notes For All Cs Student Thank You To All
    And Also Good Example For Real Time
    Thank You…..!!!!!

  • sreenivas August 14, 2012, 12:37 am

    very goud example
    thank you

  • MANJUNATH September 25, 2012, 9:01 am

    this very good material for learners:)

  • Moyeedul January 12, 2013, 10:43 pm

    A real-time system is an embedded system that takes in real signals from the outside world as inputs to the system. These systems have to be real-time in order to deal with real signals.

  • Shabnam January 13, 2013, 1:18 am

    thanks for RTOS
    nice example…

  • sapan yadav April 30, 2013, 11:51 pm

    thanks to undrstnd rtos best in my lif with gud exmpl

  • yuvin September 24, 2013, 12:00 am

    it s vry clr and gd…..

  • nitin nakum October 3, 2013, 2:46 am

    nice example of airbag

  • Ambu February 13, 2014, 3:12 am

    thanks for rtos notes

  • Prashant Pounikar April 13, 2014, 1:37 am

    Excellent Example of Car Accident to understand the concept of RTOS !!!
    Thank You Very Much !!!

  • Arati July 7, 2014, 11:19 pm

    Thanks for all…to give a. nice notes ….

  • kaviyarasan September 15, 2014, 5:53 am

    Thanks for all..! given a valuable intro about RTOS

  • jeniga.N July 2, 2015, 2:08 am

    nice intro……….thank u……………..

  • v.vijithree July 2, 2015, 3:55 am

    nice introduction thank u

  • Anonymous September 14, 2015, 1:05 am

    i like it, thanks

  • vignesh March 21, 2016, 12:22 am

    its good intro ,thank you

  • Anbu.Sankar March 29, 2016, 7:57 am

    Very Good and it is easily understandable..

  • Ajith walmilla April 21, 2016, 2:21 am

    Thanks for the write – up

  • anonymous July 4, 2016, 1:22 am

    Nice example.I learned about RTOS clearly from you.Thanks.

  • Sadam March 12, 2017, 9:47 pm

    Hi… I get the concept rtos for cat accident concept