Close this search box.


Real Time Operating System (RTOS)

Before going into real time operating system we should know about the operating system. Operating system is nothing but the interface between the hardware and user of the computer. In other words operating system is a software program which will working according to the user commands using the hardware parts of the computer.  Operating system plays a key role in offering services like memory management, process management, file management, resource allocation (I will explain these terms later) etc.

Examples of operating systems are Windows. Linux, UNIX, apple leopard, Novel Netware, Solaris etc. All these operating systems come under general purpose operating systems (GPOS).

If we look at real time operating system (RTOS) is also an operating system, which will also works as an interface between the hardware of the system and user. RTOS also do the functions like file management, process management, memory management etc. you people will have a doubt that if RTOS does the same functions like general purpose operating system (GPOS) then what is the difference? Before going in to the RTOS and its differences we need to understand the concepts like memory management, process management, file management, interrupt latency, device management, real time systems etc.

Real Time Operating Systems:

System is nothing but group of peripherals connected to each other to process the input data and give output. System which is time dependent that is to process the input data and give output in given time, such systems are called real time systems. Real time system is divided into two systems

  • Hard Real Time Systems.
  • Soft Real Time Systems.

Hard Real Time Systems:

Hard real time system is purely deterministic and time constraint system for example users expected the output for the given input in 10sec then system should process the input data and give the output exactly by 10th second. Here in the above example 10 sec. is the deadline to complete process for given data. Hard real systems should complete the process and give the output by 10th second. It should not give the output by 11th second or by 9th second, exactly by 10th second it should give the output. In the hard real time system meeting the deadline is very important if deadline is not met the system performance will fail. Another example is defense system if a country launched a missile to another country the missile system should reach the destiny at 4:00 to touch the ground what if missile is launched at correct time but it reached the destination ground by 4:05 because of performance of the system, with 5 minutes of difference destination is changed from one place to another place or even to another country. Here system should meet the deadline.

Soft Real Time System:

In soft real time system, the meeting of deadline is not compulsory for every time for every task but process should get processed and give the result. Even the soft real time systems cannot miss the deadline for every task or process according to the priority it should meet the deadline or can miss the deadline. If system is missing the deadline for every time the performance of the system will be worse and cannot be used by the users.  Best example for soft real time system is personal computer, audio and video systems, etc.

Memory Management: In simple words how to allocate memory for every program which is to be run and get processed in the memory (RAM or ROM). The schemes like demand paging, virtual memory, segmentation will under this management only.

Segmentation: It is a memory management scheme where the physical memory is dividing into logical segments according to the length of the program. In the segmentation it will avoid unused memory, sharing will be done easily, protection for the program. Sometime Main memory cannot allocate memory to the segments Because of it variable length and large segments

Paging: in this scheme the physical memory is divided in to fixed size pages. It has all functions of segmentation and also solves its disadvantages. Virtual memory is a memory management scheme where some part of secondary storage device will be used a physical memory when program lacks the physical memory to run the program.

Process Management: thread contains set of instructions which can execute independently of other programs. Collection of thread is called the process or we can say process contains the sequential execution of program and state control of the operating system. Every operating system works by executing series of processes by the processor and give result back to the main memory. Operating systems contains two types of process

System process: these processes are main responsible for working of operating system.

Application process: These processes are invoked when particular application is stared and start executing with the help of other system process.

Operating system should process each and every process given by the user and give results back, OS will also process the process according to the priority. Scheduling algorithm will take care of processes processing and Inter Process communications (IPC) semaphore’s, message queues, shared memory, pipes, FIFO’s will take care of resource allocation of the processes.

File Management: How the files are place in the memory which file should be used by user, file permission (read, write and execute permissions), arrangement of files in the secondary memory and primary memory using file system etc. all the above functions are done by the file management.

Device Management:  management of devices like tape drive, hard drives, processor speed, optical drive, and memory devices will be done by the operating system.

