In this tutorial, you will learn what is real time operating system or what is RTOS? What are the applications of RTOS? Real time operating systems are used real time systems where time or temporal correctness is as important as logical correctness of a program. For example if you are running program and program consists of four tasks. Each task should be complete in one mili second. Assume that each task produces logically correct output without any time constraint. If we run the program and these four tasks produce correct logical output without taking the consideration of their completion time. Then the completion of these tasks without time constraint is not real time system. But if you want strict condition on the execution time of these four tasks as well as logical correctness. Then this system is called real time system. You may like to read this guide:
Real time operating systems are used to execute these real time tasks. Real time operating systems provides solution for temporal as well as logical correctness of a program. So to understand RTOS, first we need to understand real time systems. Therefore, I have given an example of real time systems, before telling you about types, features and applications of real time operating systems. So now let’s start with basic introduction various terms used in real time operating systems.
Introduction to real time operating systems
Before understanding Real Time Operating Systems few concepts need to be understood. Lets start with basic terminologies of real time operating system. After that I will explain what is operating system and after that we will come to real time operating system. REAL TIME OPERATING SYSTEM has many applications in embedded systems.
- System: A system is something that solves a problem. It can be an intellectual unit that can manage various functions in a coherent way.
- Task: It is a group of instructions performing a function a system that solves a portion of problems.
- Multitasking: Performing multiple tasks at same time is known as multitasking.
- Deadline: It is an essential aspect of a real time system. Every task in a real time system is characterized by its deadline. A task is expected to perform its function by the time allocated to it i.e. before deadline.
Time allocation or deadline may be absolute or relaxed. For example, if a task “must” perform its function in one second, then the deadline is an absolute deadline. If a task “should” perform its function in about one second or so, then the deadline is relaxed.
Types of real time OS
Hard Real Time System (HRTS) and Soft Real Time System (SRTS)
When deadlines are absolute, Real Time Systems are called Hard Real Time Systems. The tasks in HRTS are governed by rigid time constraints. When the deadlines are relaxed, Real Time System is called Soft Real Time System. Tasks in SRTS do not have rigid time constraints.
Priority in real time operating systems
If a real time system fails to meet its deadline it may have severe consequences. Since there is only one microcontroller performing many tasks of varied importance, it is important to determine task deadlines and their relative importance in the system. This leads us to the concept of priority.Priority determines the importance of a task in a system. In a real time system, every task has an assigned priority. The higher the priority, the better is the chance of the task executing on microcontroller and meeting its deadline.How does priority help the coherent functioning of the system? Using priorities of each task in a system, we can devise a scheme that allows coherent operation of a system.
Preemption in real time operating systems
By preventing the low priority task from doing their work when higher priority task wants to do its work, we can maintain coherency of operations. In other words, by virtue of its priority, a task can preempt low priority task.This prerogative of higher priority tasks to perform its job even when other low priority tasks are performing their jobs is known as preemption.
Scheduler in real time operating systems
Which authority decides that what task should run at what time? That is the job of scheduler. It lines up tasks in accordance with their priority. It works as an arbitrator. At any given time, it decides which task should perform its job and which task should be paused. Thus, in effect, the scheduler in real time system maintains a ranked list according to the priorities of all the tasks in system and by the means of preemption, the scheduler enforces the ranked list by allowing or disallowing any particular task to perform its job at any given time. Hence the typical scheme employed for scheduler in real time system is called Priority based Preemptive Scheduling Scheme. For more details about the types of schedulers check following links:
- Scheduling algorithms for real time operating systems
- rate Monotonic scheduling algorithm
- Earliest deadline first Scheduling Algorithm
- Least Laxity first Scheduling Algorithm
Real Time Operating Systems
Lets first start with what is operating system and after that I will talk about real time operating system. To understand real time operating systems, first you need to understand operating systems concepts.
An operating system is system software that makes the computer hardware to function. It makes the computer hardware to function and makes it useful to users. Before any other task is accomplished, it needs to be loaded.An Operating System provides interface between computer and computer user. It manages the use and implementation of applications software. Various roles are performed by an operating system, that include operating CPU, controlling I/O devices, handling the working of application programs with hardware and other system softwares and managing and retrieving information. Few popular Operating Systems are MS-DOS, Windows XP, Windows 2000, Windows Server 2003, UNIX and LINUX.
Real Time Operating System introduction
A Real Time Operating System is the type of operating system that is designed to serve real time applications or embedded applications. It is necessarily able to process input data without any delay. The measure of processing time requirements is in tenths of seconds or shorter. The basic structure of RTOS is similar to general purpose operating system. In addition to that it provides mechanisms to allow real time scheduling of tasks. Some examples of real time systems include MTOS, Lynx and RTX. In real life scenerio examples like controlling traffic signals or a nuclear reactor or an aircraft.The figure shows the embedded system with RTOS.
Types of Real Time Operating Systems
Real Time Operating Systems are categorized in two types i.e. Hard Real Time Operating Systems and soft Real Time Operating Systems.
Hard Real Time Operating Systems necessarily perform the task within the given specified deadline. A formal guarantee of always meeting the hard deadline is required.Examples include air traffic control, vehicle subsystems control and Nuclear power plant control.
Soft Real Time Operating Systems are the RTOS that perform task almost in the specified deadline. They do not guarantee a hard deadline. Task can be performed even after the time has elapsed. Examples of Soft Time Operating Systems include multimedia transmission and reception, networking, telecom (cellular) networks, web sites and services and computer games.
Popular Real-Time Operating Systems
|Used small foot print mobile and connected devices
Supported by ARM,MIPS, SH4 & x86 architectures
|LynxOS||Complex, hard real-time applications
POSIX- compatible, multiprocess, multithreaded OS.
Supported by x86, ARM, PowerPC architectures
|Most widely adopted RTOS in the embedded industry.
Used in famous NASA rover robots Spirit and Opportunity
Certified by several agencies and international standards for real time systems, reliability and security-critical applications.
|Micrium µC/OS-II||Ported to more than a hundred architectures including x86, mainly used in microcontrollers with low resources.
Certified by rigorous standards, such as RTCADO-178B
|QNX||Most traditional RTOS in the market.
Microkernel architecture; completely compatible with the POSIX
Certified by FAADO-278 and MIL-STD-1553 standards.
|Symbian||Designed for Smart phones
Supported by ARM, x86 architecture
|VRTX||Suitable for traditional board based embedded systems and SoC architectures
Supported by ARM, MIPS, PowerPC & other RISC
Important RTOS Concpets
The important RTOS concepts are queues, interprocess communication, interrupt management, software timers, semaphores, mutex, etc. We have explained all those concepts using FreeRTOS in the following tutorials:
- FreeRTOS Arduino Getting Started
- FreeRTOS Scheduler
- FreeRTOS: Delete Tasks
- FreeRTOS: Task Priority
- FreeRTOS: Queue Management
- FreeRTOS: Structure Queue
- FreeRTOS: Queue Set
- FreeRTOS: Create Mailbox
- FreeRTOS Interrupt Management
- FreeRTOS: Software Timers
- FreeRTOS: Update and Query Timer ID
- FreeRTOS: Period and Reset Timer
- FreeRTOS: Binary Semaphore
- FreeRTOS: Counting Semaphore
- FreeRTOS: Mutex
- FreeRTOS: Recursive Mutex
- FreeRTOS Gatekeeper Tasks
RTOS has vast applications in most of the technological areas, right from fuel injection systems to nuclear reactor control, satellite control, global positioning systems, and fully equipped high-tech warfare aircraft. And the best is yet to come!