Vxworks and Embedded Linux

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 26

VxWorks

Topics Covered
What is Real Time Operating System (RTOS)
Standard for RTOS
VxWorks Features as RTOS
Layer Structure
Microkernal Functions:
Multitasking
Scheduling
Interrupt Service Code
Shared Code and Reentrancy
Intertask Communications
Applications for VxWorks

What is Real Time OS (RTOS)


RTOS Characteristics
Processing must be done within a time constraint or the
system will fail.
All delays in the system will be bounded; from the retrieval of
stored data to the time RTOS finishes the request.

Types of RTOS
Hard RTOS
Soft RTOS

Standard for RTOS

Standard requirement for RTOS


POSIX 1003.1b by ISO/IEEE chapter.
POSIX interfaces:
Asynchronous I/O

Queued signals

Semaphore

Scheduling

Message queues

Clocks and timers

Memory management

Layer Structure

Real-Time Embedded Application

Graphics
Java Support

Multiprocessing

Internet

POSIX Library

File System

WindNet Networking
Core OS:

Wind Microkernal

Multitasking

S
Suspended used primarily for debugging

Ready wait for CPU,


a single primitive=create+activate
Pended blocked, wait t time for recourses. After
t - Error.
Delay asleep for t time, after t goes to ready state.
On a context switch, a tasks context is saved in TCB. All code
executes in a single common space. Memory isnt saved.6

Scheduling, One CPU

Priority-based preemptive scheduling


Each task has priority (from 0 - highest to 255 lowest). Each priority has its own queue.
If two tasks are in the ready state, a lower priority task
would be pre-empted by one of a higher priority.
Round-robin scheduling
After time slice for a task expires, another task with the
same priority will execute during the given time slice.
Preemption locks
These locks prevent task context switching, but do not
prevent interrupt handling.

Interrupt Service Code

Via interrupts, the system is informed of external


events.
Interrupt Service Routines (ISRs) run outside any
task context.
Interrupt handling involves no task context switch.
Limitations of ISR:
All ISRs share the same stack
ISR has no context that can be suspended
Cannot take the semaphore, but can give the
semaphores, releasing any task waiting on them.
Cannot perform I/O through drivers except pipe.

Shared Code and Reentrancy

Shared Code - a single copy of code executed by multiple


tasks.
Shared Code must be reentrant. A subroutine is reentrant if a
single copy of the routine can be called simultaneously from
several task contexts without conflict.
Reentrancy Techniques:
Dynamic Stack Variables
Global and Static Variables Guarded by Semaphores
Task Variables

Shared Code and Reentrancy, Continued

Dynamic Stack Variables


Tasks
Task1( ){ ..

Task Stacks

Common Function

myData1

comFun(myData1)
}

comFun(yourData){
}

Task2( ){ ..
comFun(myData2)
}

myData2

10

Shard Code and Reentrancy, Continued

Guarded Global and Static Variables


Mutual-exclusion mechanism - only one task at a time
can be in a critical section of the code.
Task Variables
Four byte variables are added to the task context
block (TCB).

11

Intertask Communications, One CPU

Types of Intertask Communications:


Shared Data
Message Queue
Pipes - Virtual I/0
Network Intertask Communication
Sockets
Remote Procedure Call

12

Intertask Communication, Shared Data

Tasks
1.

Access SharData

2.

Access SharData

3.

Access SharData

Memory

SharData

13

Semaphores
Semaphore - mechanism for mutual exclusion and intertask
communication.
Binary Semaphore
Semaphore
available
YES

NO

TimeOut=
No_Wait

NO

Task is
pended for
timeOut

YES

Task cont.

Task cont.

Semaphore
taken

Semaphore
not taken

14

Semaphores, Continued
Counting Semaphore
Every time is semaphore is given count ++
Every time is semaphore is taken count - If count=0, task that tried to take semaphore is blocked
If semaphore is given and task is blocked, task is
unblocked
Is semaphore is given and no tasks are
blocked, count ++
Special Semaphore Option (Not in POSIX)
Timeout
Time the task is willing to wait (time in ticks) in pended
state. If time > timeout, ERROR occurs.
15

Intertask Communication, Message


Queue
Allows a variable number of messages to be queued
Any task or ISR can send a message to a queue.
Multiple tasks can send and receive from the same
message queue.
Timeout Parameter:
Send message: how long to wait for buffer space
to place message.
Receive message: how long to wait to obtain
message.

16

Applications for VxWorks

Some usage of RTOS


Flight simulators

Printers

Radio and optical telescopes

Digital cameras

Navigation systems

Hand-held computing
devices

Deep sea instrumentation


Traffic control systems

Routers, switches, and


other network devices

Modems
any systems where rigid time requirement have been
placed on the operation of a processor or the flow of the data.

17

Commercial Embedded Linux


Neoware NeoLinux
Red Hat derived for information
appliances
PalmPalm Tynux
Internet appliuance and multimedia
Red Hat Embedded Linux
general purpose embedded solution
RedSonic Red-Ice Linux
runs from DiskonChip or
CompactFlash

Commercial Embedded Linux


RidgeRun DSP Linux
for multimedia, wireless, RT on DSP
TimeSys Linux GPL
low latency enhanced kernel
Tuxia TASTE
distro targets Internet appliances
Vital Systems vLinux
for ARM based embedded apps

Open Source Embedded Linux


Embedded Debian Project
convert Debian to an embedded OS
ETLinux
for PC104 SBCs
uCLinux
for microprocessors that dont have MM
uLinux (muLinux)
distro fits on a single floppy

Commercial Linux RTOS


FSMLabs - Open RT Linux
Lineo - Embedix Realtime
LynuxWorks - BlueCat RT
MontaVista Software - Real Time
Extensions
REDSonic - REDICE Linux
TimeSys - Linux/Real-Time

Open Source Linux RTOS


ART Linux - real time extension based on
RTLinux
KURT - event schedules with 10us resolution
Linux-SRT - for soft real time apps like
multimedia
Qlinux - provides Quality of Service guarantees
RTAI - hard Real Time Application Interface

RTLinux
A hard real-time mini operating system
runs Linux as its lowest priority execution
thread
Linux thread completely preemptible
Real time threads and interrupt handlers
never delayed by non-realtime operations
Supports user level programming
MiniRTL implementation fits on a floppy

Whats so special about Linux?


Multiple choices vs. sole source
Source code freely available
Robust and reliable
Modular, configurable, scalable
Superb support for networking
and Internet
No runtime licenses
Large pool of skilled developers

Whats so special about Linux?

Whats special about Open Source?

You might also like