General Purpose OS Vs Real Time OS:

We know that real time operating systems are deterministic, time dependent and mainly used in hard real time systems. Whereas if we take general purpose operating systems they are not deterministic, or time independent and they are mainly used for soft real time system.

Examples for real time operating systems (RTOS) are VxWorks, µcos, Qnx, Rtlinux, window embedded etc. for general purpose operating system (GPOS) are Windows (95,98,Xp, Vista, 7, 8, media center etc.), Linux (Ubuntu, Red hat, fedora, Mandarin, Linux mint, etc. ), Apple (leopard, tiger etc. ), Novel NetWare, Solaris, etc. all these GPOS are used in desktop and server level systems. RTOS are mainly used in Real Time Embedded Systems.

When coming to the difference between RTOS and GPOS:

Determinism: We know that deterministic systems will give same output for given input condition and we can predict output of the system for a given input. RTOS are deterministic operating system which will take same time to give output for different inputs. Whereas in GPOS we cannot predict the output but we cannot predict the time of the output, in GPOS mostly randomness is involved. Example for RTOS is mainly used in defense systems which are more deterministic (missile launching operations, communication systems etc.). GPOS are used for normal applications like audio video systems, personal computer etc.

Hardware architecture: GPOS are used on heavy architecture; for example PC, Servers, mainframes etc. RTOS are light weight operating systems which are used in small architecture like mobile phones, chocolate vending machines and other embedded applications. Usually RTOS process are fixed and normally used in small applications where we will use only limited number of tasks to do, example: if we take normal chocolate vending machine it will show the display of different chocolates and price of the chocolates. If the user selected the chocolate vending machine must check the amount given by the user and deliver the chocolate, if the amount is not sufficient it should display a warning message. But in GPOS we can add another process accordingly to do more tasks; for example in normal windows operating system we add many extra applications like IDE, software’s for games, players etc.). In the hardware RTOS can run on very small configuration like (few kilobytes of ram, micro controller as CPU etc.) if we take GPOS need minimum of (64 MB of ram and need high end microcontroller or microprocessor as CPU).

Kernel: RTOS will use pre-emptive kernel where as normal GPOS will use non pre-emptive kernel. Pre-emptive kernel will run in kernel mode and process the threads according to the priority. If a high priority process came to the CPU pre-emptive kernel will immediately treat all other process as the external process, context switch to the high priority process and process it. Where as in the non preemptive kernel if a high priority process came to the processor, the existing process which CPU is processing may allow the high priority process to context switch and process high priority process or high priority process should wait until the existing process is completed.

Scheduling: Scheduling is a method in which will provide the resources of the system to the process. The main reason of developing scheduling algorithm is for multitasking operating system which has to manage number of process at a time. RTOS scheduling algorithm is based on priority, that is process should be scheduled according to there priority. In RTOS always highest priority tasks are scheduled first and low priority process are paused until the high priority process are processed. If any high priority process came for scheduling the existing process are context switch and schedule the high priority process first for processing. In GPOS Scheduling is not based on priority if a high priority process came for processing it should wait until the existing process is processed. For GPOSthroughput is high (throughput means number of process complete there processing at one time) for RTOS throughput is always low. RTOS used rate monotonic, earlier deadline first, preemptive scheduling algorithms where as GPOS uses completely fair scheduling, round robin, rotary inventor fair scheduling, O(1) etc.

Interrupt Latency: interrupt latency of the RTOS is always zero. When we take the GPOS interrupt latency is more when it has to process when number of process at a time.

Concepts like virtual memory, paging, and huge file system management are not present in RTOS. And RTOS is more economical for embedded devices rather than choosing GPOS.

We will discuss about Kernel, Compilation of kernel, Porting, Android compilation in next sessions.

5 Responses

  1. I enjoyed the stuff above.its well explained and straight to the point. I read about Firm RTOS and didn’t exactly see the difference with Hard RTOS.

Leave a Reply

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