Presentation RT Linux

download Presentation RT Linux

of 44

Transcript of Presentation RT Linux

  • 7/31/2019 Presentation RT Linux

    1/44

    RTLinuxand embedded programming

    Victor Yodaiken

    Finite State Machine Labs (FSM)

    RTLinux p.1/3

  • 7/31/2019 Presentation RT Linux

    2/44

    Outline.The usual: definitions of realtime.

    RTLinux p.2/3

  • 7/31/2019 Presentation RT Linux

    3/44

    Outline.The usual: definitions of realtime.

    Who needs realtime?

    RTLinux p.2/3

  • 7/31/2019 Presentation RT Linux

    4/44

    Outline.The usual: definitions of realtime.

    Who needs realtime?

    How RTLinux works.

    RTLinux p.2/3

  • 7/31/2019 Presentation RT Linux

    5/44

    Outline.The usual: definitions of realtime.

    Who needs realtime?

    How RTLinux works.

    Why RTLinux works that way.

    RTLinux p.2/3

  • 7/31/2019 Presentation RT Linux

    6/44

    Realtime versus Time Shared

    Time sharing software: switch between

    different tasks fast enough to create theillusion that all are going forward at once.

    RTLinux p.3/3

  • 7/31/2019 Presentation RT Linux

    7/44

    Realtime versus Time Shared

    Time sharing software: switch between

    different tasks fast enough to create theillusion that all are going forward at once.

    Realtime software: switch between differenttasks in time to meet deadlines.RTLinux p.3/3

  • 7/31/2019 Presentation RT Linux

    8/44

    Hard realtime1. Predictable performanceat each moment in

    time: not as an average.2. Low latencyresponse to events.

    3. Precise schedulingof periodic tasks.

    RTLinux p.4/3

  • 7/31/2019 Presentation RT Linux

    9/44

    Soft realtimeGood average case performance

    Low deviation from average caseperformance

    RTLinux p.5/3

  • 7/31/2019 Presentation RT Linux

    10/44

    Traditional problems with soft

    realtimeThe chips are usuallyplaced on the solder

    dots.

    RTLinux p.6/3

  • 7/31/2019 Presentation RT Linux

    11/44

    Traditional problems with soft

    realtimeThe chips are usuallyplaced on the solder

    dots.The machine tool generallystops the cut asspecified.

    RTLinux p.6/3

  • 7/31/2019 Presentation RT Linux

    12/44

    Traditional problems with soft

    realtimeThe chips are usuallyplaced on the solder

    dots.The machine tool generallystops the cut asspecified.

    The power almost alwaysshuts off before theturbine explodes.

    RTLinux p.6/3

  • 7/31/2019 Presentation RT Linux

    13/44

    New problems with soft realtimeThe voice-over-IP system only loses packets

    under stress.

    RTLinux p.7/3

  • 7/31/2019 Presentation RT Linux

    14/44

    New problems with soft realtimeThe voice-over-IP system only loses packets

    under stress.The cell-phone connect wont drop yourInternet handset during a handoff unless

    there is heavy traffic.

    RTLinux p.7/3

  • 7/31/2019 Presentation RT Linux

    15/44

    New problems with soft realtimeThe voice-over-IP system only loses packets

    under stress.The cell-phone connect wont drop yourInternet handset during a handoff unless

    there is heavy traffic.

    If you start a browser on one machine, mostof the timesales transactions wont get loston the other side of your SOHO router.

    RTLinux p.7/3

  • 7/31/2019 Presentation RT Linux

    16/44

    You dont really need hard

    realtimeWe have one failure every 100 hours of

    operation on the average, but somecustomers experience 5 failures in an hour.

    RTLinux p.8/3

  • 7/31/2019 Presentation RT Linux

    17/44

    You dont really need hard

    realtimeWe have one failure every 100 hours of

    operation on the average, but somecustomers experience 5 failures in an hour.

    Tell em to stop being such whiners.

    RTLinux p.8/3

  • 7/31/2019 Presentation RT Linux

    18/44

    You dont really need hard

    realtimeWe have one failure every 100 hours of

    operation on the average, but somecustomers experience 5 failures in an hour.

    Tell em to stop being such whiners.

    Poor performance? More memory and afaster processor!

    RTLinux p.8/3

  • 7/31/2019 Presentation RT Linux

    19/44

    You dont really need hard

    realtimeWe have one failure every 100 hours of

    operation on the average, but somecustomers experience 5 failures in an hour.

    Tell em to stop being such whiners.

    Poor performance? More memory and afaster processor!

    Whats wrong with quad Itaniums, 8 Gig ofmemory, and a liquid cooling system on a$100 SOHO router?

    RTLinux p.8/3

  • 7/31/2019 Presentation RT Linux

    20/44

    Hard realtime is needed1. If "rare" timing failures are serious.

    2. If precise timing makes a process possible.

    3. If precise timing makes a performanceadvantage.

    RTLinux p.9/3

  • 7/31/2019 Presentation RT Linux

    21/44

    Timing1. A 30 microsecond delay can drop 20 Gig

    Ethernet packets.2. 10 70hz video streams need packets

    unloaded at millisecond rates.

    3. Time for 1 degree error on manipulator: 10microseconds.

    RTLinux p.10/3

  • 7/31/2019 Presentation RT Linux

    22/44

    Low end examples.1. Replace a digital joystick with an analog

    joystick and a sound card.2. Reduce control loop times by sampling A/D at

    100 microseconds.

    3. Log data over the network using Linux utilitieswith no software development costs.

    4. Use Apache standard web server as a controlinterface with no software developmentcosts.

    RTLinux p.11/3

  • 7/31/2019 Presentation RT Linux

    23/44

    Larger examples.Multiple software "Virtual routers" operating

    on packets in realtime.Interactive robot control with non-RTgraphical interface.

    RTLinux p.12/3

  • 7/31/2019 Presentation RT Linux

    24/44

    The RTLinux operating system

    A small hard realtime operating system that runs

    Linux (or BSD) as its lowest priority task. Usedfor everything from making chain-saw chains, toswitching packets to animating movies.

    RTLinux p.13/3

  • 7/31/2019 Presentation RT Linux

    25/44

    One view of RTLinux

    RTLinux p.14/3

  • 7/31/2019 Presentation RT Linux

    26/44

    Another view of RTLinux

    RTLinux p.15/3

  • 7/31/2019 Presentation RT Linux

    27/44

    RTLinux is decoupled from Linux

    RTLinux schedules itself Linux scheduler is

    not involved.Linux cannot delay or interrupt execution ofRTLinux

    RTLinux p.16/3

  • 7/31/2019 Presentation RT Linux

    28/44

    Results1. Example on AMD SC520 133Mhz.

    Low latencyresponse to events.15microseconds or less.

    Precise schedulingof periodic tasks. 20

    microseconds or less error.2. On a standard PC: 19 microseconds and 50

    microseconds

    3. On SOCs we are in the single digits

    RTLinux p.17/3

  • 7/31/2019 Presentation RT Linux

    29/44

    Programming model

    1. For Realtime tasks and event handlers:

    POSIX Pthreads.2. For Linux processes connection via POSIX

    I/O, shared memory, and signals.

    As standard as possible with no efficiency loss.

    RTLinux p.18/3

  • 7/31/2019 Presentation RT Linux

    30/44

    Programming view

    1. The hard realtime component of realtime

    applications should run in a simple, minimal,predictable environment.

    2. The non-realtime components should run in

    UNIX until something better is invented.3. Hard realtime and non-realtime should be

    decoupled in operation.

    RTLinux p.19/3

  • 7/31/2019 Presentation RT Linux

    31/44

    Programming interface

    1. "Lean" POSIX threads for RT components,

    standard POSIX for non-RT components.2. RTLinux can support alternate APIs.

    3. API is programmer convenience: nottechnology fundamental.

    RTLinux p.20/3

  • 7/31/2019 Presentation RT Linux

    32/44

    A typical simple application

    RTLinux p.21/3

    The simplest user side data

  • 7/31/2019 Presentation RT Linux

    33/44

    The simplest user side datalogging program

    cat < /dev/rtf0 > logfile

    RTLinux p.22/3

  • 7/31/2019 Presentation RT Linux

    34/44

    How to use RTLinux

    RTLinux p.23/3

  • 7/31/2019 Presentation RT Linux

    35/44

    Where is it used?1. Communications: PBXs, routers, ...

    2. Factory automation: machine tools,production lines.

    3. Robotics: stepper motors, A/D, ...

    4. Multimedia: animations, ...

    RTLinux p.24/3

  • 7/31/2019 Presentation RT Linux

    36/44

    RTLinux Version 3.01. V1 was a research project.

    2. V2 was the first production version.3. V3 is the first industrial strength version. x86,

    Alpha, PPC, MIPS, smp support, ...

    4. V4 on the way.

    RTLinux p.25/3

    But why not integrate RT into

  • 7/31/2019 Presentation RT Linux

    37/44

    But why not integrate RT into

    Linux?Experience shows: performance limits and

    engineering costs.

    RTLinux p.26/3

  • 7/31/2019 Presentation RT Linux

    38/44

    Why is decoupling so important?

    1. Mars Lander almost broke because a low

    priority non-realtime process was able to locka resource needed by a critical realtime task.The lock was hidden in complex code shared

    by all tasks, realtime and non-realtime.2. RTLinux makes all interactions between RT

    and non-RT explicit and transparent.

    RTLinux p.27/3

  • 7/31/2019 Presentation RT Linux

    39/44

    The RTLinux technical synergy.

    1. Highly efficient realtime.

    2. Connected to a reliable and powerfulnetworked operating system (Linux).

    3. Running on standard PCs, servers, andembedded hardware.

    RTLinux p.28/3

  • 7/31/2019 Presentation RT Linux

    40/44

    The RTLinux cost advantage.

    1. The costs of maintaining general purpose

    software data bases, networks, graphics,development, ... are shared with server anddesktop companies.

    2. Prototype on PCs.3. Access to source is essential for important

    applications.

    RTLinux p.29/3

  • 7/31/2019 Presentation RT Linux

    41/44

    Coming in V4

    1. RT networking. (for industrial control and

    comms).2. User mode RTLinux functions.

    3. Failover technologies.

    4. Optimizations.

    RTLinux p.30/3

  • 7/31/2019 Presentation RT Linux

    42/44

    Finite State Machine Labs1. Core kernel development and GPL and

    non-GPL RTLinux distributions.2. Training, engineering services and product

    support.

    3. Application software in communications andfactory automation.

    RTLinux p.31/3

  • 7/31/2019 Presentation RT Linux

    43/44

    Why non-GPL development

    1. Some of our customers need it: niche

    products or close hardware/softwareinteraction is common in embedded.

    2. We need it: we cannot pay for development

    on contract services.3. Our non-GPL is source to customers, but no

    rights to remarket our code.

    RTLinux p.32/3

  • 7/31/2019 Presentation RT Linux

    44/44

    w.fsmlabs.com@

    www.rtlinux.com

    RTLinux p.33/3