0% found this document useful (0 votes)
16 views

Unit 4 RTOS

RTOS PPT ON VXWORKS

Uploaded by

tnagalaxmi
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Unit 4 RTOS

RTOS PPT ON VXWORKS

Uploaded by

tnagalaxmi
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 38

UNIT IV :

Elementary Concepts of VxWorks: Multitasking, Task State


Transition, Task Control – Task Creation and Activation, Task
Stack, Task Names and IDs,
 Memory Management – Virtual to Physical Address Mapping.
Comparison of RTOS – VxWorks, μC/OS-II and RT Linux for
Embedded Applications
VxWorks Facilities:
High-Performance Real-time Kernel Facilities:
The VxWorks kernel, wind, includes multitasking with preemptive priority scheduling, intertask
synchronization and communications facilities, interrupt handling support, watchdog timers, and memory
management.
POSIX Compatibility:
VxWorks provides most interfaces specified by the 1003.1b standard (formerly the 1003.4 standard),
simplifying your ports from other conforming systems.VxWorks provides a fast and flexible ANSI C-
compatible.
I/O System:
I/O system including UNIX standard buffered I/O and POSIX standard asynchronous I/O.
VxWorks includes the following drivers:
Network driver – for network devices (Ethernet, shared memory)
Pipe driver – for intertask communication
RAM “disk” driver – for memory-resident files
SCSI driver – for SCSI hard disks, diskettes, and tape drives
Keyboard driver – for PC x86 keyboards (x86 BSP only)
Display driver – for PC x86 VGA displays (x86 BSP only)
C++ Development Support.
Shared-Memory Objects (VxMP Option).
Virtual Memory (Including VxVMI Option).
Performance Evaluation Tools.
Network Facilities:
VxWorks provides “transparent” access to other VxWorks and TCP/IPnetworked
systems,
The VxWorks is a multitasking kernel, wind, uses interrupt-driven, priority-
based task scheduling. It features fast context switch times.

The wind kernel supplies semaphores as the basic task synchronization and
mutual-exclusion mechanism. There are several kinds of semaphores in wind,
specialized for different application needs: binary semaphores, counting
semaphores, mutual-exclusion semaphores, and POSIX semaphores.

All of these semaphore types are fast and efficient. In addition to being
available to application developers, they have also been used extensively in
building higher-level facilities in VxWorks.

For intertask communications, the wind kernel also supplies message queues,
pipes, sockets, and signals. d low interrupt latency.
What is Real Time ?

• “ Real time in operating systems:

The ability of the operating system to provide a required


level of service in a bounded response time.”
- POSIX Standard 1003.1
POSI
InXtoday's computing systems, it is becoming increasingly important to design
software with an open system architecture utilizing industry-adopted standards.
An open software architecture addresses the challenges of today's software
development process by defining standard software interfaces.
A standard must be based on well-established technology and accepted by a wide
portion of the industry.

The original Portable Operating System Interface for Computing Environments


(POSIX) standard was first published in 1990.
POSIX is based on UNIX, a well-established technology dating back to the early
1970s.
 POSIX defines a standard way for an application to interface to the operating
system.
The original POSIX standard defines interfaces to core functions such as file
operations, process management, signals, and devices. Subsequent releases of
POSIX have also been defined to cover real-time extensions and multi-threading.
POSIX (the Portable Operating System Interface) is a set of standards
under development by representatives of the software community,
working under an ISO/IEEE charter. The purpose of this effort is to
support application portability at the source level across operating
systems. This effort has yielded a set of interfaces (POSIX standard
1003.1b, formerly called 1003.4) for real-time operating system
services. Using these interfaces makes it easier to move applications
from one operating system to another.

Nearly all POSIX 1003.1b interfaces are available in VxWorks,


