by Dinesh Thakur Category: Operating System

The real-time operating system used for a real-time application means for those applications where data processing should be done in the fixed and small quantum of time. It is different from general purpose computer where time concept is not considered as much crucial as in Real-Time Operating System. RTOS is a time-sharing system based on clock interrupts. Interrupt Service Routine (ISR) serve the interrupt, raised by the system. RTOS used Priority to execute the process. When a high priority process enters in system low priority process preempted to serve higher priority process. Real-time operating system synchronized the process. So that they can communicate with each other. Resources can be used efficiently without wastage of time.

RTOS are controlling traffic signal; Nuclear reactors Control scientific experiments, medical imaging systems, industrial system, fuel injection system, home appliance are some application of Real Time operating system

Real time Operating Systems are very fast and quick respondent systems. These systems are used in an environment where a large number of events (generally external) must be accepted and processed in a short time. Real time processing requires quick transaction and characterized by supplying immediate response. For example, a measurement from a petroleum refinery indicating that temperature is getting too high and might demand for immediate attention to avoid an explosion.

In real time operating system there is a little swapping of programs between primary and secondary memory. Most of the time, processes remain in primary memory in order to provide quick response, therefore, memory management in real time system is less demanding compared to other systems.

Time Sharing Operating System is based on Event-driven and time-sharing the design.

The event Driven : In event-driven switching, higher priority task requires CPU service first than a lower priority task, known as priority scheduling.

Time Sharing : Switching takes place after fixed time quantum known as Round Robin Scheduling.

In these design, we mainly deal with three states of the process cycle

1) Running : when CPU is executing a process, then it is in running state.

2) Ready : When a process has all the resources require performing a process, but still it is not in running state because of the absence of CPU is known as the Ready state.

3) Blocked : when a process has not all required resources for execution, then it is blocked state.

Interrupt Latency : Interrupt latency is time between an interrupt is generated by a device and till it serviced. In RTOS, Interrupt maintained in a fixed amount of time, i.e., latency time bounded.

Memory Allocation: RTOS support static as well as dynamic memory allocation.Both allocations used for different purpose.Like Static Memory, the allocation is used for compile and design time using stack data structure. Dynamic memory allocation used for runtime used heap data structure.

The primary functions of the real time operating system are to:

1. Manage the processor and other system resources to meet the requirements of an application.

2. Synchronize with and respond to the system events.

3. Move the data efficiently among processes and to perform coordination among these processes.

The Real Time systems are used in the environments where a large number of events (generally external to the computer system) is required to be accepted and is to be processed in the form of quick response. Such systems have to be the multitasking. So the primary function of the real time operating system is to manage certain system resources, such as the CPU, memory, and time. Each resource must be shared among the competing processes to accomplish the overall function of the system Apart from these primary functions of the real time operating system there are certain secondary functions that are not mandatory but are included to enhance the performance:

1. To provide an efficient management of RAM.

2. To provide an exclusive access to the computer resources.

The term real time refers to the technique of updating files with the transaction data immediately just after the event that it relates with.

Few more examples of real time processing are:

1. Airlines reservation system.

2. Air traffic control system.

3. Systems that provide immediate updating.

4. Systems that provide up to the minute information on stock prices.

5. Defense application systems like as RADAR.

Real time operating systems mostly use the preemptive priority scheduling. These support more than one scheduling policy and often allow the user to set parameters associated with such policies, such as the time-slice in Round Robin scheduling where each task in the task queue is scheduled up to a maximum time, set by the time-slice parameter, in a round robin manner. Hundred of the priority levels are commonly available for scheduling. Some specific tasks can also be indicated to be non-preemptive.

Components of real time operating system

A real time operating system contains the following components:
The Scheduler: this element in RTOS tells that in which order the tasks can be executed which is generally based on the priority. It is the main element of RTOS.
Symmetric Multiprocessing (SMP): a number of different multiple tasks can be handled by the RTOS as this is its ability so that parallel processing can be done. This is also known as multitasking.
Function Library: It is the element of RTOS which acts as a interface so that it can connect kernel and application code. This application code sends the requests to the kernel via function library so that the application can give the desired result.
Memory Management: this element is required so that the system can allocate the memory to every program. It is an important element of the RTOS.
Fast dispatch latency or context switch time: The term dispatch latency means the time interval between the termination of the task which is identified by the operating system and the time taken by the thread, which is in the ready queue, that has started processing.
As its name implies, context switch time is the time which the system takes to switch from one running thread to another. This time saves the context of the current task and also replaces it with the context of new thread and this time needs to be minimal and optimal for an RTOS.
User-defined data objects and classes: RTOS makes use of the programming languages like C/C++ which are organized according to the type of their operation. RTOS will use them so that it can control the specified application.

Types of Real-Time Operating System

