0% found this document useful (0 votes)
3 views24 pages

Overview of Real-Time Operating Systems

Uploaded by

khened43
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views24 pages

Overview of Real-Time Operating Systems

Uploaded by

khened43
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Operating System Objectives and Functions


2. Virtual Computers (Virtual Machines)
3. Interaction of OS and Hardware Architecture
4. Evolution of Operating Systems
5. Architecture of OS
o Monolithic
o Microkernel
o Layered
o Hybrid / Modular
o Kernel vs. User Space
6. Processing Modes & Operating System Types
o Batch
o Multiprogramming
o Multitasking
o Multiuser
o Parallel (SMP/MPP)
o Distributed
o Real-Time OS (RTOS)

RTOS BEC704B [Type here]


1) Operating System Objectives and Functions
The Operating System acts as a bridge between the user applications/tasks and the
underlying system resources through a set of system functionalities and services

• Hardware / Motherboard
→ This includes CPU,
RAM, storage, I/O devices,
etc.
• Operating System (OS) →
For example, Windows
(desktop) or a Real-Time
Operating System (RTOS).
• User Applications → The
programs you run (Word,
browser, games, etc.).
• User → The person interacting
with the system.

Fig 1:

Operating system Objectives


• Abstraction: Provide clean, stable interfaces (processes/threads, files, sockets) to hide
hardware complexity.

RTOS BEC704B [Type here]


• Resource Management: Fair, efficient allocation of CPU, memory, and I/O.
• Isolation & Protection: Prevent interference among programs; enforce privilege boundaries.
• Performance & Responsiveness: Low overhead, low latency; predictable timing for RT
systems.
• Reliability & Availability: Fault containment, recovery, watchdogs, redundancy.
• Security: Authentication, authorization, auditing, secure IPC.
• Convenience & Portability: System calls, libraries, HAL/porting layers.

Fig 2. A classic representation of a real-time system as a sequence of schedulable


Real-time operating systems (RTOS) are used in environments where a large number of
events, mostly external to the computer system, must be accepted and processed in a short time
or within certain deadlines. such applications are industrial control, telephone switching
equipment, flight control, and real-time simulations. A real-time operating system (RTOS)
is a specialized operating system designed to handle time-sensitive tasks with precise timing
constraints
With an RTOS, the processing time is measured in tenths of seconds. This system is time-bound
and has a fixed deadline. The processing in this type of system must occur within the specified
constraints. Otherwise, This will lead to system failure.

RTOS BEC704B [Type here]


Examples of real-time operating systems are airline traffic control systems, Command Control
Systems, airline reservation systems, Heart pacemakers, Network Multimedia Systems, robots,
etc.
A real-time operating system (RTOS) is a special kind of operating system designed to handle
tasks that need to be completed quickly and on time. Unlike general-purpose operating systems
(GPOS), which are good at multitasking and user interaction, RTOS focuses on doing things
in real time.
The idea of real-time computing has been around for many years. The first RTOS was created
by Cambridge University in the 1960s. This early system allowed multiple processes to run at
the same time, each within strict time limits.
Over the years, RTOS has improved with new technology and the need for reliable real-time
performance. These systems are now more powerful, efficient, and full of features, and they
are used in many industries, including aerospace, defense, medical science, multimedia, and
more.

Types of Real-Time Operating System


The real-time operating systems can be of 3 types -

FIG 3: Types of Real-Time Operating System


Hard Real-Time Operating System
These operating systems guarantee that critical tasks are completed within a range of time. For
example, a robot is hired to weld a car body. If the robot welds too early or too late, the car
cannot be sold, so it is a hard real-time system that requires complete car welding by the robot
hardly on time., scientific experiments, medical imaging systems, industrial control systems,
weapon systems, robots, air traffic control systems, etc.

RTOS BEC704B [Type here]


Soft Real-Time Operating System
This operating system provides some relaxation in the time limit. For example - Multimedia
systems, digital audio systems, etc. Explicit, programmer-defined, and controlled processes are
encountered in real-time systems. A separate process is changed by handling a single external
event. The process is activated upon the occurrence of the related event signaled by an
interrupt.

Multitasking operation is accomplished by scheduling processes for execution independently


