Contents
General Purpose Operating Systems (GPOS)
The GPOS is an operating system that can manage a high number of processes and complete an execution per unit time—which we like to call throughput. Sometimes, the general-purpose OS would delay the execution of a high-priority thread to execute five or six low-priority processes.
Computer workstation
Source: Pixabay
So, to achieve the necessary high throughput, it would serve five low-priority tasks rather than execute one high-priority process. In other words, if several low-priority tasks are queued up for execution, the GPOS would allow these tasks to run first so it maintains its high throughput.
Now, most general-purpose operating systems use a fairness policy to carry processes and threads to the CPU.
Plus, this policy allows the GPOS to give the overall high output the desktop and server applications require to work efficiently.
But, it can’t guarantee that a high-priority task or time-critical threads will execute before low priority threads. Thus, the general-purpose operating system works better for devices that perform multiple tasks at the same time.
Personal computer (PC)
Source: Pixabay
Real-Time Operating System (RTOS)
On the other hand, RTOS has a design that handles time-critical applications with high precision. For an operating system to fall under this category, it must have a maximum period of time for each critical operation it performs. In other words, it is a time-bound system.
A real-time operating system is quite complex. But don’t worry, we’ll break it down for you. The RTOS has three basic functionalities which are scheduler, RTOS services, synchronization, and messaging.
The Scheduler
The scheduler has three states: first is ready to run state, which applies to a ready task that can switch to a running state when necessary. Second is the running state which applies to when a task is executing. Lastly, the blocked state is when the task can’t run and is sent to a blocked state.
Also, there are three types of scheduling techniques which are:
Pre-emptive Task Scheduling Method/Priority-Based Scheduling
The pre-emptive scheduling technique involves priority-dependent time allocation. Here, you can assign a unique priority level to each task.
Co-operative Scheduling
Here, you can assign a fixed slot to each task. However, if the task doesn’t complete its execution, it will lose the generated data and wait for its next turn.
Lastly, the kernel takes care of creating a task, changing the priority of a task, changing the state of a task, and deleting a task.
RTOS Services
At the heart of every operating system is a kernel. The kernel is responsible for managing and allocating the resources of an operating system. However, tasks can’t always catch the attention of the CPU, so the kernel must provide other services like time services, input-output services, interrupt handling services, memory management services, and device management services.
Kernel diagram
Source: Wiki Commons
Messaging and Synchronization
The messaging functionality offers a way for the RTOS to communicate with other systems between tasks. The messaging services include mailboxes, pipes, message queues, event flags, and semaphores.
Mailboxes, message queues, and pipes can send messages among tasks, while event flags can synchronize all inter-task activities. Also, semaphores can synchronize access to shared resources.
RTOS (Real-Time Operating Systems) vs GPOS (General Purpose Operating Systems)
The basic difference between the RTOS and the GPOS is the nature of the application (whether it’s time-critical or not or single or multi-purpose). A good example of a time-critical system is an automated teller machine. A person would wait 4 or 5 seconds to get money from an ATM after pressing the confirm button. No one would like to wait five minutes after pressing the confirmation button.
ATM
On the other hand, PCs have multiple purposes making it a system that’s not time-critical. You can run various applications at the same time with a PC. Furthermore, there’s no particular time to do anything on a PC or even a smartphone. For instance, saving a document can take seconds or minutes in some cases. But this depends on the number of running processes and tasks.
Smartphone
So, a general-purpose operating system works for non-time-critical applications and systems like Linux, Windows, etc.
Linux System
Real-time operating systems work for time-critical applications that need quick and predictable responses—like UCOS, VxWorks, etc.
Here are categories to further explain the differences between the two operating systems:
Task Scheduling
In the category of task scheduling, the GPOS doesn’t focus on priority. It handles scheduling in a manner that delivers high throughput. In the case of an RTOS, scheduling is always focused on priority. Unlike the GPOS, all high-priority processes execute before any low-priority task.
Windows
Latency Issues
Here’s one major issue that plagues the GPOS. Most GPOS have unbounded dispatch latency—which means the more threads to schedule, the more latencies add up. RTOS doesn’t have such issues as all threads and processes have bounded latencies (threads will execute within a set time limit).
Economical and Hardware Factors
RTOS works for standalone and low-end systems like a vending machine or ATM. Plus, the RTOS is small and light weight when compared to a GPOS. Additionally, GPOS works for general purposes and high-end devices like workstations or personal computers.
High-end devices
Source: Wiki Commons
Preemptible Kernel
One major problem when it comes to high-priority process execution first is a preemptible kernel. So, if a kernel is not preemptible, then a request from this kernel would immediately override all other running processes. While the kernel of an RTOS is preemptible, the kernel of a GPOS is not.
In other words, a high-priority process execution in a GPOS can’t pre-empt a kernel call, while high-priority processes in RTOS will always pre-empt a low-priority task if necessary and treat tasks outside the kernel call as external processes.
Evaluating and Selecting an RTOS for an Embedded Product Development
Before you evaluate an embedded RTOS that fits all the requirements of embedded systems, ensure you check the prospective RTOS supports some important features.
To make things easier for you, here’s an outline of these critical features:
Schedulers
The schedulers of operating systems handle the duty of deciding what time the OS should execute each task. Schedulers can suspend and resume any task depending on the available resources and priority. Thus, an embedded RTOS must have an in-built scheduler. It will allow the RTOS to perform real-time execution of tasks.
Software Timers
As the name implies, software timers enable the execution of functions within a specified time window. It’s not easy or advisable to manually create a software timer for your RTOS, so make sure you select an RTOS with an in-built software timer.
Queuing Mechanism
Queues allow tasks to exchange information. An RTOS with an in-built queuing mechanism will enable the exchange of messages between tasks.
Execution Trace Tools
With the tracing tool, you can easily observe the real-time behavior of real-time systems. Thus, your development team can track and detect any errors and the execution of tasks.
Low Memory Footprint
Since you need to integrate an RTOS into an MCU platform, the prospective RTOS should have a low memory footprint. It means the total size should not be more than 10% of the MCU’s total size.
RTOS Architecture
Source: Wiki Commons
Wrapping Up
In a nutshell, both RTOS and GPOS work well in applications made for them. Though RTOP may dish out lesser throughput than the GPOS, it doesn’t mean its throughput is low.
While the GPOS handles a lot of heavy processes, the RTOP handles fewer tasks with a throughput relative to the system’s load.
However, the major concern of an RTOS is delivering a more predictable execution pattern and timely execution–not high throughput. However, the reverse is the case for the GPOS. Well, that wraps up everything about the GPOS vs RTOS. If you have any comments or questions, feel free to reach us. We’ll be happy to help.