📄 tutorial.htm
字号:
<html><head><title>REAL-TIME LINUX TUTORIAL</title><link rel="stylesheet" type="text/css" href="style.css"></head><body><a href="./tutorial.htm#index">[index]</a><a href="./basics.htm">[next]</a><h1>Real-Time Linux Introduction</h1><ul><li>Linux is a free Unix-like operating system that runs on a varietyof platforms, including PCs. Numerous Linux distributions such asRed Hat, Debian and Mandrake bundle the Linux OS with tools, productivitysoftware, games, etc.<li>The Linux scheduler, like that of other OSes such as Windows or MacOS, isdesigned for best average response, so it feels fast and interactiveeven when running many programs.<ul><li>However, it doesn't guarantee that any particular task will alwaysrun by a given deadline. A task may be suspended for an arbitrarilylong time, for example while a Linux device driver services a diskinterrupt.<li>Scheduling guarantees are offered by real-time operatingsystems (RTOSes), such as QNX, LynxOS or VxWorks. RTOSes are typicallyused for control or communications applications, not general purposecomputing.</ul><li>Linux has been adapted for real-time support. These adaptationsare termed "Real-Time Linux" (RT Linux).<li>Numerous versions of RT Linux are available, free or commercial.Two commonly available free RT Linux versions are <ul><li>theReal-Time Application Interface (RTAI), developedby the Milan Polytechnical University and available at <ahref="http://www.aero.polimi.it/~rtai/">www.aero.polimi.it/~rtai/</a><li>RTL, developed by New Mexico Tech and now maintained by FSM Labs,Inc., with a free version available at <ahref="http://www.rtlinux.org">www.rtlinux.org</a>.</ul><li>These RT Linux systems are patches to the basic Linux kernelsource code. Instructions for building an RT Linux system from athe Linux source code are provided with these RT Linuxsystems. Briefly the process involves setting up the basic Linuxsystem, getting the latest Linux kernel source code from <a href="http://www.kernel.org">www.kernel.org</a>,patching the kernel source code, and compiling the patchedkernel. More information on RT Linux in general is provided in <ahref="./references.htm#AEO">[AEO].</a><li>See <ahref="http://www.isd.mel.nist.gov/projects/rtlinux">www.isd.mel.nist.gov/projects/rtlinux</a>for more information.<p></ul><h2><a name="index">This Real-Time Linux Tutorial</a></h2>This tutorial is composed of examples that begin with the simpleexection of a fixed-period task, and introduces other topics such asmultiple tasks of varying periods and priorities, interrupt serviceroutines, and communication and synchronization with non-realtimeprocesses. The source code is highly commented when new concepts areintroduced. <p>Examples are located in subdirectories, and the tutorial will proceedwith these: <ul><li><a href="./basics.htm">The Basics</a> -- what RT Linux is, how to set up andcompile real time programs<li><a href="./ex01_periodic.htm">A Single Periodic Task</a> -- demonstrates a single fixed-period task that togglesthe speaker at 1 kHz, also demonstrating how to read and write I/Oaddresses <li><a href="./ex02_twoper.htm">Two Periodic Tasks</a> -- demonstrates two fixed-period tasks, one that togglesthe speaker at between 100 Hz and 10 kHz and another that sets thefrequency each second. The role of priorities is described.<li><a href="./ex03_variable.htm">A Variable-Period Task</a> -- demonstrates a single variable-period task thatsmoothly changes the speaker frequency between 1 kHz and 10 kHz. Thedifferences between periodic and variable execution are described.<li><a href="./ex04_fifo.htm">FIFO Communication</a> -- demonstrates the use of first-in, first-out queues(FIFOs) to exchange data with a regular Linux process. The user entersa frequency and the RT task acknowledges, then toggles the speaker atthat frequency.<li><a href="./ex05_isr.htm">Interrupt Service Routines</a> -- demonstrates an interrupt service routine (ISR). The ISRis attached to the parallel port interrupt, and increments and writesa number to a FIFO each time the interrupt is triggered.<li><a href="./ex06_shm.htm">Shared Memory Communication</a> -- demonstrates shared memory communication between an RT taskand a user-level Linux process. <li><a href="./ex07_sem.htm">Semaphores</a> -- demonstrates how to use semaphores to ensure consistentaccess to shared data structures.<li><a href="./ex08_rcservo.htm">RC Airplane Servomotor Control</a> -- demonstrates the control of two RC airplane servo motors using two variable-period tasks. Through a FIFO a user process can setthe position and speed of each motor indepedently.<li><a href="./ex09_ledclock.htm">LED Wand Clock</a> -- demonstrates an LED wand clock using many of the conceptspreviously introduced: two tasks, an ISR, and FIFOs.<li><a href="./ex10_stack.htm">Determining Stack Size</a> -- demonstrates how to estimate the stack size for a task.<li><a href="./ex11_jitter.htm">Measuring Timing Jitter</a> -- demonstrates how to read the Pentium time stamp counterand measure the timing jitter for a periodic task. <li><a href="./ex12_math.htm">Floating Point in RT Tasks</a> --demonstrates how to use floating point in real-time tasks and ensurethat the floating point unit context is saved and restored</ul>Supplementary Material:<ul><li><a href="./mutex.htm">Data Consistency Techniques</a> -- describes howto prevent shared data from being corrupted by simultaneouslyexecuting processes<li><a href="./ack.htm">Acknowledgements</a><li><a href="./references.htm">References</a></ul>To build the tutorial, do the following in the top-level directory:<pre>./configuremakemake install</pre>To run the examples, change into the appropriate subdirectory andexecute the 'run' script, e.g., <pre>cd ex01_periodic./run</pre><hr>No approval or endorsement of any commercial product by the NationalInstitute of Standards and Technology is intended or implied. Certaincommercial equipment, instruments, or materials are identified in thisreport in order to facilitate understanding. Such identification doesnot imply recommendation or endorsement by the National Institute ofStandards and Technology, nor does it imply that the materials orequipment identified are necessarily the best available for thepurpose.<p>This publication was prepared by United States Government employees aspart of their official duties and is, therefore, a work of theU.S. Government and not subject to copyright.<p>Contact:<p>Fred Proctor<br>Group Leader, Control Systems Group<br>National Institute of Standards and Technology<br>100 Bureau Drive, Stop 8230<br>Gaithersburg, MD 20899-8230<br>frederick.proctor@nist.gov<hr><a href="./basics.htm">Next: The Basics of Real-Time Linux</a><p><center>Last modified: 11-Jan-2006</center></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -