LynxOS is used in aeronautics and safety critical systems since it is

advertisement
Exploring LynxOS
CS-550-2
Fall 2003
By
How-Shen Chang
Exploring LynxOS
1
Table of Contents:
Introduction ......................................................... Error! Bookmark not defined.
Hardware characteristics ............................ Error! Bookmark not defined.
Process management .......................................... Error! Bookmark not defined.
Memory Management ....................................................................................................5
Driver Programming ......................................................................................................7
Quality of Service ..........................................................................................................7
Networking Support .......................................................................................................7
Trace and Debug…………………………………………………………….................8
Embedded Success Stories……………………………………………………….….....9
Conclusion……………………………………………………………………….…....10
Exploring LynxOS
2
Introduction
LynxOS is a UNIX-compatible, POSIX-conforming,
multiprocess, and multithreaded operating system designed
for complex real-time applications that require fast,
deterministic response. The LynxOS kernel was
specifically designed for hard real-time applications.
Since its first release in 1988, LynxOS has been fully
pre-emptible, re-entrant, and compact.
The modularity inherent in the LynxOS architecture
makes the operating system highly scalable and
configurable. At its smallest, LynxOS can be configured
with only the kernel and linked with an application to
form a ROMable image for specialized embedded
applications. At its fullest, LynxOS is a self-hosted
development environment consisting of a wide array of
software development tools, UNIX-compatible utilities,
industry standard networking, a graphical user interface,
and a UNIX-like hierarchical file system.
Hardware characteristics
LynxOS is used in aeronautics and safety critical
systems since it is presented as a highly dependable and
fault-tolerant system. LynxOS is already available for a
large number of processors and does its best to optimize
their use, it envolves in particular very good memory
management. LynxOS is a UNIX/POSIX conforming RTOS. It is fully
conformant with POSIX interfaces for core services, realtime extensions, and thread extensions.
A large variety of processors are supported. Among
them the most important are:





Motorola: PowerPC (PPC 601, 603, 604), PowerPC G3
(PPC 75x), PowerPC G4 (PPC 7400,7410,74xx) with
Altivec Support, PowerPC IBM 405,440.
Intel: x86(IA-32) Architecture (and compatible).
MIPS
Xscale
ARM9
Kernel feathers:




Hard real-time determinism
Multitasking and multithreaded RTOS
Unlimited number of tasks
Extensive support for multi-threaded
application
Exploring LynxOS





















3
Complete MMU based protected address spaces
for tasks
Page level memory mapping for efficient memory
management
256 priority levels
Priority inheritance semaphore support
Kernel threads and priority tracking support
Four scheduling policies (FIFO, Priority
Quantum, Round-Robin, Non-preemptive)
Deterministic context switching through real time scheduling
Low interrupt & task response times through
efficient interrupt handling
Demand paged virtual memory support
Comprehensive inter-task communication
facilities
Comprehensive POSIX API conformance
1003.1, .1b & .1c.
MMAP support for regular files and shared
memory
Configurable tick timer resolution
Configurable time quantum for priority levels
Efficient floating point context management
Modular design for flexible footprint
management
POSIX real-time timer and clock support
Kernel crash analysis
Up to 512MB of system managed RAM
Up to 1.5GB of RAM can be utilized using MMAP
per process (for over 2GB total supported RAM
on LynxOS v4.0)
Dynamic device drivers
File system support:




Lynx Fast File system
ISO 9660 file system
Network File System (NFS)
RAM disk file system
Process management
LynxOS is a hard-real-time OS, it is fully
preemptible and reentrant. It uses a RT Global Scheduler
and implements priority inheritance and priority tracking
so that the highest priority thread runs regardless of
which process it is in or if it's a kernel thread.
Moreover, it provides deterministic response-time for
Exploring LynxOS
4
tasks even in the presence of multiple interrupts; the
highest priority task will only be interrupted once for
each device thanks to the priority tracking policy.
LynxOS applies a uniform global priorities management:



