155 Views

Ultimate Guide: Embedded Operating System

30/08/2021, hardwarebee

Most of us are familiar with operating systems such Microsoft’s Windows, Apple’s macOS. We interact daily with these operating systems; therefore, they are so known and popular. In fact, there are many other operating systems used in embedded devices such as home appliances, automotive systems — these products are using embedded operating system.

 

What is Embedded Operating System?

 

Let’s define the term embedded operating system:

 

Embedded: it refers to embedded systems applications, and embedded means that an electronic system which is not a PC.

 

Operating system: some embedded products require an operating system layer to manage the hardware and the application software. The following figure shows the layers of an embedded system.

 

 

As you can see in the above figure, an embedded operating system model is based on:

 

  • Hardware layer
  • System Software Layer which contains the operating system layer
  • Application Software Layer

 

An operating system is mainly a group of libraries that provide two important major magic words in the embedded systems world, Abstraction and resource management.

 

Operating System Functions and Responsibilities

 

Most of the operating systems responsible for the following:

 

  • Process Management
  • Memory Management
  • Input/output System Management

 

Process management is an important feature of an operating system, it allows the OS to handle and view other components and software in the embedded system using processes.

 

Memory Management is also another feature, and it is a vital and important feature since all the memory space of an embedded system is most of the time shared by the other processes, so it requires management of the accessibility.

 

Input and output System Management is like memory management feature since the input and output devices also are shared with various processes.  In the following figure, you can see more of the layers and the position of each feature.

 

As you can see in the above figure, embedded OS has a kernel or a core. The kernel of the operating system has three features (Process management, Memory management, I/O management).

 

As said before the kernel has subsystems as in the following figure:

 

 

Keep in mind that in most operating systems, the process management is the central subsystem in any OS and other systems rely on it as in the diagram.

 

The code we write goes into RAM or cache and then the processor will execute. So, the process management module also relies on the memory management module in this case.

 

Additionally, there are some features like networking input / output can be interfaced with the memory management module as in the following figure:

 

 

Looking at the main functions of the kernel from the outside, we will find that the memory management module and input/output module depend on the device drivers, especially for hardware access.

 

Embedded Operating Systems Models

 

There are main three embedded operating systems models:

  • Monolithic
  • Layered
  • Microkernel

 

These models also may be different based on the internal design of the kernel itself, in the following figure an example of monolithic OS diagram:

 

This model of operating systems is very hard to be modified and also very complex in debugging. It is very hard since all components depend on each other.

Example of monolithic Operating system: Embedded Linux, JbedRTOS, MicroC/OS-II:

The following figure is an example of a layered OS diagram. As you can see in the layered OS model, each layer has some operating system features.  The layers on the top depending on the lower layers. It is similar to the monolithic OS model since it is a single file that has all components like device drivers, and middleware, however, it is easier than monolithic OS in modification and debugging.

Example of layered Operating system: FreeRTOS, Disk Operating System or DOS, and VRTX.

 

In the following figure an example of microkernel OS diagram. This model of operating systems is the most editable and scalable due to its modularity and it is very in debugging.

 

 

This model is also very secured in compared with the other two models since most the functions of this model are independent of the operating system. For example, you can add a memory space for client and server architecture. On the other hand, this model is not the best one in the speed and it is slower than the other two models (monolithic and layered).

 

Example of microkernel Operating system: VxWorks, QNX, Nucleus Plus, and CMX-RTX

 

General Purpose Operating systems vs RTOS

 

General-purpose operating systems and real-time operating system have the following similarities:

 

  • They are both multitasking
  • They have resource management services
  • They have both the same level of abstraction

 

The differences between RTOS and GPOS:

  • RTOS is more reliable in embedded systems applications
  • RTOS is more scalable than GPOS
  • RTOS can be used for real-time systems applications
  • Easy to be ported to many platforms than GPOS

 

Hard vs Soft Real Time Operating Systems

 

There are two types of real-time systems:

  • Hard real-time system
  • Soft real-time system

 

In a hard-real-time operating system, if the response of the system was not on time not before or after the deadline, it can cause catastrophic results. For example, the airbag system in cars is a hard-real-time system, if the airbag system doesn’t open in time upon a collision, it may cause death.   On the other hand, a soft real-time system can be tolerant if it missed a deadline. For example, the LED on your multi-meter, if it didn’t work when measuring your circuit voltage, will not cause hurt.

 

 

RTOS and the Scheduler

 

In every real-time operating system, there is a scheduler, which is the core or the heart of the operating system kernel. The scheduler is responsible for services like multitasking, context switching and also scheduling algorithms

 

Multitasking

 

From the name, multitasking is the skill or the ability to do more than a task at the same time. Embedded operating systems have the ability to handle more than activity within a specific deadline.  But technically embedded operating systems use a technique called a context switch.

The context switch is responsible to run each task in its own context. This only occurs in the case of running or switching from one task to another by the scheduler.

 

Embedded Operating Systems Applications and Differences

 

There are many embedded operating systems, but we will check some of the most popular systems and vendors:

 

VxWorks

  • It has been developed by Wind River
  • It is one of the top embedded operating systems
  • It is based on microkernel model, so it is not very fast comparing to other OSs

https://www.windriver.com/products/vxworks

 

QNX

  • It has been developed by Quantum Software Systems, now blackberry)
  • It is a microkernel-based operating system
  • Applications: automotive, industrial automation, medical industry, autonomous systems

https://blackberry.qnx.com/en

 

Integrity

  • It has been developed by Green Hills
  • It is a POSIX-RTOS
  • Applications: F22, Toyota cars, B787, Train Control Systems
  • It is designed to be used as a hard-real time OS
  • It works on many architectures
  • Hard to use and closed source

https://www.ghs.com/products/rtos/integrity.html

 

 

Open Source Embedded Operating System

 

Linux is a free open-source operating system, and it can be customized to be used for embedded systems, you may see the term “Embedded Linux” technically, there is no embedded Linux, but we can customize the Linux operating system to run on embedded systems.

 

Why should we use Linux as an embedded operating system?

 

  • It is open-source and license-free
  • It is stable and secure
  • It has a huge community of supporters and users
  • Customizable and can be rewritten to produce new OS

 

Disadvantages

  • It is a monolithic operating system, meaning very complex kernel
  • Difficult in debugging
  • Requires strong knowledge in systems programming for modifications
  • Not the best choice for real-time safety critical applications

 

Linux OS has 4 major components

  • Kernel
  • Bootloader
  • Shared libraries
  • Commands and utilities

 

The bootloader is a firmware or a software that runs directly on the hardware when you power on the device, it does some work to check the hardware and loading the kernel.

 

The Kernel is an intermediary layer between the user applications and the hardware, additionally, it manages the hardware resources and has three main services as we mentioned before:

  • Input/output management
  • Memory management
  • Process management

 

In Linux everything is a file not like windows operating system:

  • There are no partitions in Linux
  • The root file system is used for logic organization
  • Kernel modules are files under the root file system
  • There are also configurations and system utilities

 

Embedded Linux is a good choice for display embedded devices and non-critical applications such as entertainment automotive infotainment systems.

Recent Stories