of each other. Each process is assigned a certain level of priority that corresponds to the relative
importance of the event that it services. The processor is allocated to the highest-priority
processes. This type of schedule, called, priority-based preemptive scheduling is used by real-
time systems.
Firm Real-time Operating System
RTOS of this type have to follow deadlines as well. In spite of its small impact, missing a
deadline can have unintended consequences, including a reduction in the quality of the product.
Example: Multimedia applications.
Unlike general-purpose operating systems (GPOS) like Windows or Linux, which are good at
multitasking and handling various applications, a real-time operating system (RTOS) is
designed to manage time-sensitive tasks precisely.
The main goal of an RTOS is to perform critical tasks on time. It ensures that certain processes
are finished within strict deadlines, making it perfect for situations where timing is very
important. It is also good at handling multiple tasks at once.
An RTOS provides real-time control over hardware resources, like random access
memory (RAM), by ensuring predictable and reliable behavior. It uses system resources
efficiently while maintaining high reliability and responsiveness. By managing multiple tasks
effectively, an RTOS ensures smooth operation even when the system is under heavy use or
changing conditions.
Uses of RTOS
• Defense systems like RADAR .
• Air traffic control system.
• Networked multimedia systems.
• Medical devices like pacemakers.
• Stock trading applications.
Different Between Regular and Real-Time operating systems

RTOS BEC704B [Type here]


Regular OS Real-Time OS (RTOS)

Complex Simple

Best effort Guaranteed response

Fairness Strict Timing constraints

Average Bandwidth Minimum and maximum limits

Unknown components Components are known

Unpredictable behavior Predictable behavior

Plug and play RTOS is upgradeable

Advantages
The advantages of real-time operating systems are as follows:
• Maximum Consumption: Maximum utilization of devices and systems. Thus more
output from all the resources.
• 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.
• Focus On Application: Focus on running applications and less importance to
applications that are in the queue.
• Real-Time Operating System In Embedded System: Since the size of programs is
small, RTOS can also be embedded systems like in transport and others.
• Error Free: These types of systems are error-free.
• Memory Allocation: Memory allocation is best managed in these types of systems
Popular RTOSes for Automotive
There are many RTOSes in use for a wide range of embedded applications, but automotive has
a narrower focus with some key players for specific functions within the ecosystem.
Microsoft’s Windows Embedded Automotive is widely used for infotainment systems in
vehicles from leading vehicle brands.

RTOS BEC704B [Type here]


The Automotive Open System Architecture (AUTOSAR) is a software development standard
for Automotive RTOS and electronic control units (ECUs). Vendors employing AUTOSAR
include KPIT Technologies, RTA-OSEK from ETAS (part of Bosch), and Elektrobit.
Automotive Grade Linux is a version of the popular Linux Open-Source operating system
specifically tailored for automotive applications, with RTOS capabilities. Ten automotive
brands and 140 subsystem suppliers are members of the project.
The Connected Vehicle System Systems Alliance (COVESA), previously the GENIVI
Alliance, is an organization developing reference approaches for automotive systems,
including RTOS. Interoperation with AUTOSAR-based systems is available.
BlackBerry® QNX® Automotive was explicitly designed for use in embedded automotive
systems, focusing on speed, reliability, and security. BlackBerry QNX is in use in more than
235 million vehicles worldwide. It can control a comprehensive range of automotive ECUs,
from telematics to digital cockpit displays to ADAS and active safety to infotainment and
instrument clusters.

Core Functions of RTOS


• Process/Thread Management: Creation, scheduling, synchronization, termination.
• Memory Management: Address translation, protection, allocation,
paging/segmentation.
• File/Storage Management: Naming, directories, filesystems, block I/O, journaling.
• I/O & Device Management: Drivers, DMA, interrupts, buffering, power mgmt.
• Networking & IPC: Sockets, pipes, message queues, shared memory, RPC.
• Protection & Security: User/kernel modes, ACLs, capabilities, sandboxing.
• Time Management: Timers, scheduling quanta, clock/tick handling—critical in RTOS.
• System Services: Logging, configuration, diagnostics, performance counters.

4) Evolution of Operating Systems


