You are on page 1of 32

Presentation on Real Time Operating Systems

Objectives
To Understand Why we need O.S

To Identify type of O.S To Define Real Time System To Classify Real Time System To Understand What is RTOS Components of RTOS To Know Secrets what makes an O.S as RTOS How to Choose RTOS
(c) Telecommunications Consultants India Limited 2

What is Operating System..?


-Converts Hardware of the system in to Virtual Machine.
-Acts as interface between Machine & User -Controls & coordinates use of Hardware among various application programs. -Acts as Bridge between the user & Computer

(c) Telecommunications Consultants India Limited

Types Of Operating Systems


O.S Size Functions Multiprog.
Unix/Win-NT

Small
RTX-51

Large
Unix,Win-NT

Multitask
RTX-51

(c) Telecommunications Consultants India Limited

Architecture For Large O.S


Application Program
Lang.Support Utilities I/O Subsystem File manager Schedular Dispatcher C.P.U Int.Handler

I/o Device

(c) Telecommunications Consultants India Limited

Smaller O.S

Application Interface
Scheduler Dispatcher Interrupt.Handler

CPU
I/O Devices

(c) Telecommunications Consultants India Limited

Multitask O.S
-An

Instance Of Program in execution is called Process/task. -Capability Of O.S to Perform More Task at a time. -Ability of O.s to Support Two or more Concurrent process in execution simultaneously. -O.S Switches from task to task.

-Two Types
a. Cooperative
(c) Telecommunications Consultants India Limited

b. Preemptive.
7

Embedded OS
Why is a desktop OS not suited? Monolithic kernel is too feature reach.Monolithic
kernel is not modular, fault tolerant,configurable,Modifiable

Takes too much space,Not power optimized,Not


designed for mission-critical applications.

Known RTOS (real-time operating systems):


POSIX, VxWorks, OSOpen, OS-9, RTEMS etc.

Linux/RT-Linux, Virtuoso, Windows CE, PalmOS, QNX


Neutrino ...

(c) Telecommunications Consultants India Limited

What are Real-time Systems ?


Real-time systems
Those systems in which the correctness of the system depends not only on the logical result of computation, but also on the time at which the results are produced. Flight Control,Military Application,Robotics Nuclear Power Plant,Automobile control.
(c) Telecommunications Consultants India Limited 9

Types of Real Time Systems


Based on Hard deadline: Penalty due to
missing deadline is a higher order of magnitude than the Reward in meeting the deadline.

Based on Soft deadline: Penalty often equal /


lesser magnitude than Reward.

(c) Telecommunications Consultants India Limited

10

A Sample Real Time System (1)

(c) Telecommunications Consultants India Limited

11

A Sample Real Time System (2)


Mission: Reaching the destination safely.
Controlled System: Car.

Operating environment: Road conditions.


Controlling System
- Human driver: Sensors - Eyes and Ears of the driver. - Computer: Sensors - Cameras, Infrared receiver, and Laser telemeter.
(c) Telecommunications Consultants India Limited 12

A Sample Real Time System


Controls: Accelerator, Steering wheel, Break-pedal.
Actuators: Wheels, Engines, and Brakes. Critical tasks: Steering and breaking

Non-critical tasks: Turning on radio

(c) Telecommunications Consultants India Limited

13

A Sample Real Time System


Performance is not an absolute one. It measures
the goodness of the outcome relative to the best outcome possible under a given circumstance.

Cost of fulfilling the mission Efficient solution.

Reliability of the driver Fault-tolerance is a


must.
(c) Telecommunications Consultants India Limited 14

RTOS Kernel
RTOS Kernel provides an Abstraction layer that
hides from application software the hardware details of the processor / set of processors upon which the application software shall run.
Application Software

RTOS

Hardware
(c) Telecommunications Consultants India Limited 15

RTOS Kernel Functions

(c) Telecommunications Consultants India Limited

16

Various Kernel Objects

Tasks Tasks Scheduler Interrupt Service routine Semaphores Mutexes Mailboxes Massage Queues Pipes Timers Signals
17

(c) Telecommunications Consultants India Limited

