Embedded System
RTOS & Kernel
RTOS: A real-time operating system (RTOS) is a special purpose OS that guarantees real-time applications a
certain capability within a specified deadline. RTOSes are designed for critical systems and for devices
like microcontrollers that are timing-specific. RTOS processing time requirements are measured in milliseconds.
The various examples of Real-time operating systems are MTS, Lynx, and QNXVx Works etc.
Types of Real-time operating system:
Following are the three types of RTOS systems are:
Hard Real-Time operating system:
In Hard RTOS, all critical tasks must be completed within the specified time duration, i.e., within the given
deadline. Not meeting the deadline would result in critical failures such as damage to equipment or even loss of
human life.
For Example, Let’s take an example of airbags provided by carmakers along with a handle in the driver's seat.
When the driver applies brakes at a particular instance, the airbags grow and prevent the driver's head from hitting
the handle. Had there been some delay even of milliseconds, then it would have resulted in an accident.
Soft Real-Time operating system:
Soft RTOS accepts a few delays via the means of the Operating system. In this kind of RTOS, there may be a
closing date assigned for a particular job, but a delay for a small amount of time is acceptable. So, cut off dates are
treated softly via means of this kind of RTOS.
For Example,
Channel changes in TV
Firm Real-Time operating system:
In Firm RTOS additionally want to observe the deadlines. However, lacking a closing date might not have a
massive effect, however may want to purposely undesired effects, like a massive discount within the fine of a
product.
For Example, this system is used in various forms of Multimedia applications.
Characteristics of a real-time operating system:
Small footprint. Compared to general OSes, real-time operating systems are lightweight.
High performance. RTOSes are typically fast and responsive.
Determinism. Repeating inputs end in the same output.
Safety and security. Safety-critical and security standards are typically the highest priority, as RTOSes are
frequently used in critical systems.
Priority-based scheduling. Tasks that are assigned a high priority are executed first followed by lower-
priority jobs.
Applications of Real-time operating system (RTOS):
RTOS is used in real-time applications that must work within specific deadlines. Following are the common areas
of applications of Real-time operating systems are given below.
o Real-time running structures are used inside the Radar gadget.
o Real-time running structures are utilized in Missile guidance.
o Real-time running structures are utilized in on line inventory trading.
o Real-time running structures are used inside the cell phone switching gadget.
o Real-time running structures are used inside the Fuel injection gadget.
o Real-time running structures are used inside the Traffic manipulate gadget.
o Real-time running structures are utilized in Autopilot travel simulators
Advantages:
The advantages of real-time operating systems are as follows-
1. Maximum consumption –
Maximum utilization of devices and systems. Thus more output from all the resources.
2. Task Shifting –
Time assigned for shifting tasks in these systems is very less. For example, in older systems, it takes about
10 microseconds. Shifting one task to another and in the latest systems, it takes 3 microseconds.
3. Focus On Application –
Focus on running applications and less importance to applications that are in the queue.
4. Real-Time Operating System In Embedded System –
Since the size of programs is small, RTOS can also be embedded systems like in transport and othe rs.
5. Error Free –
These types of systems are error-free.
6. Memory Allocation –
Memory allocation is best managed in these types of systems.
Disadvantages:
The disadvantages of real-time operating systems are as follows-
1. Limited Tasks –
Very few tasks run simultaneously, and their concentration is very less on few applications to avoid errors.
2. Use Heavy System Resources –
Sometimes the system resources are not so good and they are expensive as well.
3. Complex Algorithms –
The algorithms are very complex and difficult for the designer to write on.
4. Device Driver And Interrupt signals –
It needs specific device drivers and interrupts signals to respond earliest to interrupts.
5. Thread Priority –
It is not good to set thread priority as these systems are very less prone to switching tasks.
6. Minimum Switching – RTOS performs minimal task switching.
Real-Time Operating System General Purpose Operating System
The RTOS always uses priority-based scheduling. Threads and processes are often dispatched using a
"fairness" policy.
The time response of the RTOS is deterministic. The time response of the general-purpose operating
system is not deterministic.
A low-priority job in an RTOS would be pre-empted by A high-priority thread in a GPOS cannot pre-empt a
a high-priority one if required, even executing a kernel kernel call.
call.
The real-time operating system optimizes memory The GPOS does not optimize the memory resources.
resources.
The RTOS is mainly used in the embedded system. GPOS is mainly used in PC, servers, tablets, and
mobile phones.
The real-time operating system has a task deadline. The general-purpose operating system has no task
deadline.
It doesn't have large memory. It has a large memory.
RTOS is designed and developed for a single-user GPOS is designed for a multi-user environment.
environment.
Examples: Contiki source code, QNXVx etc. Examples: Windows, IOS, etc.
Kernel
Kernel is a central component of an operating system that manages operations of computer and hardware. It
basically manages operations of memory and CPU time. It is core component or heart of an operating system.
Kernel acts as a bridge between applications and data processing performed at hardware level using inter -process
communication and system calls.
Kernel loads first into memory when an operating system is loaded and remains into memory until operating
system is shut down again. It is responsible for various tasks such as disk management, task management, and
memory management.
Functions of the Kernel in Operating System
The main functions that the Kernel performs are as follows:
1. Process Management
2. Memory Management
3. Device Management
4. Interrupt Handling
5. Input Output Communication
1. Process Management
There are many processes which are in live state inside the system. The management of all these processes is
very important to avoid deadlocks and for the proper functioning of the system, and it is handled by the Kernel.
2. Memory Management
Whenever a process is created and executed, it occupies memory, and when it gets terminated, the memory can
be used again. But the memory should be handled by someone so that the released memory can be assigned again
to the new processes. This task is also done by the Kernel. The kernel keeps track about which part of the
memory is currently allocated and which part is available for being allocated to the other processes.
3. Device Management
The Kernel also manages all the different devices which are connected to the system, like the Input and Output
devices, etc.
4. Interrupt Handling
While executing the processes, there are conditions where tasks with more priority need to be handled first. In
these cases, the kernel has to interrupt in-between the execution of the current process and handle tasks with
more priority which has arrived in between.
5. I/O Communication
As the Kernel manages all the devices connected to it, so it is also responsible for handling all sorts of input and
output that is exchanged through these devices. So, all the information that the system receives from the user and
all the output that the user is provided with via different applications is handled by the Kernel.
Types of Kernel
There are mainly five types of Kernel, which are given below:
1. Monolithic Kernels
In a monolithic kernel, the same memory space is used to implement user services and kernel [Link] this
type of kernel, there is no different memory used for user services and kernel [Link] it uses the same memory
space, the size of the kernel increases, increasing the overall size of the OS.
Examples of Monolithic Kernels are Unix, Linux, Open VMS, XTS-400, etc.
Advantages:
o The execution of processes is also faster as there is no separate user space and kernel space and less software
involved.
o As it is a single piece of software hence, it's both sources and compiled forms are smaller.
Disadvantages:
o If any service generates any error, it may crash down the whole system.
o These kernels are not portable, which means for each new architecture, they must be rewritten.
o Large in size and hence become difficult to manage.
o To add a new service, the complete operating system needs to be modified.
2. Microkernel
A microkernel is also referred to as μK, and it is different from a traditional kernel or Monolithic Kernel. In
this, user services and kernel services are implemented into two different address spaces: user space and kernel
space. Since it uses different spaces for both the services, so, the size of the microkernel is decreased, and which
also reduces the size of the OS.
Examples of Microkernel are L4, AmigaOS, Minix, K42, etc.
Advantages
o Microkernels can be managed easily.
o A new service can be easily added without modifying the whole OS.
o In a microkernel, if a kernel process crashes, it is still possible to prevent the whole system from crashing.
Disadvantages
o There is more requirement of software for interfacing, which reduces the system performance.
o Process management is very complicated.
o The messaging bugs are difficult to fix.
3. Hybrid Kernel
Hybrid kernels are also known as modular kernels, and it is the combination of both Monolithic and Microkernels.
A hybrid kernel can be understood as the extended version of a microkernel with additional properties of a
monolithic kernel.
Hybrid kernels allow to run some services such as network stack in kernel space to reduce the performance
compared to a traditional microkernel, but it still allows to run kernel code (such as device drivers) as servers in
user-space.
Examples of Hybrid Kernel are Windows NT, Netware, BeOS, etc.
Advantages:
o There is no requirement for a reboot for testing.
o Third-party technology can be integrated rapidly.
Disadvantages:
o There is a possibility of more bugs with more interfaces to pass through.
o It can be a confusing task to maintain the modules for some administrators, especially when dealing with
issues such as symbol differences.
4. Nanokernel
As the name suggests, in Nanokernel, the complete code of the kernel is very small, which means the code
executing in the privileged mode of the hardware is very small. Here the term nano defines a kernel that supports
a nanosecond clock resolution.
Examples of Nanokernel are EROS etc.
Advantages
o It provides hardware abstractions even with a very small size.
Disadvantages
o Nanokernel lacks system services.
5. Exokernel
Exokernel is still developing and is the experimental approach for designing OS.
This type of kernel is different from other kernels as in this; resource protection is kept separated from management,
which allows us to perform application-specific customization.
Advantages:
o The exokernel-based system can incorporate multiple library operating systems. Each library exports a
different API, such as one can be used for high-level UI development, and the other can be used for real-
time control.
Disadvantages:
o The design of the exokernel is very complex.