1. Batch Processing (1950s–60s): Job queues, no interactive use; offline scheduling.
2. Multiprogramming: Memory partitioning, CPU utilization up via overlap of I/O and
compute.
3. Time-Sharing: Interactive terminals; fair-share schedulers; virtual memory emerges.
4. Personal Computing: Single-user OS with GUIs; device diversity explodes.
5. Networked/Client-Server: Filesharing, remote login, distributed services.
6. Multiprocessors & SMP: Parallel kernels, fine-grained locks, NUMA awareness.

RTOS BEC704B [Type here]


7. Mobile & Embedded: Energy, footprint constraints; secure app models; RT variants.
8. Virtualization & Cloud: Hypervisors, containers, orchestration.
9. Cyber-Physical & RT IoT: Determinism, safety certification (MISRA, IEC 61508,
DO-178C).

5) Architecture of OS
• Kernel: The kernel in the operating system is responsible for managing the
resources of the system such as memory, CPU, and input-output devices. The
kernel is responsible for the implementation of the essential functions.
• Shell: The shell in an Operating System acts as an interface for the user to interact
with the computer system. The shell can be a command line interface or a
graphical interface.
These two are major components of an Operating System
Different Types of OS Architecture
The Operating System Architecture is of four types. These types are mentioned below.
• Monolithic Architecture
• Layered Architecture
• Microkernel Architecture
• Hybrid Architecture
5.1 Monolithic Kernel
• All core services (scheduling, memory, VFS, networking, drivers) run in kernel space.
Fast in-kernel calls, simple IPC models are [Link] large TCB (trusted computing
base) are used but harder in fault isolation.
Monolithic Architecture is the oldest and the simplest type of Operating System Architecture.
In this architecture, each and every component is contained in a single kernel only. The
various components in this OS Architecture communicate with each other via function calls.

RTOS BEC704B [Type here]


Advantages of Monolithic Architecture
The advantages of the Monolithic Architecture of the Operating System are given below.
• This type of architecture is easier to develop.
• Easy to maintain.
• It shows efficient performance because of the direct communication between the
components.
• It is easy to secure as all the components are contained in a single file.
Disadvantages of Monolithic Architecture
Monolithic Architecture has the following disadvantages.
• It is difficult to scalable.
• Hard to update since the change in one component result in an entire system update
• Large codebase which is difficult to understand.
5.2 Microkernel
An operating system kernel is the portion of the operating system that is common among all
other operating system services and applications. Kernels can be specialized according to the
applications that they support. One such specialization is that for the real-time system. A real-
time system, given its strict temporal requirements, requires a specific set of services that a
kernel must provide
The kernel is the heart of the operating system, being real time or not. Its job is to manage the
CPU time between the tasks, as well as the communication between them. The fundamental
service provided by the kernel is context switching. A kernel will certainly add overhead to
your system, but normally the benefits are much more distinctive. Since each task has its own
stack space the RAM will be eaten up quite quickly. The kernel also consume CPU time to get
the job done, normally this is about 2 and 5%. In a small chip controller it is of great importance
to keep the kernel as small as possible, this will usually be in the cost of the supported
functionality.

RTOS BEC704B [Type here]


Process management, networking, file system interaction, and device management are
executed outside the kernel in this architecture, while memory management and
synchronization are executed inside the kernel. The processes inside the kernel have a relatively
high priority, and the components are highly modular, so even if one or more components fail,
the operating system continues to function.

Advantages of Microkernel Architecture


Here are some of the advantages of Microkernel Architecture.
• A highly modular design makes it easier to develop and maintain individual
components
• Can support a wide range of operating systems and hardware platforms
• Enables customization and flexibility, allowing for the creation of tailored systems
Disadvantages of Microkernel Architecture
The disadvantages of Microkernel Architecture are given below.
• Increased complexity due to the need to manage multiple components and
communication between them.
• Reduced performance due to communication overhead between components.
• Requires a significant amount of testing and validation to ensure correct operation of
the system.
Non-Preemptive micro kernel
Non-preemptive or cooperative multitasking, also called, requires the tasks to explicitly give
up the CPU. The asynchronous events can still be handled by the ISR, but the ISR always return
back to the last executing task. If the ISR makes another task, with higher priority than current,

RTOS BEC704B [Type here]


