0% found this document useful (0 votes)
8 views

Chapter 3

Uploaded by

zebrehe
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Chapter 3

Uploaded by

zebrehe
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 3

Software Frameworks for Real-time and Embedded Systems


3.1 Real-time operating system
Real-time operating system (RTOS)is an operating system intended to serve real time application
that process data as it comes in, mostly without buffer delay. In a RTOS, Processing time
requirement is calculated in tenths of second’s increments of time. It is time-bound system that
can be defined as fixed time constraints. In this type of system, processing must be done inside
the specified constraints. Otherwise, the system will fail. Real-time operating systems are widely
used in airline traffic control systems, Command Control Systems, airline reservation systems,
Heart pacemakers, Network Multimedia Systems, robots, etc.

RTOS Examples:
1.FreeRTOS: FreeRTOS is a popular open-source Real time OS. It is designed for
microcontrollers and small embedded systems.

2.VxWorks: VxWorks is a real time operating system developed by Wind River Systems. It is
widely used in the aerospace, defense, and industrial automation industries.

3.QNX: QNX is a commercial real time operating system developed by BlackBerry. It is used in
mission-critical applications such as automotive, medical devices, and nuclear power plants.

4.ThreadX: ThreadX is a real time operating system developed by Express Logic. It is widely
used in consumer electronics, medical devices, and automotive applications.

5.Nucleus RTOS: Nucleus RTOS is a real time operating system developed by Mentor
Graphics. It is used in a wide range of applications, including consumer electronics, medical
devices, and automotive systems.

Why use an RTOS?


 It offers priority-based scheduling, which allows you to separate analytical processing
from non- critical processing.
 The Real time OS provides API functions that allow clear and smaller application code.
 Abstracting timing dependencies and the task-based design results in fewer
interdependencies between modules.
 RTOS offers modular task-based development, which allows modular task-based testing
 The task-based API encourages modular development as a task, will typically have a
clearly defined role. It allows designers/teams to work independently on their parts of the
project.
 An RTOS is event-driven with no time wastage on processing time for the event which is
not occurring.
Components of RTOS

Figure 3.1 Components of RTOS


The Scheduler: This component of RTOS tells that in which order, the tasks can be executed
which is generally based on the priority.
Symmetric Multiprocessing (SMP): It is a number of multiple different tasks that can be
handled by the RTOS so that parallel processing can be done.
Function Library: It is an important element of RTOS that acts as an interface that helps you to
connect kernel and application code. This application allows you to send the requests to the
Kernel using a function library so that the application can give the desired results.
Memory Management: this element is needed in the system to allocate memory to every
program, which is the most important element of the RTOS.
Fast dispatch latency: It is an interval between the termination of the task that can be identified
by the OS and the actual time taken by the thread, which is in the ready queue, which has started
processing.
User-defined data objects and classes: RTOS system makes use of programming languages
like C or C++, which should be organized according to their operation
Characteristics of RTOS
Reliability: It operates for a reasonably long time without human interference. Reliability also
means the configuration to enable the system to choose the right or most profitable action for
current operations. For example, a system for the telecom or banking industries needs to consider
the cost of terminating or engaging certain actions, compared to a phone or calculator whose cost
is limited to an individual.
Predictability: A system must execute actions within a known time frame and produce known
results. Such results are determined by the procedures or operations taking place. The
determination is by targets set during production or procedural planning.
Performance: real-time operating systems are designed to make work easier. Every system must
solve a problem or reduce the workload. As such, the developer should provide a system that is
easily assimilated with existing software and hardware as well as aligned to the goals of the
organization.

Manageability: This means a system whose veracity or bulkiness is manageable. The software
and hardware required to operate the RTOS must be of reasonable size. Technicians should also
be easy to find and orient. The idea is to reduce the cost of implementation.
Scalability: The needs of any production or event will change as the environment change. a
system may require an upgrade or downgrade. Such provisions must be made during design and
installation of any RTOS.
Functionality of RTOS
Processor management: a critical function of the RTOSBy managing processes, the operating
system can ensure that resources are used efficiently and that the system remains stable. In
addition, process management allows the operating system to control how programs interact with
each other. Memory management: the functionality of an RTOS that handles or manages primary
memory and moves processes back and forth between main memory and disk during execution.
Memory management keeps track of each and every memory location, regardless of either it is
allocated to some process or it is free. It checks how much memory is to be allocated to
processes. It decides which process will get memory at what time. It tracks whenever some
memory gets freed or unallocated and correspondingly it updates the status.
Timer management: It provides functions to startand stop functions/tasks to determine the CPU
speed and let a thread uses the CPU for a specified time and after that time it will releases the
CPU.
3.2 Features of a real time operation system

Features of Real Time Operating System

 Real time OS occupies very less space.


 The response time of real time OS is predictable.
 It consumes some of the resources.
 In real time OS, the kernel restores the state of the task and passes control of the CPU for
that task

3.3 General and specific microprocessors