including POSIX interfaces for:
– asynchronous I/O
– semaphores
– message queues
– memory management
– queued signals
– scheduling
– clocks and timers
In addition, several interfaces from the traditional POSIX 1003.1
standard are also
supported.
POSIX real-time operating systems
The POSIX family of standards includes over 30 individual standards, ranging from
specifications for basic operating system services to specifications for testing the
conformance of an operating system to the standard.
It focuses on these standards important to the development of real-time embedded
systems.
POSIX real-time related standards
Of the more than 30 POSIX standards, the seven standards are especially relevant to
the development of real-time and embedded systems.
The first three standards-1003.1a, 1003.1b, and 1003.1c-are the most widely
supported. POSIX 1003.1a defines the interface to basic operating system functions,
and was the first to be adopted in 1990.1, Real-time extensions are defined in the
standards 1003.1b, 1003.1d, 1003.1j, and 1003.21.
However, the original real-time extensions, defined by 1003.1b, are the only ones
commonly implemented. Support for multiple threads in a process is provided in a
separate standard, POSIX 1003.1c. POSIX also includes support for high availability in
the 1003.1h standard
POSIX real-time extensions. POSIX 1003.1b, as well as 1003.1d and 1003.1j,
define extensions useful for development of real-time systems.
 Functions defined in the original real-time extension standard 1003.1b are
supported across a wider number of operating systems than the other two
specifications.
For this reason POSIX 1003.1b consists the following items constitute the
bulk of the features,Defined in POSIX 1003.1b:
•Timers: periodic timers, delivery is accomplished using POSIX signals
•Priority scheduling: fixed priority preemptive scheduling with a minimum of
32 priority levels
•Real-time signals: additional signals with multiple levels of priority
•Semaphores: named and memory counting semaphores
•Memory queues: message passing using named queues
•Shared memory: named memory regions shared between multiple processes
•Memory locking: functions to prevent virtual memory swapping of physical
memory pages
POSIX TIMER
For creating and using a POSIX timer-Creating a timer consists of two
steps:
specifying a signal that is to be delivered at timer expiration, and
creating/setting the timer itself. Ex. highest priority real-time signal
(SIGRTMIN) to asynchronously call the timer handler routine. Two values
must be specified for the timer: the initial expiration time (it_value) and
the frequency (tv_sec). The structure (itimerspec) allows nanosecond time
specification, however, actual resolution is dependent on the system. The
POSIX call clock_getres() can be used to determine the actual resolution,
typically 10ms or 1ms
Task Creation and Activation
Task Creation Routines
Call Description
taskSpawn( ) Spawn (create and activate) a
new task.
taskInit( ) Initialize a new task.
taskActivate( ) Activate an initialized task.

The arguments to taskSpawn( ) are the new task’s name (an


ASCII string), priority, an “options” word, stack size, main
routine address, and 10 arguments to be
passed to the main routine as startup parameters:
id = taskSpawn ( name, priority, options, stacksize, main,
arg1, …arg10 );
The taskSpawn( ) routine creates the new task context,
which includes allocating the stack and setting up the task
environment to call the main routine (an ordinary subroutine)
with the specified arguments. The new task begins execution at
the entry to the specified routine.
Types of RTOS(Some part of unit 5)
Commercial RTOSs
• VxWorks
• QNX
• MicroC/OS-II
• RTLinux
• Windows CE ( www.microsoft.com)
VxWorks
• Created by Wind River.
• Current Version: VxWorks 6.0 
• VxWorks is the most established and most widely
deployed device software operating system.
• Currently there are more than 300 million devices that
are VxWorks enabled.
• The core attributes of VxWorks, include high
performance, reliability, determinism, low latency and
scalability.
VxWorks (contd..)
• Enhanced error management
• Backward compatibility to previous verison features for
exception handling and and template support
• Extensive POSIX 1003.1, .1b, .1c compatibility (including
pthreads )

• Scheduling
– Uses preemptive priority with round robin scheduling to
accommodate for both
• Real time processes
• Non-real time processes
VxWorks (contd..)
• Memory Protection
– MMU based memory protection.

• Reduced Context Switch time