ready to run, it still has to wait until the current process gives up the CPU. To get the illusion
of concurrency the release of CPU must be done frequently from the process. Some of the
advantages with non-preemptive kernel include:
• Low interrupt latency.
• Non-reentrant functions can be used. The process owns The CPU and can
finish executing the non-reentrant function.
• Less need of semaphore for access control to recourses. Since the process
itself controls when to release the CPU it’s easier to control sheared recourses, this is not the
case all time.
The greatest disadvantage with non-preemptive kernels is the responsiveness. If e.g. an ISR
makes a higher priority task ready to run, it still has to wait until the current task gives up the
CPU. To summarize, a non-preemptive kernel allows each task to run until it voluntarily gives
up control of the CPU. An interrupt will preempt a task. Upon completion of the ISR, the ISR
will return to the interrupted task. Task-level response is much better than with a
foreground/background system but is still non-deterministic. Very few commercial kernels are
nonpreemptive.
Preemptive micro kernel
In preemptive systems, the kernel scheduler is called with a defined period, each tick. Each
time it is called it checks if there is a ready-to-run task which has a higher priority than the
executing task. If that is the case, the scheduler performs a context switch. This means that a
task can be preempted - forced to go from executing to ready state - at any point in the code,
something that puts special demands on communication between tasks and handling common
resources. Using a preemptive kernel solves the problem where a high priority task has to
wait for a lower priority task to yield the processor. Instead, when the high priority task
becomes ready to run, the lower priority task will become preempted, and the high priority task
can start to execute. A preemptive kernel is used when system responsiveness is important,
most commercial real-time kernels are preemptive.
5.3 Layered Architecture
In a layered architecture, the operating system is divided into layers, with each layer performing
a specific set of functions. The layers are organized in a hierarchical order, with each layer
depending on the layer below it. The layering approach makes the system easier to maintain
and modify, as each layer can be modified independently without affecting the other layers.

RTOS BEC704B [Type here]


Advantages of Layered Architecture
Here are some of the advantages of Layered Architecture.
• Separation of concerns makes it easier to develop and maintain individual layers
• Components within a layer can be swapped out without affecting other layers
• Scalability is improved because layers can be scaled independently
Disadvantages of Layered Architecture
The disadvantages of Layered Architecture are given below.
• Increased complexity due to the number of layers
• This architecture can result in slower performance due to communication
overhead between layers
• Difficult to enforce strict separation between layers, which can lead to coupling
and reduced modularity
• Strict layers atop hardware: HAL/drivers → kernel → services → UI.
• Pros: Modularity, testability.
• Cons: Rigid boundaries can cost performance; cross-layer optimizations harder.

RTOS BEC704B [Type here]


5.4 Hybrid/Modular
Hybrid Architecture
As the name implies, hybrid architecture is a hybrid of all the architectures discussed thus far,
and therefore it contains characteristics from all of those architectures, which makes it highly
valuable in modern operating systems.

The hybrid architecture is comprised of three levels.


• Hardware abstraction layer: This is the lowest level interface between the kernel and
hardware.
• Microkernel Layer: This is the conventional microkernel, which includes CPU
scheduling, memory management, and inter-process communication.
• Application Layer: This layer acts as an interface between the user and the microkernel.
It includes features such as a file server, error detection, I/O device management, and
so on.
Advantages of Hybrid Architecture
Here are the advantages that Hybrid OS Architecture provides us.
• Combines the benefits of multiple architectures, such as microkernel and monolithic
kernel, allowing for better performance, scalability, and flexibility.
• Offers a higher level of security by isolating critical components in separate modules
and reducing the attack surface.
• Allows for easier integration of different software components, as it supports multiple
programming paradigms and facilitates communication between them.
Disadvantages of Hybrid Architecture
The disadvantages of the Hybrid architecture are listed below.
• Can be complex to design and maintain, as it requires managing multiple subsystems
with different architectures and interfaces.
• This architecture May result in slower system performance due to the increased
overhead associated with managing multiple subsystems.

RTOS BEC704B [Type here]


• Can be more prone to compatibility issues, as different subsystems may require
different versions of libraries and other dependencies
• Practical blends: monolithic core with loadable modules; some services user-space.
• Examples (conceptual): “Hybrid” kernels place drivers or windowing subsystems
variably.

Tasks, Processes & Threads :


