29
CONCEPTS OF REAL-TIME OPERATING SYSTEM

RTOS Concepts

Embed Size (px)

Citation preview

Page 1: RTOS Concepts

CONCEPTS OF

REAL-TIME

OPERATING SYSTEM

Page 2: RTOS Concepts

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 ?

Page 3: RTOS Concepts

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.

Page 4: RTOS Concepts

Types of OS

OS

Size Function

Multi-ProgrammingEx:Unix,WinNT

Multi-TaskingEx:RTX-51

Smaller Ex:RTX-51

LargerEX:WinNT,Unix

Page 5: RTOS Concepts

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

Page 6: RTOS Concepts

DispatcherScheduler Int.Handler.

CPU

I/O Devices

Application Programs Kernel

Architecture For Smaller OS

Page 7: RTOS Concepts

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

Page 8: RTOS Concepts

3) Multi-Programming OS:

=

Multi-Tasking

+

* Forms of memory protection

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

and files.

Page 9: RTOS Concepts

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

Page 10: RTOS Concepts

- 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.

Page 11: RTOS Concepts

Real-Time Systems

Hard

Hard

Soft

Soft

Classification of Real-Time Systems

Page 12: RTOS Concepts

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.

Page 13: RTOS Concepts

What is RTOS?

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

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

Page 14: RTOS Concepts

Components of RTOS

* Task Management

* Memory Management

* Intertask Communication

* Intertask Synchronization

* Task Management

* Memory Management

* Intertask Communication

* Intertask Synchronization

Page 15: RTOS Concepts

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.

Page 16: RTOS Concepts

Task State Diagram

NewNew ReadyReady RunningRunning HaltedHalted

WaitingWaiting

Page 17: RTOS Concepts

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.

Page 18: RTOS Concepts

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)

Page 19: RTOS Concepts

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)

Page 20: RTOS Concepts

(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.

Page 21: RTOS Concepts

(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.

Page 22: RTOS Concepts

(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.

Page 23: RTOS Concepts

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.

Page 24: RTOS Concepts
Page 25: RTOS Concepts

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.

Page 26: RTOS Concepts

* System should be deterministic.

Page 27: RTOS Concepts
Page 28: RTOS Concepts

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

Page 29: RTOS Concepts

* Standards / POSIX compliance

* Language support

* Development environment

* Licensing arrangements & Price