Difference between a GPOS (Normal General Purpose Operating System) and an RTOS (Real Time Operating System)
The whole purpose of this article is to outline the basic differences between a GPOS (General Purpose Operating System) or a Normal OS as many people call it and an RTOS (Real Time Operating System). Let’s have a look.Image Courtesy
The basic difference of using a GPOS or an RTOS lies in the nature of the system – i.e whether the system is “time critical” or not! A system can be of a single purpose or multiple purpose. Example of a “time critical system” is – Automated Teller Machines (ATM). Here an ATM card user is supposed to get his money from the teller machine within 4 or 5 seconds from the moment he press the confirmation button. The card user will not wait 5 minutes at the ATM after he pressed the confirm button. So an ATM is a time critical system. Where as a personal computer (PC) is not a time critical system. The purpose of a PC is multiple. A user can run many applications at the same time. After pressing the SAVE button of a finished document, there is no particular time limit that the doc should be saved within 5 seconds. It may take several minutes (in some cases) depending upon the number of tasks and processes running in parallel. I hope you got the basic idea now!
A GPOS is used for systems/applications that are not time critical. Example:- Windows, Linux, Unix etc.
An RTOS is used for time critical systems. Example:- VxWorks, uCos etc. You can read a good article about the basic concepts of an RTOS here:- What is Real Time Operating System. We can also say an RTOS is supposed to give quick and predictable response.
Now lets get into differences in the working of GPOS and RTOS.Before going deep down, it will be good if you read this article from Howstuffworks- about Operating Systems.
Lets take the case of task scheduling first. In the case of a GPOS – task scheduling is not based on “priority” always! GPOS is programmed to handle scheduling in such a way that it manages to achieve high throughput. Here throughput means – the total number of processes that complete their execution per unit time. In such a case, some times execution of a high priority process will get delayed inorder to serve 5 or 6 low priority tasks. High throughput is achieved by serving 5 low priority tasks than by serving a single high priority one. Where as in an RTOS – scheduling is always priority based. Most RTOS uses pre-emptive task scheduling method which is based on priority levels. Here a high priority process gets executed over the low priority ones. All “low priority process execution” will get paused. A high priority process execution will get override only if a request comes from an even high priority process.
Hardware and Economical factors
An RTOS is usually designed for a low end, stand alone device like an ATM, Vending machines, Kiosks etc. RTOS is light weight and small in size compared to a GPOS. A GPOS is made for high end, general purpose systems like a personal computer, a work station, a server system etc. The basic difference between a low end system and high end system is in it’s hardware configuration. Now a days a personal computer or even a smart phone comes with high speed processors (in the range of many Gigahertz), large RAM’s (in the range 2 or 3 GB’s and even higher) etc. But an embedded system works on low hardware configurations usually – speed in the range of Megahertz and RAM in the range of Megabytes. A GPOS being too heavy demands very high end hardware configurations. It is economical to port an RTOS to an embedded system of limited expectations and functionalities (Example: An ATM is supposed to do only certain functions like Money transfer, Withdrawal, Balance check etc). So it is more logical to use an RTOS inside the ATM with its limited hardware. It is not economical to improve the hardware of an ATM just to port a GPOS as it’s user interface.
Another major issue with a GPOS is unbounded dispatch latency, which most GPOS falls into. The more number of threads to schedule, latencies will get added up! An RTOS has no such issues because all the process and threads in it has got bounded latencies – which means – a process/thread will get executed within a specified time limit.
The kernel of an RTOS is preemptible where as a GPOS kernel is not preemptible. This is a major issue when it comes to serving high priority process/threads first. If kernel is not preemptible, then a request/call from kernel will override all other process and threads. For example:- a request from a driver or some other system service comes in, it is treated as a kernel call which will be served immediately overriding all other process and threads. In an RTOS the kernel is kept very simple and only very important service requests are kept within the kernel call. All other service requests are treated as external processes and threads. All such service requests from kernel are associated with a bounded latency in an RTOS. This ensures highly predictable and quick response from an RTOS.
These all are the basic differences between an RTOS and GPOS. I have written this article from the perspective of an embedded system, which analyses which OS is better for an embedded system. If we go even beyond there are many many points to discuss, but it is not in the scope of this article. As an example I can say, many GPOS in market, now has got real time extensions which aims to solve the drawbacks of a GPOS in real time systems. Some vendors have even introduced a dual kernel system – which has one kernel to serve for GPOS and another kernel to serve for real time systems.