• In the Operating System context, a task is defined as the program in execution and the
related information maintained by the Operating system for the program
• Task is also known as ‘Job’ in the operating system context
• A program or part of it in execution is also called a ‘Process’
• The terms ‘Task’, ‘job’ and ‘Process’ refer to the same entity in the Operating System
context and most often they are used inter changeably
• A process requires various system resources like CPU for executing the process,
memory for storing the code corresponding to the process and associated variables, I/O
devices for information exchange etc
The structure of a Processes
• The concept of ‘Process’ leads to concurrent execution (pseudo parallelism) of tasks
and thereby the efficient utilization of the CPU and other system resources
• Concurrent execution is achieved through the sharing of CPU among the processes.
• A process mimics a processor in properties and holds a set of registers, process status,
a Program Counter (PC) to point to the next executable instruction of the process, a
stack for holding the local variables associated with the process and the code
corresponding to the process
• A process, which inherits all the properties of the CPU, can be considered as a virtual
processor, awaiting its turn to have its properties switched into the physical processor

RTOS BEC704B [Type here]


On loading a process into the main memory, a specific area of memory is allocated for the
process
The stack memory usually starts at the highest memory address from the memory area allocated
for the process (Depending on the OS kernel implementation)
Process States & State Transition
• The creation of a process to its termination is not a single step operation
• The process traverses through a series of states during its transition from the newly
created state to the terminated state
• The cycle through which a process changes its state from ‘newly created’ to ‘execution
completed’ is known as ‘Process Life Cycle’. The various states through which a
process traverses through during a Process Life Cycle indicates the current status of the
process with respect to time and also provides information on what it is allowed to do
next
Process States & State Transition:
Created State: The state at which a process is being created is referred as ‘Created State’.
The Operating System recognizes a process in the ‘Created State’ but no resources are allocated
to the process
Ready State: The state, where a process is incepted into the memory and awaiting the
processor time for execution, is known as ‘Ready State’. At this stage, the process is placed in
the ‘Ready list’ queue maintained by the OS
Running State: The state where in the source code instructions corresponding to the process
is being executed is called ‘Running State’. Running state is the state at which the process
execution happens
Blocked State/Wait State: Refers to a state where a running process is temporarily suspended
from execution and does not have immediate access to resources. The blocked state might have
invoked by various conditions like- the process enters a wait state for an event to occur (E.g.
Waiting for user inputs such as keyboard input) or waiting for getting access to a shared
resource like semaphore, mutex etc
Completed State: A state where the process completes its execution
The transition of a process from one state to another is known as ‘State transition’
When a process changes its state from Ready to running or from running toblocked or
terminated or from blocked to running, the CPU allocation for the process may also change

RTOS BEC704B [Type here]


Blocke
Blocked State/Wait
State
d
Stat
e/W
Threads
ait
A thread is the primitive that can execute code
Stat
A thread is a single sequential flow of control within a process
‘Thread’ is also known as lightweight process
e
A process can have many threads of execution

Different threads, which are part of a process, share the same address space; meaning they
share the data memory, code memory and heap memory area
Threads maintain their own thread status (CPU register values), Program Counter (PC) and
stack

Fig 5 . Memory organization of process and its associated Threads

RTOS BEC704B [Type here]


The Concept of multithreading (Process with multi-threads)
Use of multiple threads to execute a process brings the following advantage.
Better memory utilization.
Multiple threads of the same process share the address space for data memory. This also reduces
the complexity of inter thread communication since variables can be shared across the threads.
Since the process is split into different threads, when one thread enters a wait state, the CPU
can be utilized by other threads of the process that do not require the event, which the other
thread is waiting, for processing. This speeds up the execution of the process.
Efficient CPU utilization. The CPU is engaged all time.

RTOS BEC704B [Type here]


RTOS BEC704B [Type here]
Thread Process
Thread is a single unit of execution and is Process is a program in execution and contains one
part of process. or more threads.
A thread does not have its own data Process has its own code memory, data memory and
memory and heap memory. It shares the stack memory.
data memory and heap memory with
other threads of the same process.
A thread cannot live independently; it A process contains at least one thread.
lives within the process.
There can be multiple threads in a process. Threads within a process share the code, data and
The first thread (main thread) calls the heap memory. Each thread holds separate memory
main function and occupies the start of the area for stack (shares the total stack memory of the
stack memory of the process. process).
Threads are very inexpensive to create Processes are very expensive to create. Involves
many OS overhead.
Context switching is inexpensive and fast Context switching is complex and involves lot of OS
overhead and is comparatively slower.
If a thread expires, its stack is reclaimed If a process dies, the resources allocated to it are
by the process. reclaimed by the OS and all the associated threads of
the process also dies.

