VX Works
VX Works
VX Works
Objectives
State essential characteristics operating system. of the VxWorks
Contents
VxWorks Facilities VxWorks Basics VxWorks Libraries
VxWorks Quick-Start
VxWorks Facilities
VxWorks Features
Real-time Kernel. POSIX Compatibility. I/O System along with lot of drivers. Local File System. TCP/IP Network Support. C++ Development Support. Shared Memory Object, Virtual Memory. Target Agent, Target Resident Tools. Board Support Packages (BSPs). Utility Libraries. Performance Evaluation Tools. VxWorks Simulator.
VxWorks RTOS
Memory Management
Device Support
I/O system
Networking Support
Standard Images
Types of Images ROMable compressed ROMable uncompressed ROM resident Downloadable uncompressed VxWorks Tornado _ vxWorks_rom vxWorks.res_rom_nosym vxWorks VxWorks Standalone vxWorks.st_rom _ vxWorks.res_rom vxWorks.st Boot Program bootrom bootrom_uncmp bootrom_res _
Not all BSPs will support all of these images. Some BSPs support addititional images. Standalone VxWorks has a target shell and built-in symbol table. Network support is included but not initialized. The file target\h\make\rules.bsp has the make rules for building these images.
VxWorks Quick-Start
VxWorks Basics
What is Real-Time?
Real-time denotes the ability of a control system to keep up with the system being controlled. A system is described as being deterministic if its response time is predictable. The lag time between the occurrence of an event and the response to that event is called latency. Deterministic performance is the key to real-time performance. Deterministic operation:
A late answer is a wrong answer.
Design Options
Unitasking Approach
One task controlling all the components in a loop.
arm() { for( ; ; ) { if (joint1 needs moving) moveJoint1(); if (joint2 needs moving) moveJoint2(); if (joint3 needs moving) moveJoint3(); . . } }
Multitasking Approach
Create a separate task to manipulate each joint:
joint() { for( ; ; ) { wait; /* Until this joint needs moving */ moveJoint(); } }
Each task alternates between ready and waiting. Vxworks allows a task to wait for:
A specified time delay An event (e.g. an interrupt)
VxWorks
VxWorks is a multitasking operating system optimized for real-time and embedded applications.
Low interrupt latency and context switching time. Low system call overhead. Scalable. Portable: well defined BSP.
VxWorks consists of core kernel facilities and peripheral facilities which depend on the kernel.
Loosely, kernel functions are those which can directly change the states of tasks.
Multitasking Kernel
Manages tasks. Transparently interleaves task execution, creating the appearance of many programs executing simultaneously and independently.
Process
A process is a single executable module that runs concurrently with other executable modules. For example, in Windows a word processor, an internet browser, and a data base, are separate processes and can run concurrently Processes are separate executable, loadable modules Each process has its own separate program space. Process A cannot read or write into process B's program space. Each process carries the same overhead in terms of bulk that an EXE requires.
Thread
A thread is a task that runs concurrently with other tasks within a single executable file Threads are memory efficient Threads share a common program space Thread task switching time is faster Threads are typically not loadable
Task
Task is a generic term that refers to an activity carried out by software that occurs independently from other activities in the system. Tasks are separate executing programs called Process. Tasks execute in the context of a single program (Process) called Thread. A task is an independent thread of execution, capable of executing in parallel with other threads of execution.
It is often essential to organize an application into independent, though cooperating, programs; each of these programs while executing is called a task.
Performance Optimizations
All tasks execute in the same address space:
RAM fooLib.c
static int x;
tTaskA fooSet(4)
tTaskB fooSet(99)
EXEC.
SUSPENDED
Scheduling Policies
First-Come-First-Served (FCFS) Shortest Job First (SJF) Priority based Pre-emption Round-Robin (RR) Co-Operative
Pre-emptive Scheduling
A multi-tasking scheduling policy by which a higher priority task will preempt a lower priority task when the higher priority task has work to do
Round-Robin Scheduling
A multi-tasking scheduling policy in which all tasks are run in their turn for a fixed Time period, one after the other. When all tasks have run, the cycle is repeated.
Co-operative Scheduling
A group of tasks run cooperatively where each must voluntarily relinquish control so that other tasks can run. In other words A task will run forever, thus starving other tasks, unless it voluntarily gives up control. Control can be relinquished explicitly by a yield, pause, or suspend; or implicitly by waiting for an event.
Context Switches
When one task stops executing and another task starts, a context switch has occurred. Context switches occur:
If a higher priority task becomes ready to run
made ready by executing task. made ready in an interrupt, or times out on a blocking call.
If the executing task makes a blocking kernel call (moving into a pended, delayed, or suspended state).
What happens:
CPU registers for outgoing task stored in its TCB. CPU registers for incoming task retrieved from its TCB.
Round-Robin Scheduling
To allow equal priority tasks to preempt each other time slicing must be turned on: kernelTimeSlice (ticks) if ticks = 0, time slicing is tuned off. Priority scheduling always takes precedence.
Round-Robin only applies to tasks of same priority.
VxWorks Quick-Start
VxWorks Libraries
taskLib
taskLib contains the kernel functions for creating, destroying, starting and stopping tasks. Example routines:
To create and start a new task:
Thank You