220 likes | 257 Views
Introduction to Real-Time Operating Systems. David Burnett. Schedule . RTOS Background Designing an RTOS Designing with an RTOS Solving Problems Real-Time Products. Background: What’s a “Real Time” System?. When correctness of results depend on content and time
E N D
Introduction to Real-Time Operating Systems David Burnett
Schedule • RTOS Background • Designing an RTOS • Designing with an RTOS • Solving Problems • Real-Time Products
Background: What’s a “Real Time” System? • When correctness of results depend on content and time • Hard or Soft: indicates how forgiving the system is
What makes an OS Real-Time? • Predictable (possibly deterministic behavior), that’s all • Not necessarily fast • Byproduct: mediocre throughputs
How do they work? • Tasks are scheduled by OS according to fixed priority (typically) • Tasks can’t directly interact; they use messages or shared memory & semaphores to communicate
Designing an RTOS: Typical Features • Many POSIX Specs Exist • No virtual memory (swap file) • Shared memory capabilities • High-resolution timer(s) • Real-time signals/QoS
Designing an RTOS: End Goal • Have known switching & scheduling overhead • Avoid common problems like priority inversion and deadlock
Designing an RTOS: Common Problems • Priority inversion • High-level task stalled due to low-level using shared resources, then a medium-level task holding up the low-level one • Solution: Priority inheritance – give low-level task high-level priority • Mars Pathfinder had this problem
Designing an RTOS: Common Problems (con’t) • Deadlock • Two semaphores locked out of order by two tasks and circularly block each other • Solution: “Instant Inheritance” implementation of Priority Ceiling Protocol – semaphores possibly needed by higher processes become priority tokens
Designing with an RTOS: What do you need? • Task information • Priorities for each task • Worst-case runtime • Best-case period • Interference information • Deadline Monotonic Analysis (DMA) calculations
Designing with an RTOS:Interference via DMA • Finding maximum interference value requires several bits of information: • How often & for how long higher tasks will step in • How often & for how long lower tasks will use higher semaphores to step in • How often & for how long the OS scheduler will check on things (depends on number of tasks) • How long the task switcher takes
Designing with an RTOS:Interference via DMA(con’t) • Add everything up: acceptable? • Yes: that’s nice. • No: find a faster OS or CPU, clean your code, etc.
Solving Problems • Logs • Time Machines • Memory Conservation
Real-Time Products • VxWorks • Support for equal priority • Uses both priority-based preemption or round-robin scheduling • Basic set of task communication • No memory protection • Includes pSOS support
Real-Time Products • QNX • Small memory footprint • Uses S/R/R task messaging • Dynamically start & stop filesystems, network, serial, etc. • Bootable from ROM • VxWorks-compatible
Real-Time Products • QNX4 • Runs on x86 hardware • Support for tons of peripherals • QNX6 (aka Nucleus) • Runs on a variety of architectures, optionally without an MMU • Increasing peripheral support • Tiny memory footprint • “Photon” window manager
Real-Time Products • Linux • Is Linux • Runs on anything, even toasters • Hardware support for anything • Isn’t technically real-time, but can be
Real-Time Products • Compared to something like QNX: • Lacks easy ROM booting • Lacks driver priority control • Can emulate S/R/R message style • Patches can make kernel preemptible and improve timer resolution, so that’s nice
Real-Time Products • Lots of details about the following RTOSes available at: http://www.mnis.fr/en/support/doc/rtos/book1.html • Linux • RTLinux • RTAI • RTEMS • QNX • VxWorks • LynxOS • And that’s not all!
Conclusion • Buying an RTOS is worth it
As Always, There’s More Information Available More RTOS Details http://www.mnis.fr/en/support/doc/rtos/book1.html Embedded Design DMA Article http://www.ee.washington.edu/class/590/peckol/doc/upload/dma.pdf
Other Sources http://developers.cogentrts.com/cogent/cogentdocs/gl-defs.html http://www.wordiq.com/definition/Real-time_operating_system http://www.embedded.com/story/OEG20011016S0120 http://www.amd.com/epd/desiging/fusionpartners/prodbytype/10.operating/41.rtos http://www.acceleratedtechnology.com/embedded/nuc_rtos.html http://www.qnx.com/ http://encyclopedia.thefreedictionary.com/pSOS http://www.mapusoft.com/latest_info/Port_from_pSOS.html http://www.elecdesign.com/Articles/ArticleID/3608/3608.html http://msdn.microsoft.com/embedded/ http://www.linuxworld.com.au/index.php/id;1032707288;fp;16;fpid;0 http://www.linuxdevices.com/articles/AT7794196024.html http://www.linuxgazette.com/node/view/115 http://www.ose.com/products/product.php?product_id=10