1) Soft Real-Time Operating System : A process might not be executed in given deadline. It can be crossed it then executed next, without harming the system. Example are a digital camera, mobile phones, etc.

2) Hard Real-Time Operating System : A process should be executed in given deadline. The deadline should not be crossed. Preemption time for Hard Real-Time Operating System is almost less than few microseconds.

Examples are Airbag control in cars, anti-lock brake, engine control system, etc.

Applications of Real Time Operating System

Control systems: RTOS are designed in such a way so that they can control actuators and sensors. They can execute control system commands. Controlled systems are those which can be monitored by using sensors and their tasks can be altered with the help of actuators. Now the task of the RTOS is to read the data from the sensors and move the actuators by performing some calculations so that flight’s movement can be handled.
Image processing (IP): real time image processing is done so that we can make some adjustments for the moving objects. In this, we need our computers, cameras or other gadgets should work in real time as utmost precision is required in the industrial automation tasks. For ex, something happens with the conveyor belt when the item is moving downwards or some other defect occurs, we can control these problems in the real time if our system works in real time.
Voice Over IP (VoIP): we can transmit voice over IPs or internet protocol in real time. This is known as VoIP. In this our voice is digitalized, compressed into small form and converted into IP packets in real time before transmitting it to the other network on router through IP.

Difference between in GPOS and RTOS

General-Purpose Operating System (GPOS)
Real-Time Operating System (RTOS)
1) It used for desktop pc, laptop.

1) It applied for the embedded application.

2) Process-based Scheduling used.

2) Time-based scheduling used like round robin.

3) Interrupt latency is not considered as much crucial as in RTOS.           3) Interrupt lag is minimal, measured in few microseconds.
4) No priority inversion mechanism is present in the system.             4) Priority inversion mechanism is current.Once priority set by the programmer, it can’t be changed by the system itself.
5) Kernel operations may or may not be preempted.   5) Kernel operation can be preempted.

Considerations for choosing a RTOS

Performance: it is the most important factor needed to be considered while choosing for a RTOS. As we know RTOS is a system which gives us guarantee about the data within a given frame of time. So it does not take care of our PC whatever is happening with it.  So we must have to keep a check on its performance.
Unique features: A good RTS must be scalable and it has some extra features like efficient protection of the memory of the system, how it operates to execute commands etc.. So, we have to evaluate these features so that our system can run effectively and efficiently.
Your IT team: A good RTOS is that which works in the favor of our IT team. Here, favor means reducing the labor intensity of the team. If this intensity of the team get reduced, then the team can concentrate on other factors. So we have to decide those RTOS, through which our team can easily familiar with.
Middleware: if there will be no middleware support in RTOS, then the problem of time-consuming integration of processes will take place. Here, middleware support means those components which can be integrated with our RTOS.
Advantages of real time operating system
Error free: Real time operating systems are error-free. So there is no chance of getting an error when we are performing the task.
Maximum Consumption: we can achieve maximum consumption by using RTOS. It keeps all the devices active and produces more output by making use of all the resources.
Embedded system usage: As the programs of the RTOS are of small size. So, we make use of RTOS in embedded systems.
Task shifting: In RTOS, shifting time of the tasks is very small.
24/7 performance: RTOS is best used for those applications which run constantly or you can say that which runs for 24 hours and 7 days in a week. This is possible because of fewer shifting of tasks so that it can give maximum output.
Application focus: in RTOS, a very few tasks are managed so that exact results can be given by the system. It gives very less importance to those applications which are in waiting state. 

Disadvantages of Real Time Operating System

Limited tasks: RTOS can run very limited tasks simultaneously and it concentrates on only those applications which contain error so that it can avoid them. Due to this, some tasks have to wait for unlimited time.
Low multi-tasking: As RTOS is the system which concentrates on few tasks. So sometimes it is difficult for these systems to do multi-tasking.
Device driver and interrupt signals: Some specific drivers are needed for the RTOS so that it can give fast response to the interrupt signals to maintain its speed.
Expensive: As stated earlier, a lot of resources are used by RTOS which makes it expensive.
Low priority of tasks: The tasks which has the low priority has to wait for a long time as the RTOS maintain the accuracy of the current programs which are under execution.
Thread priority: as we know that there is very less switching of tasks is done in RTOS. So that’s why its thread priority is not good.
Precision of code: as we know, in RTOS, event handling of tasks is a strict process as it is error-free. So more precision in code is required which is a difficult task for the programmer as getting exact precision is not so easy.
Complex algorithms: it makes use of some complex algorithms so that the system can give the desired output. These complex algorithms are difficult to understand.
Use heavy system resources: real time operating system makes use of a lot of resources. Sometimes it is not good for the system. It seems to be expensive also.
Not easy to program: Sometime the programmer has to write the complex programs for the efficient working of the RTOS which is not an easy task.
Other factors: some other factors like error handling, memory management and CPU are also needed to be considered.





About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles