RTOS Concepts

Post on 14-Nov-2014

26 views 4 download

Transcript of RTOS Concepts

CONCEPTS OF

REAL-TIME

OPERATING SYSTEM

OBJECTIVE To Understand Why we need OS? To identify Types of OS To Define Real - Time Systems To Classify real time Systems To Understand What is an RTOS ? Components of RTOS

How to choose RTOS?

To know secrets of What makes an OS as an RTOS ?

OPERATING SYTEMS

- Converts hardware of the system into virtual machine.

- Controls and coordinates use of hardware among various application programs

among users.

- Acts as an interface between users and hardware of the system.

Types of OS

OS

Size Function

Multi-ProgrammingEx:Unix,WinNT

Multi-TaskingEx:RTX-51

Smaller Ex:RTX-51

LargerEX:WinNT,Unix

CPU

I/O Devices

I/O S

ub

Syste

mFile

Manager L

anguage Support

Utilities

Application Programs Kernel

Architecture For Larger OS

Sched

ulerDespat-cher

Int.handler

DispatcherScheduler Int.Handler.

CPU

I/O Devices

Application Programs Kernel

Architecture For Smaller OS

3) Multi-tasking OS:- An instance of program in execution is called “Process / Task”.- Capability of OS to perform more than one task at same time.- Ability of OS to support concurrent execution of two (or) more programs.- OS switches from task to task simultaneously.- Two types are:

1) Cooperative2) Preemptive

3) Multi-tasking OS:- An instance of program in execution is called “Process / Task”.- Capability of OS to perform more than one task at same time.- Ability of OS to support concurrent execution of two (or) more programs.- OS switches from task to task simultaneously.- Two types are:

1) Cooperative2) Preemptive

3) Multi-Programming OS:

=

Multi-Tasking

+

* Forms of memory protection

* Enforces concurrency control when processes access shared I/O devices

and files.

Definition of Real-Time Systems

- Any system in which time at which output is produced is significant.This is because

input corresponds to some movement in physical world and output has to relate to that same movement.The lag from input time to output time must be sufficiently small for acceptable timeliness.

OR

- Systems in which correct responses are produced within a definite time limit. If computer responses exceed these time boundary then performance degradation and/or malfunction results.

- Ex: Flight control, Industrial control, military applications, robotics, nuclear power plant control, automobile engine control, etc.

Real-Time Systems

Hard

Hard

Soft

Soft

Classification of Real-Time Systems

Classification of Real-Time Systems

Soft: - Acceptance of lower performance for

lateness. - Rising cost for lateness of system.- Ex: vending machine, Temperature controller

Soft: - Acceptance of lower performance for

lateness. - Rising cost for lateness of system.- Ex: vending machine, Temperature controller

Hard:- No lateness is accepted under any circumstances.- Catastrophic failure if deadline missed- Cost of missing deadline is infinitely high- Ex: Missile system, aircraft.

Hard:- No lateness is accepted under any circumstances.- Catastrophic failure if deadline missed- Cost of missing deadline is infinitely high- Ex: Missile system, aircraft.

What is RTOS?

operating system, that helps to build real-time system.

operating system, that helps to build real-time system.

Components of RTOS

* Task Management

* Memory Management

* Intertask Communication

* Intertask Synchronization

* Task Management

* Memory Management

* Intertask Communication

* Intertask Synchronization

Functions of RTOS

1) Task Management: * Allocation of memory and CPU time to task. a) Scheduler:

- To keep a record of the state of each task

- To schedule the allocation of CPU time to each task.

b) Dispatcher: - To perform the context-switching.

1) Task Management: * Allocation of memory and CPU time to task. a) Scheduler:

- To keep a record of the state of each task

- To schedule the allocation of CPU time to each task.

b) Dispatcher: - To perform the context-switching.

Task State Diagram

NewNew ReadyReady RunningRunning HaltedHalted

WaitingWaiting

CPU SchedulingCPU Scheduling

- Deals with the problem of deciding which of the process(Task) in the ready queue is to be allocated with CPU. - Intention is to a) To maximize CPU utilization among

different tasks in a multi-tasking program. b) To minimize waiting time.

- Deals with the problem of deciding which of the process(Task) in the ready queue is to be allocated with CPU. - Intention is to a) To maximize CPU utilization among

different tasks in a multi-tasking program. b) To minimize waiting time.

Scheduling AlgorithmsScheduling Algorithms

a) First-Come-First-Served (FCFS)a) First-Come-First-Served (FCFS)

b) Shortest Job First (SJF)b) Shortest Job First (SJF)

c) Priority based Pre-emptionc) Priority based Pre-emption

d) Round-Robin (RR)d) Round-Robin (RR)

2) Memory management:- Dynamic memory Allocation- Used for storing intermediate results - Memory allocation and deallocation

must exist within constant time limits.

3) Intertask Communication: various mechanism available are:

(a) Pipes (b) Message queues (c) Remote procedural calls (RPC)

2) Memory management:- Dynamic memory Allocation- Used for storing intermediate results - Memory allocation and deallocation

must exist within constant time limits.

3) Intertask Communication: various mechanism available are:

(a) Pipes (b) Message queues (c) Remote procedural calls (RPC)

(a) Pipes:- Simple communication channel that can be used to send data from one task to another.- Pipe can be opened,closed,written to and read just like files.- Perform operation in only one direction.

(b) RPC:- Procedure in one process can directly call procedure in another process.- Two process may be running on same computer or on 2 different computers connected by network.

(a) Pipes:- Simple communication channel that can be used to send data from one task to another.- Pipe can be opened,closed,written to and read just like files.- Perform operation in only one direction.

(b) RPC:- Procedure in one process can directly call procedure in another process.- Two process may be running on same computer or on 2 different computers connected by network.

(c) Message Queues:- It allows transmission of messages from one task to another task.

4) Intertask Synchronization: Classified as:

(a) Signals (b) Semaphores

(a) Signals:- Used when task synchronization is required without data exchange.- Simplest and fastest method.

(c) Message Queues:- It allows transmission of messages from one task to another task.

4) Intertask Synchronization: Classified as:

(a) Signals (b) Semaphores

(a) Signals:- Used when task synchronization is required without data exchange.- Simplest and fastest method.

(b) Semaphore:- Resources can be shared free of conflicts between the individual tasks.- Consists of a data item and a pair of operations, wait and release.

(b) Semaphore:- Resources can be shared free of conflicts between the individual tasks.- Consists of a data item and a pair of operations, wait and release.

What makes an OS as RTOS?What makes an OS as RTOS?

* An RTOS has to be multi-tasking and preemptible.

* The notion of task priority has to exist.

* The OS has to support task synchronization mechanisms.

* A system of priority inheritance has to exist.

* System should be deterministic.

Case Study - Why Windows NT is not an RTOS?

* An RTOS has to be multi-tasking and preemptible.

* The notion of task priority has to exist.- But has only few level of priority,

therefore the predictability is poor * The OS has to support task synchronization mechanisms.

* A system of priority inheritance has to exist.

* System should be deterministic.

How to Choose RTOS?

Factors to be considered

* Support of your processor of choice* Portability to new processor

* Scalability to match varied application requirement* Multi processor support

* Extended services such as Network support

* Standards / POSIX compliance

* Language support

* Development environment

* Licensing arrangements & Price