Kernel and application threads exist within the same
priority space
Same scheduler queues for kernel and application
threads
High priority application threads are scheduled
before lower priority kernel threads
Kernel threads may utilize 1/2 priority steps and
priority tracking so they run before the user task they
serve, but after higher priority user tasks
Scheduling policy:
Three scheduling policies are available:
SCHED_FIFO (first-in, first-out)
Standard POSIX FIFO policy. A preemptible fixed
priority scheduler.
SCHED_RR (round robin)
SCHED_OTHER (Proprietary Lynx scheduling policy
named "Priority based quantum")
This is similar to round robin policy, except the
fact that a configurable time quantum is defined for
each level of priority. This time quantum can be set
using the setquantum() call.
The default value for the time quantum is 640ms. It
can be modified; it is the system constant named
QUANTUM defined in the configuration file
/usr/include/param.h
The scheduling policy is modifiable
3 functions rinsert(), redesert(), rsched() are used
to manipulate the different scheduler queues (ReadyQueue, Fast-Ready-Queue,...) and the function
newcontext() achieves context switching between
processes
Periodic threads:
Exploring LynxOS
Barriers as defined in POSIX1.d can be used to
implement periodic threads
Range of priorities and maximum number of threads:
There is up to 256 levels of priority for the
application (user level) and 256 for the kernel.
Moreover, half priorities are used for the priority
tracking mechanism specific to LynxOS.
Thread creation and deletion:
Every thread has its own stack, register set,
priority, and scheduling algorithm.
The priority is inherited from the caller of
pthread_create().The schedpolicy attibute is
SCHED_FIFO.
Supports thread control and cancellation model as
defined by POSIX 1003.1c threads.
Memory management
Conventional UNIX protections exist between
application threads of different processes. Threads of a
process share the virtual address space of that process
(excellent for IPC and I/O). Application threads execute
in the address space of a conventional process, kernel
threads execute in the kernel's address space. LynxOS
exploits very well hardware memory management unit (MMU)
from the processor MMU, so that each process has its own
virtual memory space perfectly protected. This is
important to guaranty quality of service and to build
robust systems. Moreover paged style MMU eliminates
system wide memory fragmentation.
Kernel data structures are protected thanks to
user/kernel mode as in Linux. User processes "trap" into
the kernel to execute system calls. Kernel/user mode is
supported directly by microprocessor privilege levels.
User processes are limited in memory regions they can
access and instructions they can execute. Kernel can
access all memory regions.
General MMU design:
The processor sends a virtual address to the MMU.
5
Exploring LynxOS