Microprocessors play a crucial role in real-time operating systems (RTOS) by executing tasks
that must be completed within specific timing constraints. Here’s a breakdown of general and
specific microprocessors used in RTOS environments:

General Microprocessors

1. ARM Cortex Series


o Description: Widely used in embedded systems for their efficiency and low
power consumption.
o RTOS Examples: FreeRTOS, Zephyr.
o Applications: IoT devices, automotive systems.
2. x86 Processors
o Description: Common in personal computers, these can also run RTOS for more
complex applications.
o RTOS Examples: QNX, Windows CE.
o Applications: Industrial automation, telecommunications.
3. MIPS Processors
o Description: Known for their simplicity and efficiency, often used in networking
equipment.
o RTOS Examples: VxWorks, Micrium.
o Applications: Routers, switches.

Specific Microprocessors

1. Texas Instruments MSP430


o Description: A low-power microcontroller often used in sensor applications.
o RTOS Examples: FreeRTOS, TI-RTOS.
o Applications: Medical devices, environmental monitoring.
2. Microchip PIC Microcontrollers
o Description: Widely used in consumer electronics and industrial applications.
o RTOS Examples: FreeRTOS, Microchip Harmony.
o Applications: Home appliances, automotive.
3. NXP/Freescale Kinetis
o Description: Based on ARM Cortex-M cores, ideal for real-time applications.
o RTOS Examples: MQX, FreeRTOS.
o Applications: Robotics, smart home devices.

Key Features of RTOS in Microprocessors

 Deterministic Behavior: Ensures predictable response times to events.


 Task Prioritization: Allows critical tasks to preempt less important ones.
 Inter-task Communication: Provides mechanisms like queues and semaphores for data
sharing.
 Minimal Latency: Optimizes task switching and interrupts to maintain responsiveness.

Applications of RTOS with Microprocessors

 Automotive Systems: Managing critical functions like braking and steering.


 Industrial Control: Real-time monitoring and control of manufacturing processes.
 Aerospace: Flight control systems that require high reliability.
 Medical Devices: Ensuring timely responses in life-critical applications.
3.4 Inter process communication

Inter-Process Communication (IPC) in Real-Time Operating Systems (RTOS) is crucial for


enabling tasks and processes to communicate and synchronize effectively while meeting
stringent timing constraints. Here are the main IPC mechanisms commonly used in RTOS
environments:

1. Message Queues

 Description: Tasks can send and receive messages through a queue.


 Use Case: Suitable for scenarios where messages need to be processed in a specific
order.
 Benefits: Decouples sender and receiver, allowing asynchronous communication.

2. Semaphores

 Description: Used to manage access to shared resources, semaphores can be binary


(mutex) or counting.
 Use Case: Prevents race conditions in shared resource access.
 Benefits: Provides mutual exclusion and signaling between tasks.

3. Mutexes (Mutual Exclusion Locks)

 Description: A specific type of semaphore used for protecting shared resources.


 Use Case: Ensures only one task can access a resource at a time.
 Benefits: Prevents data corruption and inconsistencies.

4. Event Flags

 Description: Used to signal events between tasks or between an interrupt and a task.
 Use Case: Allows a task to wait for one or more conditions to be met.
 Benefits: Efficiently manages multiple event notifications.

5. Shared Memory

 Description: Provides a memory area accessible by multiple tasks.


 Use Case: Ideal for high-speed data sharing between tasks.
 Benefits: Reduces overhead compared to message passing, but requires careful
synchronization.

6. Pipes and Sockets

 Description: Facilitates communication between processes, especially in systems with


networking capabilities.
 Use Case: Useful for data transfer between tasks on the same or different systems.
 Benefits: Enables structured communication channels.
7. Signals

 Description: Allows a task to notify another task of an event occurrence.


 Use Case: Suitable for low-latency notifications.
 Benefits: Simple and lightweight mechanism for event-driven programming.

Key Considerations for IPC in RTOS

 Timing Constraints: IPC mechanisms must be designed to meet real-time deadlines.


 Priority Inversion: Careful design is needed to avoid scenarios where lower-priority
tasks hold resources needed by higher-priority tasks.
 Overhead: IPC methods should minimize overhead to maintain system responsiveness.
 Deadlock Avoidance: Strategies must be in place to prevent deadlocks when multiple
tasks are waiting for resources.

3.5 Real time task scheduling

3.6 Dynamic allocation of tasks


3.7 Scheduling
3.7.1 Cyclic scheduling
3.7.2 Priority-based scheduling
3.8 Multi-tasking and Concurrency issue
3.9 Handling resource sharing and dependencies
3.9.1 Priorities and reentrancy
3.9.2 Resource sharing protocols
3.10 Fault- tolerance
3.11 Synchronization techniques
3.11.1 Centralized clock synchronization
3.11.2 Distributed clock synchronization
3.12 Real-time applications
3.13 RTOS support for semaphores, queues, and events

You might also like