RTOS_1_ppt

32

Transcript of RTOS_1_ppt

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 1/32

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 2/32

NEED FOR OS in embedded

systems� When there are multiple tasks� When time is µcritical¶

� Embedded systems can operate without OS ,byoperating on an µinterrupt¶ basis.

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 3/32

OS concepts� GPOS� RTOS

� Similar basic concepts ,but emphasis varies

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 4/32

The OS is a manager � It acts as a bridge between the user 

applications/tasks and system resources through

a set of system functionalities and services

� It manages the system resources and makes

them available to the user applications/tasks ona need basis

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 5/32

OS

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 6/32

The Kernel� is the core of the operating system� Kernel acts as the abstraction layer between system

resources and user applications

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 7/32

KERNEL services� Kernel contains a set of system libraries and services.

For a general purpose OS, the kernel contains differentservices likeo Process Management o Primary Memory Management o File System management o I/O System (Device) Management o

Secondary Storage Management o Protectiono Time management o Interrupt Handling 

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 8/32

Kernel space?

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 9/32

Kernel Space� The program code corresponding to the kernel

applications/services are kept in a contiguous

area (OS dependent) of primary (working)memory and is protected from the un-authorized access by user programs/applications

� The memory space at which the kernel code islocated is known as µKernel Space¶ 

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 10/32

User space?

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 11/32

User applications An operating system with virtualmemory support, loads the user applications into its correspondingvirtual memory space with demandpaging technique

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 12/32

Kernel applications

Most of the operating systems keep the kernelapplication code in main memory and it is not swappedout into the secondary memory

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 13/32

Monolithic kernel

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 14/32

Monolithic kernel ADVANTAGE

� The tight internal integration of kernel modules in monolithic kernelarchitecture allows the effective utilization of the low-level features of 

the underlying systemDRAWBACK� any error or failure in any one of the kernel modules leads to the

crashing of the entire kernel application

� LINUX, SOLARIS, MS-DOS kernels are examples of monolithic

kernel

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 15/32

MICROKERNEL

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 16/32

Microkernel� incorporates only the essential set of Operating System

services into the kernel

� Memory management, process management, timer systems and interrupt handlers are examples of essential services, which forms the part of themicrokernel

� QNX, Minix 3 kernels are examples for microkernel

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 17/32

Classifications� GPOS-no timing specifications

Personal Computer/Desktop system is a typicalexample for a system where GPOSs are deployed.Windows XP/MS-DOS etc

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 18/32

RTOS-� Deterministic in execution behavior. Consumes only

known amount of time for kernel applications

� Implements scheduling policies for executing thehighest priority task/application always

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 19/32

RTOS� Implements policies and rules concerning time-

critical allocation of a system¶s resources

� Windows CE, QNX, VxWorks MicroC/OS-II etc areexamples of Real Time Operating Systems (RTOS

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 20/32

The Real Time Kernel

� is highly specialized

� it contains only the minimal set of servicesrequired for running the user applications/tasks.

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 21/32

The basic functions of a Real Time kernel are

� Task/Process management� Task/Process scheduling� Task/Process synchronization

� Error/Exception handling� Memory Management� Interrupt handling� Time management

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 22/32

What is a task /process?

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 23/32

Task/Process

Management� Deals with� setting up the memory space for the

tasks,� loading the task¶s code into the memory

space,� allocating system resources,� setting up a Task Control Block (TCB) for 

the task� and task/process termination/deletion.

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 24/32

TCB ±parameters stored are kernel dependant

� T ask ID:� T ask State: active ,ready ,

�T ask 

T ype: Task type. Indicates what is the typefor this task. The task can be a hard real time or 

soft real time or background task.� T ask Priority : Task priority (E.g. Task priority =1

for task with priority = 1)

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 25/32

TCB� T ask Context Pointer : Context pointer. Pointer for 

context saving� T ask Memory Pointers: Pointers to the code memory,

data memory and stack memory for the task� T ask System Resource Pointers: Pointers to system

resources (semaphores, mutex etc) used by the task� T ask Pointers: Pointers to other TCBs (TCBs for 

preceding, next and waiting tasks)� Other Parameters Other relevant task parameters

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 26/32

Issues in task management� Task/Process Scheduling:

�Task/Process Synchronization ±

� Error/Exception handling

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 27/32

Task process synchronisation� synchronizing the concurrent access of a

resource, which is shared across multiple tasks

� and the communication between various tasks.

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 28/32

Error/Exception handling� Insufficient memory,

� timeouts,-task level� deadlocks-kernel level� deadline missing,� bus error,� divide by zero,� unknown instruction execution

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 29/32

Memory management� --diluted compared to GPOS� Because timing contraints are the more important

factor 

� Usually uses generally uses µblock ¶ basedmemory allocation technique

� Protection is absent or minimal (optional for some systems)

� Virtual memory concept is used if there issecondary memory

� Memory allocation should take fixed time

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 30/32

Interrupts� Synchronous ±of the same task, like divide by zero ,

memory segmentation error etc� Asynchronous interrupts can cause context

switching-� Priority levels ,nesting ,preemption etc are possible

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 31/32

TIMER� There should be ahigh resolution RTC.� The hardware timer generates interrupts known as

µtimer ticks¶ ±usually in the usecs range

8/6/2019 RTOS_1_ppt

http://slidepdf.com/reader/full/rtos1ppt 32/32

Hard real time and soft real time

?