24
2008 Chapter-8 L10: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc. 1 REAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System Real Time Operating System

REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

  • Upload
    ngodat

  • View
    226

  • Download
    0

Embed Size (px)

Citation preview

Page 1: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

1

REAL TIME OPERATING SYSTEMS

Lesson-10:Real Time Operating System Real Time Operating System

Page 2: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

2

1. Real Time Operating System 1. Real Time Operating System DefinitionDefinition

Page 3: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

3

Real Time Real Time

A real time is the time which continuously increments at regular intervals after the start of the system and time for all the activities at difference instances take that time as a reference in the system.

Page 4: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

4

RTOSRTOS

A real time operating system (RTOS) is multitasking operation system for the applications with hard or soft real time constraints

Page 5: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

5

RTOSRTOS

Real-time constraint means constraint on occurance of an event and system expected response and latency to the event.

Page 6: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

6

Basic OS Functions Basic OS Functions

Process Management, Resources Management, Device Management, I/O Devices subsystems Network Devices and subsystems

management

Page 7: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

7

Process Priorities AllocationProcess Priorities Allocation

User level priorities allocation, called static priority allocation or real-time priority allocation is permitted.

The real time priorities are higher than the dynamically allocated priorities to the OS functions and the idle priority allotted to low priority threads.

The idle priority thread or task is one which runs when no other high priority ones running.

Page 8: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

8

Process Management by Preemption Process Management by Preemption

RTOS kernel preempts a lower priority process when a message or event for that was waiting is obtained for the higher priority process.

The RTOS kernel has the preemption points at the end of the critical code and therefore the RTOS can be preempted at those points by a real time high priority task.

Only small sections in the RTOS functions are non-preemptive

Page 9: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

9

Process Priorities Management by priority Process Priorities Management by priority Inheritance Inheritance

Priorities Inheritance enables a shared resource in low priority task, for example, LCD display, be used by high priority task first.

An intermediate priority task will not preempt the low priority task when it is locked to run the critical shared resource or code for the high priority task.

Page 10: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

10

Process Priorities Management by priority Process Priorities Management by priority Inheritance Inheritance

Priority sealing in place of priority inheritance option can also be used for a specific system.

Page 11: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

11

Process Predictability Process Predictability

A predictable timing behavior of the system and a predictable task-synchronization with minimum jitter (difference between best case latency and worst case latency)

Page 12: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

12

Memory Management by Protection Memory Management by Protection

In RTOS threads can run in kernel space. The real time performance becomes high.

However, then a thread can access the kernel codes, stack and data memory space, and this could lead to unprotected kernel code

Page 13: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

13

Memory Management: Disabling MMU Memory Management: Disabling MMU

Either disabling use of MMU and virtual memory or using memory locks.

Memory locking stops page swapping between physical memory and disk disabled. This makes RTOS task latencies predictable and reduces jitter (time between worst case latency and best case latencies for a task or thread).

Page 14: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

14

Memory Allocation Memory Allocation

In RTOS, the memory allocation is fast and there are , fixed length memory block allocationt and system takes predictable time for allocation

Page 15: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

15

Scheduling and InterruptScheduling and Interrupt--latency control latency control functions functions

Real time Task-Scheduling and Interrupt-latency control and uses of the timers and system clocks

Page 16: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

16

Timer Functions and Time Management Timer Functions and Time Management

Provides for timer functions. There is time allocation and de-allocation to attain best utilization efficiency in given timing constraints

Page 17: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

17

Asynchronous IO Functions Asynchronous IO Functions

Permits asynchronous IOs, which means IOs without blocking a task

Page 18: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

18

IPC Synchronization IPC Synchronization

Synchronization of tasks with IPCs (Semaphores, mailboxes, message queues, pipes, sockets and RPCs)

Page 19: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

19

Spin Locks Spin Locks

Spin locks for critical section handling

Page 20: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

20

Hard and soft real time operability Hard and soft real time operability

Hard real-time and soft real-time operations

Page 21: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

21

Time Slicing Time Slicing

Time-slicing of the processes execution of those processes which have equal priority

Page 22: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

22

SummarySummary

Page 23: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

23

We learntWe learnt• RTOS is an OS for response time controlled

and event controlled processes. The processes have predicable latencies and execute by preemptive scheduling

• An RTOS is an OS for the systems having the hard or soft real timing constraints and deadline on the tasks, ISTs and ISRs

Page 24: REAL TIME OPERATING SYSTEMS Lesson-10 · PDF fileREAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System . 2008 Chapter-8 L10: "Embedded Systems -Architecture, Programming

2008Chapter-8 L10: "Embedded Systems - Architecture,

Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

24

End of Lesson 10 of Chapter 8End of Lesson 10 of Chapter 8