Vous êtes sur la page 1sur 19

RTOS

Need of an OS
Felt to overcome the shortfalls of simple sequential programming:1.no. of tasks being high some sporadic tasks may be missed 2.If one of the tasks is held up, whole system will so. 3.Some tasks may need to be prioritized. 4.Requires large RAM as all of the tasks acquire memory for all the time.

Real time systems


Real-time systems are characterized by the fact that severe consequences may result if logical as well as timing correctness properties of the system are not met they must receive and respond to a set of external stimuli within rigid and critical time constraints referred to as deadlines There are two types of RT systems 1. Hard RT 2. Soft RT

Hard
Hard real time means strict adherence to each task deadline. When an event occurs, it should be serviced within the predictable time at all times in a given hard real time system. Automobile engine control system and anti lock brake are the examples of hard real time systems

Soft
In which deadlines are mostly met. Soft real time means that only the precedence and sequence for the task-operations are defined, interrupt latencies and context switching latencies are small but there can be few deviations between expected latencies of the tasks and observed time constraints and a few deadline misses are accepted . Mobile phone, digital cameras and orchestra playing robots are examples of soft real time systems

RTOS
A real time operating system (RTOS) is multitasking operation system for the applications with hard or soft real time constraints and system having the service deadlines of tasks, interrupt service threads and ISRs Real-time constraint means constraint on occurance of an event and system expected response to the event

Funtion of RTOS
Generally performs three main functions It decides which task should run and for how long i.e schedules. It provides communication and synchronization between tasks, ISRs and ISTs. It controls the use of resources shared between the tasks, for example memory and hardware peripherals

Different types of RTOS


In-House Developed RTOSes Broad based Commercial RTOSes ex: eCOS,uc/OS-II ,vxWorks,salvo General Purposes OSes with RTOS ex:RTLinux,windowsCE Special Focus RTOSes Symbian for mobile phones,OSEk for automobiles

Diff of OS &RTOS

Parts of an RTOS
Basic parts are Scheduler (kernel) RTOS services Synchronization and messaging tools may have some common device drivers ( TCP/IP, FS, keyboard , lcd, USB etc.)

Sheduling
Cooperative scheduling Round-robin scheduling Preemptive scheduling (static/dynamic) Preemptive plus round-robin

The kernel usually provides an interface to manipulate task operations. Typical task operations are: Creating a task Deleting a task Changing the priority of a task Changing the state of a task

RTOS Services
RTOS services are utilities provided by the kernel that help developers create real-time tasks efficiently. For example, a task can use time services to obtain the current date and time. Some of these services are: Interrupt handling services Time services Device management services Memory management services Input-output services

Synchronization and Messaging Tools


Synchronization and messaging tools are kernel constructs that help developers create real-time applications. Some of these services are: Semaphores Event flags Mailboxes Pipes Message queues

Device drivers
It is a piece of software that -reads and/or writes that particular device's data, control and status registers directly. -hides the underlying hardware from the application software developer (hardware abstraction) -handles interrupts from the device -provides APIs for accessing the device to the application developer. -is to be as much general as possible to a class of devices (ex: flash devices) void flashErase(uint32_t sector); void flashWrite(uint32_t offset, uint8_t *pSrcAddr, uint32_t numBytes);

Benefits of having device drivers


Because of the modularity, the structure of the overall software is easier to understand. In addition, it is easier to add or modify features of the overall application as it evolves and matures, even in deployed units. Because there is only one module that ever interacts directly with the peripheral's registers, the state of the hardware device can be more accurately tracked. Software changes that result from hardware changes are localized to the device driver, thereby making the software more portable.

Structure of a RTOS
RTOS from different vendors: VxWorks, pSOS, RTLinux

Appln prog

System calls Drivers

Real time Real time task task

Real time task

Interrupt or polling

I/O

Scheduler KERNEL Scheduler

I/O Interrupt

Interrupt
Hardware

Variations

RT kernel type RTOS

General OS type RTOS

Hybrid RTOS

Time criticality
Times which are critical on the performance of an embedded system Repetition Rate( periodic tasks) Execution Time Required Response time (to an event ) Task (Context) Switching

Characteristics of a RTOS
Deterministic (i.e predictable) Interrupt latency should be small Context switching time should be small Configurable Scalable Protection mechanism need not be present

Vous aimerez peut-être aussi