Advantages of Threads:
1. Better memory utilization: Multiple threads of the same process share the address
space for data memory. This also reduces the complexity of inter thread communication
since variables can be shared across the threads.

RTOS BEC704B [Type here]


2. Efficient CPU utilization: The CPU is engaged all time.
3. Speeds up the execution of the process: The process is split into different threads, when
one thread enters a wait state, the CPU can be utilized by other threads of the process
that do not require the event, which the other thread is waiting, for processing.

Multiprocessing & Multitasking


The ability to execute multiple processes simultaneously is referred as
multiprocessing
Systems which are capable of performing multiprocessing are known as
multiprocessor systems
Multiprocessor systems possess multiple CPUs and can execute multiple processes
simultaneously
The ability of the Operating System to have multiple programs in memory, which are
ready for execution, is referred as multiprogramming
2 Multiprogramming(Multitasking)
• Multiple programs share memory/CPU; CPU kept busy while others wait for I/O.
• Mechanisms: Memory partitioning/paging; context switching; I/O overlap.
Multitasking refers to the ability of an operating system to hold multiple processes in
memory and switch the processor (CPU) from executing one process to another process
Multitasking involves ‘Context switching’, ‘Context saving’ and ‘Context retrieval’
Context switching refers to the switching of execution context from task to other
When a task/process switching happens, the current context of execution should be
saved to (Context saving) retrieve it at a later point of time when the CPU executes the
process, which is interrupted currently due to execution switching
During context switching, the context of the task to be executed is retrieved from the
saved context list. This is known as Context retrieval
Context Switch

RTOS BEC704B [Type here]


When a multitasking kernel decides to run a different task, it simply saves the
current task's context (CPU registers) in the current task's context storage area –
its stack. Once this operation is performed, the new task's context is restored from
its storage area and then resumes execution of the new task's code. This process is
called a context switch or a task switch. Context switching adds overhead to the
application. The more registers a CPU has, the higher the overhead. The time
required to perform a context switch is determined by how many registers have to
be saved and restored by the CPU.
The following scenarios may generate a context switch:
• A task switching from the running state to waiting state (e.g. waiting for a
signal).
• A task switching from the running state to the ready state (e.g. occurrence
of an interrupt).
• Tasks switching from the waiting state to the ready state (e.g. reception of
a signal).
• Task terminates.

RTOS BEC704B [Type here]


Multitasking (Time-Sharing)
• Fine-grained preemption gives interactive feel; quantum/time slice per task.
• Schedulers: Round-robin, priority-based, multi-level feedback queues.
Real-time adds deadlines and tighter bounds
Types of Multitasking :
Depending on how the task/process execution switching act is implemented, multitasking
can is classified into
Co-operative Multitasking: Co-operative multitasking is the most primitive form of
multitasking in which a task/process gets a chance to execute only when the currently
executing task/process voluntarily relinquishes the CPU. In this method, any task/process
can avail the CPU as much time as it wants. Since this type of implementation involves
the mercy of the tasks each other for getting the CPU time for execution, it is known as
co-operative multitasking. If the currently executing task is non-cooperative, the other
tasks may have to wait for a long time to get the CPU
• Preemptive Multitasking: Preemptive multitasking ensures that every task/process gets
a chance to execute. When and how much time a process gets is dependent on the
implementation of the preemptive scheduling. As the name indicates, in preemptive
multitasking, the currently running task/process is preempted to give a chance to other
tasks/process to execute. The preemption of task may be based on time slots or
task/processpriority
• Non-preemptive Multitasking: The process/task, which is currently given the CPU time,
is allowed to execute until it terminates (enters the ‘Completed’ state) or enters the
‘Blocked/Wait’ state, waiting for an I/O. The co- operative and non-preemptive
multitasking differs in their behavior when they are in the ‘Blocked/Wait’ state. In co-
operative multitasking, the currently executing process/task need not relinquish the CPU
when it enters the ‘Blocked/Wait’ sate, waiting for an I/O, or a shared resource access or
an event to occur whereas in non-preemptive multitasking the currently executing task
relinquishes the CPU when it waits for an I/O.
Benefits of Using an RTOS
• Creates a framework for developing applications
• Facilitate teams of multiple developers
• it’s possible to meet all the deadlines of an application
• Rate Monotonic Analysis (RMA) could be used to determine schedulability
• Most RTOSs have undergone thorough testing
• Some are third-party certifiable, and even certified (DO-178B, IEC-61508, IEC-62304,
etc.)
• It’s unlikely that you will find bugs in RTOSs
• RTOSs typically support many different CPU architectures
• Very easy to add power management