The MMU can be controlled to bypass all of its
translation and control circuitry and pass the
address directly onto the system memory bus.
This is called real-addressing mode.
The MMU can be programmed to translate segments
of logical addresses to equivalent sized
segments of physical memory. The PowerPC
processor has a fixed number of registers
called block address translation (BAT)
registers that are explicitly designed for
translating large segments of memory.
The MMU can be programmed to translate logical
addresses to physical addresses on a page by
page basis through the use of page tables. To
speed the translation, a cache of the most
recently accessed pages logical to physical
mappings is kept in the MMU. This cache is
called the Translation Lookaside Buffer (TLB).
The PowerPC MPC750 has a 128 -entry TLB for
instruction accesses and a 128-entry TLB for
data accesses. This allows 1MB of address space
translations to be in the MMU cache at any time
if the system is programmed with 4KB pages.
Translations that are resident in the TLB will
be posted to the system memory bus in the same
clock cycle that they are received. If an
accessed virtual address page translation is
not currently in the TLB, the access into the
page will cause the MMU or processor to find
the associated page table entry (PTE) in cache
or memory. It will load the TLB with the
mapping, and pass the address to the system
memory bus. Therefore, any subsequent accesses
to that page will occur as TLB hits, and
process in the same clock as they were posted
to the MMU. It is easy to see that the only
performance impact of using the MMU to
6
Exploring LynxOS
7
translate addresses, is when the TLB miss
occurs and the PTEs must be read and reloaded
into the TLB.
Driver programming
Drivers can use POSIX-style threads of execution
within the kernel for interrupt handling. LynxOS treats
these threads like normal users’ threads with software
priorities not interrupt priorities. The driver interrupt
handler does a minimum of work and signals the kernel
thread that interrupt-related data is available.
LynxOS implements priority tracking. Kernel threads
begin their existence with a very low priority as created
by a driver. When a user thread opens the device, the
kernel thread promotes its own priority and inherits the
priority of the user thread opening the device. If
another user thread of higher priority opens the device,
the kernel thread bumps its priority up to match the
other thread; when I/O is complete the kernel thread
returns to the next pending thread's priority level, or
to its starting level. Kernel threads may use 1/2
priority steps and priority tracking so they execute
before the user task they serve, but after higher
priority user tasks.
Quality of services
Every OS component is designed for absolute
determinism. This means that they absolutely must respond
within a known period of time. This predictable response
is ensured even in the presence of heavy I/O due to the
kernel's threading model enabling interrupt routines to
be extremely short and fast.
Users can configure ticks per second for real-time
clocks. The define TICKSPERSEC in the /usr/include/conf.h
file defaults to 100 ticks per second (which leads to
10ms between ticks). Recommended minimum and maximum
ticks per second are 20 (2ms between ticks) and 500 (50
ms between ticks).These numbers can vary depending on a
systems hardware limitations. It is possible to add
hardware timers, they are handled by specific drivers
interfaced with the POSIX timer.
Networking support
TCP/IP Technology has been available for many years.
Based upon FreeBSD 4.2 network stack, it includes high
Exploring LynxOS
8
level features (IPSec,IPv6, Integrated firewall, NAT
(Network Address Translation).
Zebra routing protocols are supported.
SNMP support is available.
Other network facilities supported are: DHCP, NTP,
XNTP, OpenSSL, NFS, Samba.
Supported protocols: TCP, UDP, ICMP, IGMP, ARP,
RARP, DHCP, NAT, RPC, NTPv3
Network Security

Secure DNS dynamic update

IPSEC AH, IPSEC ESP

PPP Password Authentication, PPP Challenge
Handshake AP

Firewall support: ipfw, ip6fw
Network Management

SNMP v1, v2 and v3

BIND: dns services, named
Network Device Support

Gigabit Ethernet

100baseT interfaces







Trace and debug
A LynxOS integrated version of gdb called Total/db is
available to help debugging embedded/real-time
applications. It is included in the LynuxWorks Open
DEvelopment Environment (ODE).
LynuxWorks has extended gdb capabilities to include:





Multi-threaded applications debugging:
o LynxOS thread ID display
o Thread context switching
o Thread-specific breakpoints
System and device driver debug (with LynusWorks skdb
Simple Kernel Debugger)
Remote network and serial target connections
Cross hosted and LynxOS native debugging
Optional INSIGHT graphical debugger user interface
A large offer of development and debugging tools are
available. The LynuxWorks Open Development Environment
(ODE) includes a variety of open-source tools and
utilities, including many derived from the Free Software
Foundations's GNU family.The GNU Toolchain. A complete
suite of open-source GNU solutions. GNU compilation and
debugging tools including standard gcc g++ ANSI C and C++
compilers as well as the gas assembler for the PowerPc
family. Versions of GNAT are available from Ada Core
Exploring LynxOS
9
Technologies and g77 from LynuxWorks ftp site. Other Ada
compilers from Rational, Aonix, Irvine Compiler and DDCI
are available. Exceptions handling are managed by the
kernel. Specific High Availability Packages can be
purchased from LynusWorks, they provide enhanced
capabilities for this purpose.
Embedded success stories
For over ten years, the USPS has counted on Scio
Systems and LynxOS to efficiently sort the country's mail.
The USPS bulk mail centers (BMCs) are highly mechanized
mail processing plants that comprise the national bulk
mail system. These facilities distribute parcel post,
media mail, standard mail, and periodicals in bulk form.
Scio Systems' fixed mechanization process control system
(FMPCS) is a unique computer hardware/software system
that controls USPS sack, parcel, and large parcel sorting
machines; timeshare conveyor systems; container routing
(towline) systems; and specialized induction systems.
FMPCS computers communicate with each other over an
Ethernet local-area network using TCP/IP-based
communication protocols. Currently, 21 BMCs operate in
the United States, and each contains at least six FMPCScontrolled sorters. FMPCS also runs at 35 processing and
distribution centers, eight airport mail centers, four
international service facilities, and at the USPS
National Center for Employee Development.
ICI's military communications equipment is designed
for the United States Army and is used primarily by Army
aviation helicopters, such as Apache/Longbow, Kiowa
Warrior, cargo helicopters, and others. While the Army
and Air Force employ many different protocols to
communicate, ICI's IDM (improved data modem), a
communications and targeting system, is particularly
unique because it can interface between different
communications formats.
As a result of its collaboration with LynuxWorks and
the overwhelming success of LynxOS, ICI has shifted its
software baseline from VxWorks to LynxOS to support the
development and deployment of the Army's standard
embedded battlefield command (EBC) software for its
aviation unit. Moreover, LynxOS has become the de facto
standard for virtually all airborne Army communications
equipment interfacing with the Tactical Internet.
Conclusion
LynxOS is the superior foundation for sophisticated
real-time systems that must perform complex series of
Exploring LynxOS
10
tasks within set periods of time and support multiple
applications with multiple interrupting devices. Every OS
component within LynxOS is designed for absolute
determinism real-time. This means that they absolutely
must respond within a known period of time. This
predictable response is ensured even in the presence of
heavy I/O due to the kernel’s unique threading model,
enabling interrupt routines to be extremely short and
fast. LynxOS also exhibits true linear scalability, so
that it stays unwaveringly deterministic even as the
tasks it performs increase massively. And this
determinism extends to networking applications, which can
stay responsive even in the face of the most complex
demands.
A key enabler of LynxOS reliability is its unique
Memory Management Unit (MMU) support, residing at the
lowest level of the LynxOS kernel. Full MMU support,
provides the reliability advantages of protected memory
and the performance advantages of virtual addresses.
Hence, where other real-time operating systems rely on
unprotected tasks running in a single flat address space,
LynxOS enables each task to run protected in its own
space for uncompromising reliability. With various
advantages, LynxOS has been chosen by military and
aerospace industry, telecom industry, electronic and
entertainment industry to facilitate accomplishing
complex tasks in a timely manner.
Exploring LynxOS
11
Bibliography
Dedicated Systems Encyclopaedia. URL:
http://www.realtimeinfo.be/encyc/buyersguide/rtos/Object98.html
Hanxleden, R. V., (2001). “Real-Time Systems.” URL:
http://www.informatik.uni-kiel.de/inf/vonHanxleden/teaching/SS2001/Echtzeitsysteme/Lectures/Le
cture_23.pdf
Lynxworks. URL:
http://www.lynuxworks.com/rtos/lynxos.php3
Ripoll, I., Pisa P., Abeni L., Gai P., Lanusse A., Saez
S., Privat B., (2002). “WP1 - RTOS State of the Art
Analysis.” URL:
http://www.mnis.fr/opensource/ocera/rtos/
Download