RTOS vs GPOS (In terms of Task Scheduling)

We have discussed the Real-Time Application (RTA) in my previous blog. I recommend you to go through it before heading to this tutorial. If you are already familiar with RTAs, then you are free to skip them.

What is a Real-time operating system ( RTOS )?

RTOS is an operating system specially designed to run the application with very precise timing and a very high degree of reliability.

For an Operating System to be considered as a real-time system, it must have a known maximum time for each of the critical operation that it performs. In short, it should have both real-time capabilities and some of the features of an operating system. Some of the operations of real-time operating systems are,

  • Handling of interrupts and internal system exceptions.
  • Handling of critical sections
  • Scheduling Mechanisms
  • Synchronization
  • Mutal Exclusion
  • Priority Inheritance…etc

FreeRTOS, VxWorks, QNX etc are examples of Real-time operating systems. We will be using FreeRTOS for all our tutorials in this series.

What is a General-purpose operating system ( GPOS )?

GPOS is an operating system for performing multiple tasks at the same time, but issues with latency and synchronization make them less than ideal for time-sensitive applications. Windows, Linux, Mac OS etc are examples of general-purpose operating systems whereas Android and IOS come under the category of an Embedded OS.

RTOS vs GPOS

GPOS ( Task Scheduling )

GPOS is programmed to handle scheduling in such a way that it manages to achieve high
throughput. Throughput is defined as the total number of processes that complete their execution per unit time.

In GPOS, some times the execution of a high priority process will get delayed in order to serve 7 or 8
low priority tasks. High throughput is achieved by serving 7 low priority tasks than by serving a single high priority one.

In a GPOS, the scheduler typically uses a fairness policy to dispatch threads and processes onto the CPU. Such a policy enables the high overall throughput required by desktop and server applications but offers no guarantees that high-priority, time-critical threads or processes will execute in preference to lower-priority threads.

RTOS ( Task Scheduling )

On the other hand in RTOS, the execution of the thread is in the order of their priority. If a high priority thread becomes ready to run, it will take over the CPU from any lower priority thread which is currently being executing. Here a high priority thread gets executed over the low priority ones. All “low priority thread execution” will be blocked until the higher priority thread finishes its execution. A high priority thread execution will get override only if a request comes from an even higher priority thread.

RTOS vs GPOS ( Task Scheduling )

In the case of a GPOS, the scheduling of task is not based on “priority” always. Whereas in RTOS – scheduling is always priority based. Most RTOS use the pre-emptive task scheduling method which is based on priority levels.

RTOS may yield less throughput than the General Purpose OS because it always favours the high priority task to be executed first, but that doesn’t mean, it has very poor throughput. A Quality RTOS will still deliver a decent overall throughput but can sacrifice the throughput for being deterministic or to achieve time predictability.

For the RTOS, achieving predictability or time deterministic nature is more important
than throughput, but for the GPOS achieving higher throughput for user convenience
is more important.

Next Chapter: RTOS vs GPOS (In terms of Task Switching Latency & Interrupt Latency)

3 Likes

Very nice Tutorial on RTOs