Slashdot Mirror


RT Linux Patches

sally bitter writes "Linux 2.6 kernel Real-Time? It is going to happen soon. Montavista developers submitted patches today to LKML to begin testing all the low latency task preempt and interrupt stuffs they're introducing."

24 of 170 comments (clear)

  1. Good news, folks by drinkypoo · · Score: 3, Informative

    Combined with the ability to remove portions of the linux kernel that you aren't use, this is one more step toward world domination by Linux. Currently the same linux kernel can be used for everything from non-realtime embedded projects (typically implying a certain amount of horsepower, but these days, not an MMU!) up to NUMA-based multiprocessor workhorses. With Linux running (or capable of running) on many of the most powerful systems on the planet it is easy to forget about the other end of the spectrum which is no less important. This is a step necessary to get Linux into applications like engine management systems, besides the applications (like GPS) cited in the linked article.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    1. Re:Good news, folks by provolt · · Score: 2, Informative

      Yup. I must have entered in the HTML incorrectly when I posted originally.

      Here is the link I indended to include originally.

      Here is a recent press release about a Rockwell Collins Program that is going to use it.

      Here is a press release from when it was first announced.

    2. Re:Good news, folks by BostonPilot · · Score: 2, Informative

      Actually, I think you are a bit confused. LynxOS is NOT Linux. The company (LynuxWorks) sells two operating systems, their own hard-realtime OS (LynxOS) and also Linux. They tend to do a bait-and-switch thing: you bring them in to buy Linux and they try to talk you into using their LynxOS operating system instead. Depending on what you are doing, LynxOS can be a fine hard realtime OS. I just don't appreciate the whole bait-and-switch thing. As for DO178B, (I've worked on a DO178B avionics project) it is indeed very difficult to achieve level A certification. WindRiver's VxWorks is level A certifiable (which means if you give them a large percentage of a million dollars they will help you get your VxWorks implementation certified to level A). What you should realize about how DO-178B works for software, however, is that it is mostly about having a documented process for software development. You come up with a process, and then show through a paper trail that you have followed the process. You can sort of do it backwards by reverse-engineering the paperwork (which is what WindRiver tends to do) but that is perverting the aim - to improve software engineering quality by having and following a good process for developing software). In any case, DO-178B would be a difficult process for Linux. It's certainly not impossible, but it would be wildly expensive. DO-178B is not very compatible with a fast moving, ever changing development process. (In fact, it's pretty much designed to prevent just that!). Level-A certification is probably best left to the small dedicated RTOS market, but Level C might be possible for Linux if there was enough interest. Level D is for stuff like coffee pots and would probably be easy (but I don't remember the details for Level D, so I'm just talking out of my ass about it). The main DO-178B RTOS market is Enea's OSE (which we used), VxWorks, and now LynxOS. There are probably others that I'm not aware of, but it's a pretty small community of OSs.

  2. Re:Benefits? by CaptainFrito · · Score: 4, Informative

    There are a few non-embedded applications that would indeed benefit. Automated test and measurement is one that I can think of right off the bat. RT probably the last big advantage to VxWorks, so maybe now's a good time to dump your WindRiver stock.

  3. Re:I wonder if it's true real-time by AaronW · · Score: 2, Informative

    I hate to respond to my own post, but reading the article (what, someone rtfa) it seems that they did add priority inheritance to the kernel mutexes avoid priority inversion. For proper real-time support, hopefully they also made this available to user-space threads.

    -Aaron

    --
    This post is encrypted twice with ROT-13. Documenting or attempting to crack this encryption is illegal.
  4. Re:Does RT == Better Synch? by Anonymous Coward · · Score: 1, Informative

    Every video player out there can sync sound and video on linux. If they can do it just fine with today's kernel, why would flash be so special?

    Cleary it's sloppy programming on Macromedia's part.

  5. What Real Time is and what you can do with it. by Anonymous Coward · · Score: 5, Informative

    Real time means that processes can have an absolute time where they have to be finished. Mainly, because that means they produce output, and that output is needed THEN, not 'later'. For example, an automatic flight manager in an airplane needs his data by time to adjust in time, and needs to run at least every once and then to check if everything goes well. If the 'system' has a lot of work to do and gives the automatic-pilot-process to little time, the plane WILL hit that mountain you're heading at. RealTimeOS's account for that and make sure certain processes are excecuted more often than others since they have an higher priority.

    For the more techies: this is not like priorities in non-rt-kernels where an higher priority results in more timeslices in the round robin algorithm, it means that it isn't interrupted until it reaches a certain 'done'-state. And if a process depends on an other process (radar automatic pilot relationship-like) that process will be run prior to the automatic pilot process, to assure the automatic pilot gets new data, and no old data or old/new mixed data.

    It is a nice addition to the linux kernel. Not very usefull for the every-day-workstation, but very usefull for the portability of it. A couple of whole new markets suddenly now have the possibility of choosing for linux. (unfortunately, those markets don't just 'switch', same reason as nasa using 8086's in their spaceshuttles)

    - waccolodian.blogspot.com

  6. Re:Benefits? by mdlbear · · Score: 5, Informative

    The main beneficiary of the low-latency patches will be multimedia -- audio and video demand consistent scheduling and minimal interference from interrupts. (That's why many audio workstations are still running on Windows 98.)

  7. Re:Real time? by flok · · Score: 5, Informative

    For that, you should use NTP.

    --

    www.vanheusden.com - home of Multitail, HTTPing, CoffeeSaint, EntropyBroker, rsstail, bsod, listener, nagcon, nagi
  8. Re:Desktop Usage? by meowsqueak · · Score: 2, Informative

    Probably not - realtime operating systems are primarily for embedded systems, not desktop systems. Think 'if this task doesn't run in the next NN microseconds then [hundreds of people will die]/[millions of dollars will be lost]/[the software will crash]/[bad things will happen]/[etc]'...

  9. Re:Time to be a troll by flithm · · Score: 5, Informative

    Sorry to say but, you don't really understand the concept of real time.

    First of all, an OS being RT has nothing to do with its size. It could be 18 terabytes, or 4 kilobytes and still qualify as real time, as long as it did a few things within certain thresholds.

    To be a simplistic about it as possible, the only thing a real time operating system needs to do is to emphatically guarantee that it will respond to interrupts within a pre-determined amount of time. Even this time isn't exactly important, obviously it should be small, but as long as the time constant is known and guaranteed it qualifies as a real time operating system.

    Real time linux is NOT "a true RTOS running linux as its lowest priority thread." That doesn't even make sense! You've obviously never done any kernel programming, or bothered to do any basic knowledge gathering on operating system design at all.

    Note that several companies/vendors/instutions have provided incarnations of real time linux in the past (and currently). They do this by modifying the kernel source to make sure program ISR's get called within a set threshold. For example FSMLab's RTLinux has a worst case response rate of 12 microseconds.

    Real time operating systems are not for everyone. Your system will be slower, but will feel more responsive. Strict server operating systems such as FreeBSD, and the Windows Server class OS's have a much higher ISR response rate. Windows Server is as high as 120 ms. This is done on purpose! They do it to get every bit of performance out of the server they can. Remember, more ISR calls means more interruptions in the CPU pipeline, and more instructions executed per second. On a pentium 4 with its huge pipeline, interrupts are disasterous to execution speed.

    Personally I welcome a real time freely available linux kernel. I wouldn't mind sacrificing a little speed for real time operation. If you've ever used a real time operating system, you know what I mean. It's a great experience. But having said that, most people probably won't want that. And that's fine... but having the option is great.

    Anyway... before you spout your mouth off and try to sound like you know what you're talking about... learn something first!

  10. Re:Compare this to Ingo Molnar's 'Voluntary Preemp by B1gP4P4Smurf · · Score: 5, Informative

    This incorporates some aspects of Ingo's VP patches that are prerequisites for any kind of RT support the kernel. These include offloading all softirqs to ksoftirqd (normally softirqs run immediately unless the load gets too high in which case they hand off to koftirqd) and IRQ threading, which created a separate thread for each irq and offloads hardirqs (aka the "top half" of an interrupt handler) to that thread. If you stop here the latency is about as good as OSX.

    This is where the two approaches diverge. The VP approach uses normal kernel preemption, with the addition of scheduling points with optional lock break inside spinlocked code. But you still cannot preempt code that is holding a spinlock. This becomes the lower bound on latency.

    MontaVista goes even further, replacing spinlocks with priority inheriting mutexes, so you now can preempt code that would not be preemptible with VP.

    In practice VP gives better latency right now by about half. But as another poster pointed out this is probably due to debugging overhead and probably a few bugs, the VP approach has reached the limit while this is capable of improving worst case response times by a few more orders of magnitude. This is a great development.

  11. Re:they can dream by drinkypoo · · Score: 4, Informative

    It would allowing upgrading the OS without rebooting, guaranteed processor time, nearly instant booting, better security, better reliability, and tons more.

    The only one of those that is a requirement for calling linux a genuine realtime OS is the guaranteed scheduling. However, you can already replace the kernel in memory with another kernel, linux has security models in the kernel these days, the boot time is pretty much dependent only on hardware initialization... If linux can get the scheduling to something people are willing to call realtime, that's pretty much the only thing missing.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  12. Re:gethrtime() ? by David+M.+Andersen · · Score: 2, Informative

    Looks like it.

    This function is a non-portable RTLinux extension. gethrtime returns the time in nanoseconds since the system bootup. This time is never reset or adjusted. gethrtime always gives monotonically increasing values. hrtime_t is a 64-bit signed integer.

    The actual resolution of gethrtime is hardware-dependent. It is guaranteed to be better than 1 microsecond.

    Odd that RT Linux is the first hit in google actually.

  13. Soft real-time Vs Hard real-time by WillerZ · · Score: 5, Informative

    There are two types of real-time, soft and hard. This is how you distinguish the two:

    Hard real-time says "Do this within the next ## seconds or you might as well not bother as we'll all be dead". Soft real-time says "Do this within the next ## milliseconds if you can, otherwise the sound on the DVD playback might skip".

    The parent is talking about hard real-time scheduling, which is what these patches help with. Hard real-time has sharp deadlines, enormous penalties for missing a deadline, and (relatively) long periods between deadlines. Of course, there are short-deadline hard real-time systems, like ABS controllers in cars; however these tasks will usually be handled by dedicated hardware.

    Soft real-time is a more interesting topic for desktop Linux, because you aren't usually in a situation where your desktop machine can kill you by inaction. Soft real-time has fuzzy deadlines, small or no penalties for missing deadlines, and (relatively) short periods between deadlines. DVD playback is a good example: if a frame is delayed by a small amount or even skipped entirely the viewer is unlikely to notice provided it doesn't happen too often. Same for games.

    Phil

    --
    I guess today is a passable day to die.
  14. Real-time support for 2.6 by jd · · Score: 5, Informative
    I believe RTAI were the first to produce real-time support for 2.6. Last time I looked, there was some problem with using preempt with RTAI, and it didn't like module versioning. These may have been fixed by now, though.


    Timesys were next. I used Timesys at the last place I worked - it's good, but it's also inconvenient. They only seem to provide pre-patched kernels, and there's quite a bit of support stuff that's not GPL.


    RT-Linux uses a similar technique to RTAI, to achieve real-time. There is a questionable software patent on the precise technique they use, which is (in theory) to prevent non-FOSS companies from obstructing real-time Linux work. It's unclear as to whether the patent could be used by hostile companies as "proof" of the IP "dangers" of Linux and FOSS in general, but there's always that risk. The problem with minefields is that they don't care who steps in them.


    For those using older kernels, and only requiring "soft" real-time, then the real-time scheduler patch on Sourceforge might be sufficient.


    That brings me to my other point. "Real-time" is a gradation, not a binary state. True "hard" real-time is extremely difficult to achieve, as it must be impossible to block any kernel thread or any interrupt. Your clock device also needs to be stable. The more exacting your requirements, the less you can afford to have even the smallest amount of drift.


    The 2.6 preempt work, from what I understand, covers the bulk of the kernel but is not absolute. In other words, some things are simply going to block, like it or not, and that in turn means that you cannot absolutely guarantee a process a controlled time-slice.


    For most real-time stuff (eg: basic multimedia stuff, etc) you don't need anything like as fancy as "hard" real-time. You simply aren't going to notice if a DVD is skewed by a couple of milliseconds - or even a couple of seconds - over a playing time of maybe 1-3 hours.


    For that kind of stuff, "soft" real-time is certainly adequate. It smoothes things out to the level any person is likely to care about, but doesn't go much further.


    Now, if you're in charge of a nuclear reactor or are designing the fly-by-wire systems for a Mach 10 aircraft, then any blocking is probably going to be unacceptable. (On the other hand, if you're in charge of a system like that, what are you doing reading Slashdot? Hey, what's that blinking red light, over your left shoulder? Uh-oh...)


    There are patches for Linux, which give it nanosecond granularity. I don't know of any real-time patches which can make use of this level of precision, but there may well be projects where you really do require accuracy at that level. (Again, though, DVD playing is probably not one of them.)


    It's great to see RT-Linux enter the 2.6 series, but it really isn't the first. That should not detract from users, though, because (frankly) who cares? If you're an admin or a user, you're concerned with whether it works, and the RT-Linux folks certainly know what they're doing.


    Linux is progressing nicely in many of the top areas of high-end computing. Clustering, real-time, pre-empt, journalling filesystems, high availability, distributed shared memory, LVM, gigabit and ten gigabit ethernet, network QoS, nanosecond precision, etc. On the other hand, M:N threads seem to be dead, OpenMP is restricted to commercial software for Linux and many of those areas which are, in some way, being developed are disjoint and don't always work well together.


    In other words, there is (as always) room for improvement, but what there is is certainly extremely impressive. Linux is rapidly developing a solid reputation in the high-end markets, and deservedly so. I look forward to seeing what happens next.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  15. Re:they can dream by Anonymous Coward · · Score: 3, Informative
    To be an rtos you usually start with a microkernel

    No, you don't. In recent time that's been true, but that's generally because the big RTOSs are often used in by vendors who need five nines of availability as well. An air traffic management application not only has scheduling requirements, but it simply cannot crash either, and a microkernel is one design to help pursue that.

    A microkernel is not required. In some senses old time sharing systems were RTOSs because they guarenteed whoever paid X amount of money got Y amount of processor, throughput, etc. Those certainly weren't microkernels.

    I always worried that my filesystem may get starved by an aggresive real time process in an microkernel based RTOS, but in my experience that's never been an issue. I should look up some research on that one of these days.

    A popular RTOS that can be consumed by the masses would be nice.

    Define masses? For almost all definitions of that term QNX's desktop version (free as in beer) seems to fit the bill. For most others TRON (or is that Tron?) seems to be what you're after. Are there any "masses" that these two OS's don't meet?

    It would allowing upgrading the OS without rebooting, guaranteed processor time, nearly instant booting, better security, better reliability

    I think you're talking about a microkernel there, except for the guaranteed proc time. Everything else is one of the (debateable) advantages of the microkernel design.

    All the patches appear to do is attempt to get linux to pre-emtively multitask correctly.

    Actually, it's talking about kernel preemption, which isn't exactly pre-emptive multitasking in the usual sense of the term. When that audio demuxers says "give me the processor!" in an RTOS, then it gets the processor, even if it has to preempt the kernel.

    At heart RT is a schduling thing, mainly the processor scheduler. As the RT concept has matured, there has been a desire from ISV to see RT style scheduling of disk accesses, of bandwidth allocation, yadda yadda. These aren't needed to be a RTOS strictly speaking, but they are needed to be competitive. There have existed patches to make Linux a true, hard, RT kernel for quite a while, or to have "soft" RT as well. So, Linux being (at least, being capable of being) a RTOS is in some senses old news.

  16. Re:Compare this to Ingo Molnar's 'Voluntary Preemp by B1gP4P4Smurf · · Score: 3, Informative

    Does OSX have this latency because of its semi-microkernel nature? Otherwise, what is it about OSX that makes it have relatively low latency?

    From reading the I/O Kit docs (the driver writers guide for OSX, google for it) it looks like OSX does it the same way as Linux with Ingo's patches, they have a preemptible kernel and a realtime scheduling class for multimedia apps, and IRQs appear to be threaded, though the exact mechanism is unclear. The Mach ancestry helps in other areas, Mach ports on OSX are allegedly are a faster IPC mechanism than even Linux FIFOs.

  17. Re:What is Real Time exactly? by 0x0d0a · · Score: 4, Informative

    Real time refers to a system where tasks completing by a certain deadline is more important than just about anything else. Real time systems are less efficient than non-real-time systems -- they trade efficient scheduling for bounded scheduling.

    This is generally split into hard real time and soft real time.

    In a hard real time system, if a task misses a deadline, the task has failed. You might as well not do it. This sort of thing is important for, say, control systems that determine what thrusters to fire when on the Space Shuttle.

    In a soft real time system, you have some penality if a task isn't finished by a certain time.

    One kind of real-time functionality that a system might provide (and Linux does and has for a while) is a "real time priority level". To simplify things a bit, when a process is marked as "real time", that process runs and every other process is ignored. This is important if that process has a task that *must* complete. As a negative side effect, it means that another task (which might only want a tiny bit of CPU time, just enough to keep copying a file from disk to disk) can't run at all and all the disk activity stops. As a result, the time required for all the work the system must do increases, and the system runs more slowly. However, the one process that *must* gets time continues to get it.

    It's not something that a desktop or server user is going to benefit much from.

  18. Re:Benefits? by Samedi1971 · · Score: 4, Informative

    Commercial flight simulation.

    I work with quite a few (11) FAA level D flight simulators running linux with realtime patches. Realtime ability is a must in flight sims because glitches and slowdowns are not tolerated. A realtime or at least psuedo-realtime OS allows us to guarantee that the simulation processes will always have priority over non-essential tasks (even OS tasks that aren't necessary to the simulation).

  19. Re:What is Real Time exactly? by nathanh · · Score: 2, Informative
    Can this be run on my Pentium4? What is it?

    Real Time means that you can write a program that is guaranteed to get say 100 CPU cycles every second, without fail, no exceptions. You usually need Real Time OSs when you're writing things like factory robot controllers and other cool stuff like that.

    The downside of Real Time is that it can make the system less efficient overall (more time is spent idling the CPU while waiting for a realtime deadline). So for a desktop or a server, there usually isn't any need. For people building Tivos and high-end audio workstations, it might have more value.

    But it's not a simple checkbox. The software has to be written to use the realtime features. Think of this as an incredibly cool thing for the embedded Linux developers but absolutely nothing that you or I need to worry about. It's newsworthy because this is Linux encroaching on a lucrative market once dominated by QNX and VxWorks. Linux is well on track for World Domination in 2005! 8-)

  20. RTLinux vs RT Linux confusion by Voivod · · Score: 3, Informative

    I wish they'd use a different name for this. The product "RTLinux" already exists, and it's not related at all to what Montevista is doing. It's the microkernel based "run Linux as a thread" approach taken by Victor Yodaiken at FSMLabs. According to this article it was first released in 1995, predating the existence RTAI and Montavista by many years.

  21. Re:I wonder if it's true real-time by Samrobb · · Score: 3, Informative

    Not to be rude - but I'm pretty sure you're mistaken. I've been a developer at TimeSys for several years, and I've never heard anything of the sort mentioned by anyone here. Searching LKML via Google, I can't find anything that accuses TimeSys of violating the GPL, or anything remotetly simiilar to that.

    If you have something specific you want to point out, please do so.

    --
    "Great men are not always wise: neither do the aged understand judgement." Job 32:9
  22. Re:I wonder if it's true real-time by B1gP4P4Smurf · · Score: 2, Informative

    Be aware that there has been some question weather or not Timesys is violoating the GPL. I don't have the links on me but if you search the LKML for "Timesys" you will find at least a couple of messages questioning their proprietary scheduler work.

    This is BS. The Timesys people have posted lots of quality GPL'ed code to LKML. They have never been accused of violating the GPL by anyone credible.

    Troll.