– Saves only those register windows that are actually in use (on a
Sparc)
– When a task’s context is restored, only the relevant register
window is restored
– To increase response time, it saves the register windows in a
register cache – useful for recurring tasks
VxWorks (contd..)
• Distinguishing features
– efficient POSIX-compliant memory management
– multiprocessor facilities
– shell for user interface
– symbolic and source level debugging capabilities
– performance monitoring
• Mars Exploration Rovers Spirit and Opportunity and the
Mars Reconnaissance Orbiter use the VxWorks operating
system
QNX/ Neutrino
• POSIX-compliant Unix-like real-time operating system.
• Microkernel design – kernel provides essential threads
and real-time services
• use of a microkernel allows users (developers) to turn off
any functionality they do not require without having to
change the OS itself.
• The system is quite small, fitting in a minimal fashion on
a single floppy, and is considered to be both very fast
and fairly "complete."
• The footprint of microkernel is 12kb.
• QNX is a message passing operating system
QNX/ Neutrino (contd..)
• Every driver, application, protocol stack, and file system
runs outside the kernel, in the safety of memory-
protected user space.
• As a result, virtually any component can fail - and be
automatically restarted -without affecting other
components or the kernel.
• Maximize application portability with extensive support
for the POSIX standard, which lets you quickly migrate
Linux, Unix, and other open source programs
MicroC/OSII
• Also known as µC/OS II or uC/OSII
• MicroC/OS has been designed as a small footprint real time pre-
emptive OS that was designed for embedded use on 8 bit platforms
upwards
• highly portable, ROMable, very scalable, preemptive real-time,
multitasking kernel
• has ports for most popular processors and boards in the market
• suitable for use in safety critical embedded systems such as
aviation, medical systems and nuclear installations
• Over 100 microprocessors are supported
• approved for use in a DO-178B aerospace system and is
(apparently) MISRA-C compliant
MicroC/OS-II
• Microcontroller operating system version –II is
developed by Jean J.Labrosse(
www.ucos-II.com)is a preemptive real-time
operating system which is popular in
academic institutions for teaching RTOS
concepts.
• It can support only 64 tasks out of which eight
are system tasks
• Round-robin scheduling algorithm is not
supported by this OS
MicroC/OSII ( Contd )
• µC/OS II features
– reentrant functions and is portable to different processors
• kernel is preemptive real time, managing up to 64 tasks,
with up to 56 tasks for each application
• Each task has a unique priority and its own stack
• Round robin scheduling is not supported
• operating system uses semaphores to restrict access to
resources shared by multiple elements of the system
• Memory management is performed using fixed size
partitions.
MicroC/OSII ( Contd )
• µC/OS II is a multitasking operating system
• Each task is an infinite loop and can be in any one of the
following 5 states
– Dormant, Ready, Running, Waiting, ISR
• services such as mailboxes, queues, and semaphores
RTLinux
• This OS was developed by FSM Labs(
www.fsmlabs.com) and available in two
versions RTLinux Pro and RTLinuxFree.
• The RTLinux Pro is the priced edition and
RTLinux Free is the free open source release.
• RTLinux is a hard real-time operating system
with support for many processors such as
x86,Pentium,PowerPC,ARM,Fujitsu,MIPS and
Alpha
• It does not support priority inheritance.
RTLinux
• Available as a patch to the regular Linux kernel
• Provides an RT API for developers
• RTLinux is a hybrid OS that runs a Linux kernel as an idle
thread (lowest priority) of the real-time kernel.
• Predictable delays.
– By its small size and limited operations.
• Finer timer resolution.
• RT kernel and RT applications are kept as simple as
possible and non-time critical applications (GUIs, file
systems) are handled by the standard Linux.
RTLinux ( Contd )
• Real time threads and interrupt handlers never delayed by non-
realtime operations
• Preemptible kernel.
– Its routines are very small and fast, this does not cause big
delays.
– Interrupts from Linux are disabled.
 RT-Linux has many kinds of Schedulers.