RTOS BEC704B [Type here]


Drawbacks of Using an RTOS
• The RTOS itself is code and thus requires more Flash
• Typically between 6-20K bytes
• An RTOS requires extra RAM
• Each task requires its own stack
• The size of each task depends on the application
• Each task needs to be assigned a Task Control Block (TCB)
• About 32 to 128 bytes of RAM
• About 256 bytes for the RTOS variables
• You have to assign task priorities
• Deciding on what priority to give tasks is not always trivial
• The services provided by the RTOS consume CPU time
• Overhead is typically 2-10% of the CPU cycles
• There is a learning curve associated with the RTOS you select
Popular real-time operating systems
These popular real-time operating systems (RTOSes) are designed to meet the specific needs
of various industries. They are optimized to run on processors like Intel and ARM, ensuring
high performance, reliability and efficiency across diverse applications:
• VxWorks: This highly reliable RTOS, used in aerospace, defense and industrial
automation, is known for its scalability, security and safety features.
• QNX: This modular, POSIX-compliant RTOS is favored in automotive, medical and
industrial sectors, offering reliability and fault tolerance
• FreeRTOS: This open-source, lightweight RTOS is ideal for embedded
systems, microcontrollers, IoT devices and consumer electronics, emphasizing
simplicity and efficiency.
• RTEMS: This open-source RTOS is designed for high-performance embedded
systems, commonly deployed in aerospace, telecommunications and robotics
applications.
• embOS: This compact RTOS is known for its scalability and deterministic
performance, and it is often used in industrial and medical systems where reliability is
key.
• Zephyr: This open-source, scalable RTOS from the Linux Foundation is optimized for
small, resource-constrained devices, such as IoT gadgets and wearables.
• ThreadX: This high-performance RTOS, known for its minimal footprint and efficient
resource management, is frequently used in consumer electronics, automotive and
industrial systems.

RTOS BEC704B [Type here]


Explain the features of uC/OS-II
7) RTOS Case Focus: uC/OS-II (Conceptual Overview)
The following summarizes widely known characteristics of uC/OS-II as a fixed-priority
preemptive RTOS used in embedded systems, consistent with topics typically covered in the
text by Jean J. Labrosse.
7.1 Kernel Model & Objects
• Tasks: Each with priority (lower number = higher priority in common ports). Typically
one task per priority.
• TCB (Task Control Block): Context (registers), stack pointer, state.
• Ready Lists: Bitmaps/arrays enabling O(1) ready task lookup.
• Critical Sections: Short, interrupt-safe code paths; macros disable/enable interrupts
around kernel data structures.
7.2 Scheduling & Context Switching
• Preemptive, Fixed-priority: Highest-priority ready task runs.
• Context Switch: Save CPU registers of current task → restore next task → switch
stacks.
• Tick Handler: Drives timeouts/delays; may unblock tasks and trigger reschedule.
• Determinism: Constant-time selection via ready bitmaps; bounded critical sections.
7.3 Synchronization & IPC
• Semaphores: Binary/counting; wait/post; priority-based wait queues.
• Mailboxes & Queues: Pointer messages (mailbox) or FIFO queues; ISR-safe post
variants for deferred processing.
• Mutexes with Priority Inheritance: Prevent unbounded priority inversion.
7.4 Time Management
• Delays: TaskDelay, TaskDelayUntil-style primitives; tick granularity affects jitter.
• Timeouts: On waits (semaphore/queue), enabling bounded blocking.
• Tickless variants (concept): Reduce power by programming next deadline alarm
instead of periodic tick.
7.5 Memory & Stack
• Per-task stacks sized by WCET & ISR nesting; stack overflow checks recommended.
• Fixed blocks/partitions

RTOS BEC704B [Type here]

You might also like