Você está na página 1de 17

Module 8

Real Time Operating System


An introduction to Embedded system and RTOS

Embedded System

Embedded systems are computing systems with tightly coupled hardware and
software integration, that are designed to perform a dedicated function.

Advocates Hardware Software Co-Design.

Types:

Standalone e.g. DVD Player.


Real-Time e.g. Pace-maker
Network information appliance e.g. Dongle.
Mobile Devices e.g. Smartphone.

Characteristics:

Do a very specific task.


Limited in resources Memory, Power
Work against some deadlines.
Have to be highly reliable.

Embedded System Architecture


Application S/W

Not a separate entity


in Application
specific Embedded
system

Middleware

Operating System

Can co-exist as
one

Firmware/Drivers

Hardware

H/W Layer

Real Time Systems

A real-time system is a system whose specification includes both logical and


temporal correctness requirements.
Logical Correctness:

Produces correct outputs.


Can be checked

Temporal Correctness:

Produces outputs at the right time.


We spend much time on techniques for checking temporal correctness.

In simple words, an embedded system in which some specific work has to be done in
a specific period of time are called Real Time Systems.

Types of Real Time System:

Hard Real Time System e.g. Pace-maker


Soft Real Time System e.g. Communication Processors in a Smartphone.

Operating System

An operating system is a program that acts as an interface between the user and the
hardware and controls the execution of all kinds of programs.

It basically makes the hardware usable.

For a small scale embedded system , operating system can be considered as the
software that controls the hardware.

Objectives:

To abstract the hardware from User.


To allocate resources to processor.
To provide the necessary resources for the application.

What is an RTOS ?

RTOS Real Time Operating System

An RTOS is an operating system which gives a deterministic execution pattern for the
scheduled process or task in the system.

Why RTOS ?

Better Responsiveness and Lower Overhead Better Responsiveness and Lower


Overhead

Simplified Resource Sharing

Easier Development and Debugging

Enabled Use of Layered Products

Increased Portability and Maintenance

Faster Time To Market

POSIX Compliance RTOS


Services

IEEE Portable Operating System Interface for Computer Environments, POSIX 1003.1b (formerly
1003.4) provides the standard compliance criteria for RTOS services. It is designed to allow
application programmers to write applications that can easily be ported across OSs.

The basic RTOS services covered by POSIX 1003.1b include:

Asynchronous I/O operation support.


Synchronous I/O operation support.
Memory locking support.
Semaphores to synchronize resource access by multiple processes.
Shared memory: Ability to map common physical space into independent process specific virtual
space.
Execution scheduling: Ability to schedule multiple tasks.
Timers: Timers improve the functionality and determinism of the system.

Features of RTOS

Multithreading and preemptability - The scheduler should be able to pre-empt any task in the system
and allocate the resource to the thread that needs it most even at peak load.

Thread Priority - All tasks are assigned priority level to facilitate pre-emption. The highest priority task
that is ready to run will be the task that will be running.

Inter Task Communication & Synchronization - Multiple tasks pass information among each other in a
timely fashion and ensuring data integrity

Priority Inheritance - RTOS should have large number of priority levels & should prevent priority
inversion using priority inheritance.

Short Latencies - The latencies are short and predefined.

Task switching latency: The time needed to save the context of a currently executing task and switching to another
task.

Interrupt latency: The time elapsed between execution of the last instruction of the interrupted task and the first
instruction in the interrupt handler.
Interrupt dispatch latency: The time from the last instruction in the interrupt handler to the next task scheduled to run.

RTOS Architecture

Generic RTOS Kernel


Kernel
Kernel APIs
Scheduler
Timer Mgmt

Memory
Mgmt

Task Mgmt

Intertask Communication & synchronization

Task Management & Scheduler

What is a task ?

A task in general is an independent executable program with its own memory space.
States: Suspended, Ready, Running, Terminated.

Scheduler

A scheduler schedules the task to be executed into the CPU. A dispatcher, dispatches the
same.
The decision on task to execute is taken by the scheduler based on the scheduling algorithm
in place.
General scheduling algorithm followed are:

Priority based preemptive scheduling.


Round Robin scheduling.

Thread/Task starvation
Context Switch
Preemption
Priority inheritance
Priority inversion

Memory Management

Stack Management

Heap Management

Memory Pools

Timer Management

S/W Timer Management

Watch dog Timer

Intertask Communication &


synchronization

Message Queues

Semaphore

Mutex

RTOS in a Smartphone
AP Env
SMS
app

Calling
app

Messenger
apps

Android/IOS/Windows
Core-1

Core-2

Core-3

Core-4

Core-5

Core-6

Core-7

Core-8

Peripherals
+ Memory

Shared
Memory
/
Driver

CP Env
2G

3G

4G

Shared Memory/ Driver

RTOS
CPU

Peripheral + Memory

RTOS in Industry
RTOS

Applications/Features
Used for Small footprint, mobile and connected devices

Windows CE

Supported by ARM,MIPS, SH4 & x86 architectures


Complex, hard real-time applications
LynxOS

POSIX-compatible, multiprocess, multithreaded OS.


Supported by x86, ARM, PowerPC architectures
Most widely adopted RTOS in the embedded industry.

VxWorks

Used in famous NASA rover robots Spirit and Opportunity


Certified by several agencies and international standards for real time systems, reliability and security-critical applications.
Ported to more than a hundred architectures including x86, mainly used in microcontrollers with low resources.

Micrium C/OS-II
Certified by rigorous standards, such as RTCADO-178B
Most traditional RTOS in the market.
QNX

Microkernel architecture; completely compatible with the POSIX


Certified by FAADO-278 and MIL-STD-1553 standards.
Hard realtime kernel

RT Linux
Good real time performance, but no certification
Developed for embedded systems and Internet applications under the Java platform.
Jbed
Allows an entire application including the device drivers to be written using Java
Designed for Smartphones
Symbian
Supported by ARM, x86 architecture
Suitable for traditional board based embedded systems and SoC architectures
VRTX
Supported by ARM, MIPS, PowerPC & other RISC architectures

Você também pode gostar