– FIFO.
• Used to pass information between real-time process and ordinary
Linux process.
• Designed to never block the real-time task.
– The “earliest deadline first” scheduler.
– Rate-monotonic scheduler.
Linux Kernel
Windows CE
• Windows CE (also known officially as Windows
Embedded Compact and sometimes
abbreviated WinCE) is an operating system
developed by Microsoft for minimalistic
computers and embedded systems.
• Windows CE is optimized for devices that have
minimal storage—a Windows CE kernel may
run in under a megabyte of memory
WINDOWS CE
• The system supports 256 priority levels and
uses priority inheritance for dealing with
priority inversion. The fundamental unit of
execution is the thread. This helps to simplify
the interface and improve execution time.
• A distinctive feature of Windows CE compared
to other Microsoft operating systems is that
large parts of it are offered in source code
form.
Programming languages Used
• C is most widely used in RTOS programming

• C++ and Ada are the next more popular for large
projects.

• Assembly languages for increasing efficiency and


reusing the previous code

• Java may also be a choice for some applications


UNIT IV :
VxWorks – POSIX Real Time Extensions, timeout features,
Task Creation,
 Semaphores (Binary,Counting), Mutex, Mailbox,Message
Queues
Comparison of RTOS – VxWorks, μC/OS-II and RT Linux for
Embedded Applications

Memory Management – Virtual to Physical Address Mapping.


VXWorks
Comparison of RTOS
RTLinux µC/OS QNX WinCE
Scheduler Preemptive & FIFO,EDF Preemptive Priority Priority-based
algorithm Round robin multitasking real Preemptive time-slice
algorthrithm time scheduling algorithm

Real Time Hard Hard Hard Soft Soft

POSIX Y N N Y N
support
Scalable Y Hard to scale beyond Y Scalable upto 8 N
target platform CPUs

License Propriety General Public Propriety Propriety Propriety


License(GNU GPL)
Kernel size 20KB 10MB 6K-26K 12KB 400KB
Memory Best Fit Uses regular Linux Fixed partition Strict memory Large memory
allocation Algorithm memory memory protection by mapped file
management allocation MMU support
provisions/no real
time allocation
Platforms ARM,Intel Alpha,AVR32,Micro Intel x86,Quartus IA-32,MIPS,SH- ARM,MIPS,SH4
64,Power blaze,OpenRISC,X8 platform 4,Strong and x86
PC,IA-32 6,ARM ARM,XScale Architecture
UNIT IV :
VxWorks – POSIX Real Time Extensions, timeout features,
Task Creation,
 Semaphores (Binary,Counting), Mutex, Mailbox,Message
Queues
Memory Management – Virtual to Physical Address Mapping.
What happens when we run out of main memory?
Our programs need more and more RAM!

NEED OF VIRTUAL MEMORY

•Memory management system is a collection of hardware and software procedures for managing programs in memory.
•Features of MMU are:-
1.
A facility that maps logical memory references to physical memory addresses.
2.
A provision of sharing common programs stored in memory by different users.
3.
Protection of information against un-authorised access between users.
Virtual Memory

VIRTUAL MEMORY
Give the programmer the illusion that the system has a very
large memory, even though the computer actually has a
relatively small main memory
Address Space(Logical) and Memory Space(Physical)
address space memory space
address
virtual Mapping
address physical address
(logical
address generated by programs
address) actual main memory address

ADDRESS MAPPING DONE IN TWO WAYS:


1.PAGING
2.SEGMENTATION

NEED OF PAGE TABLE : IN ADDRESS MAPPING , PAGE TABLE RESIDED IN


BETWEN VM & MM , GIVES THE INFORMATION OF WHICH PAGE NO. OF
VIRTUAL MEMORY WILL MAP TO WHICH frame(block) NO. OF MAIN MEMORY.
Paging Concept
Segmentation concept

• Logical address = Segment+ page+ Word


• Segment: segment number
Page: page within the segment
word: gives the specific word within the page.

 A segment can have 1 page or more, basing


on which the size of the segment can be decided.
 Here, mapping of logical address to physical
address is done by using two tables: segment
and page table.
 The entry in the segment table is a pointer
address for the page table base, which is then
added to page number(given in logical address).
The sum point to some entry in page table and
content of that page is the address of physical
block. The concatenation of block field with the
word field produces the FINAL physical mapped
address.

You might also like