Tasks :
Tasks of API (As Function Loop) it has name ,ID,Priority & Task Control Block
Tasks Of O.S (Startup, Exception handling,Logging ,messages etc..) Reentrant Function calls(Data Does not Corrupt) Non Reentrant function call (Data Corrupts) May Require to intercommunicate with each other.

Resource shared Tasks

Task States:Ready wait Running

Context Switching

(c) Telecommunications Consultants India Limited

18

Task states
Run: A task enters this state as it starts executing on the processor Ready: State of those tasks that are ready to execute but cannot be

executed because the processor is assigned to another task.


Wait: A task enters this state when it executes a synchronization primitive to wait for an event, e.g. a wait primitive on a semaphore. In this case the task is inserted in a queue associated with the semaphore. The task at the head is resumed when the semaphore is unlocked by a signal primitive.

Idle:
A periodic job enters this state when it completes its execution and has to wait for the beginning of the next period
(c) Telecommunications Consultants India Limited 19

Task Management
-- Scheduling Algorithms

First in First Out Round Robin Algorithm Round Robin With Priority Shortest Job First Non Preemptive Preemptive Multitasking

(c) Telecommunications Consultants India Limited

20

Task Scheduling
Non Real -time systems usually use Non-preemptive
Scheduling
Once a task starts executing, it completes its full execution

Most RTOS perform priority-based preemptive task


scheduling.

Basic rules for priority based preemptive task scheduling


The Highest Priority Task that is Ready to Run, will be the Task that Must be Running.

(c) Telecommunications Consultants India Limited

21

Priority based Preemptive Task Scheduling


Every Task in a software application is assigned a
priority.

Higher Priority = Higher Need for Quick Response. Follows nested preemption

(c) Telecommunications Consultants India Limited

22

Intertask Communication & Synchronization


These services makes it possible to pass
information from one task to another without information ever being damaged.

Makes it possible for tasks to coordinate &


productively cooperate with each other.

(c) Telecommunications Consultants India Limited

23

Inter-Task communication & Synchronization


The most important communication b/w tasks in an OS is the
passing of data from one task to another.

Message Producer Task

Message Receiver Task

If messages are sent more quickly than they can be handled, the
OS provides message queues for holding the messages until they can be processed.

(c) Telecommunications Consultants India Limited

24

Pipes
-Simple Communication Channel that takes data from one task to other -It Performs operation in one direction only.

Message Queue
- It allows message transfer from one task to other

(c) Telecommunications Consultants India Limited

25

Message passing in OS
Most General Purpose OS actually copy messages twice as they
transfer them from task to task via a message queue.

Message Sender Task

Message

RAM

Message RAM

Message Receiver Task

(c) Telecommunications Consultants India Limited

26

Message passing in RTOS


In RTOS, the OS copies a pointer to the message,
delivers the pointer to the message-receiver task, and then deletes the copy of the pointer with message-sender task.

Message Sender Task Message Message Receiver Task Message

RAM

msg_ptr msg_ptr

RTOS

(c) Telecommunications Consultants India Limited

27

Dynamic Memory Allocation in General Purpose OS


Non-real-time operating systems offer memory allocation
services from what is termed a Heap.

Heaps suffer from a phenomenon called External


Memory Fragmentation.

Fragmentation problem is solved by Garbage collection /


Defragmentation.

Garbage collection algorithms are often wildly nondeterministic.


(c) Telecommunications Consultants India Limited 28

How to choose RTOS


-Support of processor of your choice.

-Portability to new processor.


-Scalability to match varied application.

-Multiprocessor support.
-Extended services such as network support.

-Standard/POSIX.
-Language support
(c) Telecommunications Consultants India Limited 29

What Makes O.S as RTOS


-An RTOS has to be multitasking & Preemptive. -Notion of task Priority has to exist. -O.S has to support task synchronization. -System must be deterministic.

Why Win-NT is not RTOS


-An RTOS has to be multitasking & Preemptive. -Notion of task Priority has to exist. -O.S has to support task synchronization. -System must be deterministic.
(c) Telecommunications Consultants India Limited 30

Any Questions?

Thank You !

You might also like