Real-Time, Safe and Certified OS

Real-Time, Safe and Certified OS

<p><strong>Real-Time, Safe and Certified OS </strong></p><p>Roman Kapl &lt;[email protected]&gt; drivers, customer projects, development <br>Tomas Martinec &lt;[email protected]&gt; testing and certification </p><p></p><ul style="display: flex;"><li style="flex:1">1</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Introduction </strong></p><p>• <strong>PikeOS – real-time, safety certified OS </strong>• <strong>Desktop and Server vs. </strong></p><p>• Embedded • Real-Time • Safety-Critical • Certified </p><p>• <strong>Differences </strong></p><p>• Scheduling • Resource management • Features • Development </p><p></p><ul style="display: flex;"><li style="flex:1">2</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Certification </strong></p><p>• <strong>Testing </strong>• <strong>Analysis </strong>• <strong>Lot of time </strong>• <strong>Even more paper </strong>• <strong>Required for safety-critical systems </strong></p><p>• Trains • Airplanes </p><p></p><ul style="display: flex;"><li style="flex:1">3</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>PikeOS </strong></p><p>• <strong>Embedded, real-time, certified OS </strong>• <strong>~150 people (not just engineers) </strong>• <strong>Rail </strong>• <strong>Avionics </strong>• <strong>Space </strong>• <strong>This presentation is not about PikeOS specifically </strong></p><p></p><ul style="display: flex;"><li style="flex:1">4</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>PikeOS technical </strong></p><p>• <strong>Microkernel </strong></p><p>• Inspired by L4 </p><p>• <strong>Memory protection (MMU) </strong></p><p>• More complex than FreeRTOS  </p><p>• <strong>Virtualization hypervisor </strong>• <strong>X86, ARM, SPARC, PowerPC </strong>• <strong>Eclipse IDE for development </strong></p><p></p><ul style="display: flex;"><li style="flex:1">5</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Personalities </strong></p><p>• <strong>General </strong></p><p>• POSIX • Linux </p><p>• <strong>Domain specific </strong></p><p>• ARINC653 • PikeOS native </p><p>• <strong>Other </strong></p><p>• Ada, RT JAVA, AUTOSAR, ITRON, RTEMS </p><p></p><ul style="display: flex;"><li style="flex:1">6</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>PikeOS Architecture </strong></p><p><strong>App. App. </strong><br><strong>App. App. </strong><br><strong>App. App. </strong></p><p><strong>Volume </strong></p><p><strong>System </strong></p><p><strong>Provider </strong></p><p><strong>Partition </strong></p><p><strong>PikeOS </strong><br><strong>(Native, POSIX, ARINC653, ...) </strong><br><strong>HW Virtualized </strong><br><strong>Guest OS </strong><br><strong>Linux, Android </strong><br><strong>Para-Virtualized </strong><br><strong>Guest OS </strong><br><strong>Linux, Android </strong></p><p><strong>File System </strong></p><p><strong>PikeOS Native </strong></p><p><strong>Device Driver </strong></p><p>User Space / <br>Partitions </p><p><strong>System </strong><br><strong>System </strong><br><strong>Extension </strong><br><strong>Extension </strong></p><p><strong>PikeOS SystemSoftware </strong></p><p><strong>PikeOS Microkernel </strong></p><p>Kernel Space / <br>Hypervisor </p><p><strong>Architecture </strong></p><p>Support Package </p><p><strong>Platform </strong></p><p>Support Package </p><p><strong>Kernel Level </strong><br><strong>Driver </strong></p><p></p><ul style="display: flex;"><li style="flex:1"><strong>CPU1 </strong></li><li style="flex:1"><strong>Serial </strong></li><li style="flex:1"><strong>CAN </strong></li><li style="flex:1"><strong>Ethernet </strong></li><li style="flex:1"><strong>Graphics </strong></li></ul><p><strong>... </strong></p><p>SoC / <br>Custom Hardware </p><p><strong>Hardware </strong></p><p></p><ul style="display: flex;"><li style="flex:1">7</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Embedded </strong></p><p>• <strong>Examples </strong></p><p>• Tamagochi • Rail signal • ABS brake controller </p><p>• <strong>Usually does not have </strong></p><p>• Lots of RAM • Beefy CPU • Keyboard and mouse • PC Case • Monitor </p><p></p><ul style="display: flex;"><li style="flex:1">8</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Embedded peripherals </strong></p><p>• <strong>Ethernet </strong></p><p>• Sometimes with hardened connectors • May be real-time </p><p>• <strong>CAN </strong>• <strong>I2C </strong>• <strong>UART (Serial port) </strong>• <strong>JTAG for debugging </strong></p><p></p><ul style="display: flex;"><li style="flex:1">9</li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Safety </strong></p><p>• <strong>System does not harm the environment </strong></p><p>• Safe aircraft does not harm or kill people during the flight </p><p>• <strong>≠ flawless </strong></p><p>• Safe backup <br>• Airbus A340 rudder can still be controlled mechanically <br>• Safe failure-mode <br>• “Closed” rail signal is safe <br>• Harmless <br>• In-flight entertainment </p><p></p><ul style="display: flex;"><li style="flex:1">10 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Safety </strong></p><p>• <strong>≠ security </strong></p><p>• but there are overlaps </p><p>• <strong>Safety needs to be certified </strong>• <strong>More important than features or performance </strong></p><p></p><ul style="display: flex;"><li style="flex:1">11 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Hard-realtime </strong></p><p>• <strong>Must meet deadlines </strong></p><p>• Missed deadline can affect safety </p><p>• <strong>Deadlines given by </strong></p><p>• Physics </p><p>• Car must start breaking immediately </p><p>• Hardware </p><p>• Serial port buffer size – data loss </p><p>• System design </p><p>• <strong>HW and SW must cooperate </strong></p><p></p><ul style="display: flex;"><li style="flex:1">12 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Real-Time Scheduling </strong></p><p>• <strong>Lot of theory about running the tasks in correct order </strong></p><p>• NSWE001- Embedded and Real Time Systems </p><p>• <strong>In practice simple thread priorities </strong></p><p>• QNX, FreeRTOS, PikeOS, VxWorks … </p><p>• <strong>Often without time quantum </strong></p><p>• Unlike Linux </p><p></p><ul style="display: flex;"><li style="flex:1">13 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>WCET </strong></p><p>• <strong>=Worst-Case Execution Time </strong>• <strong>How long will the code run? </strong></p><p>• Willwe satisfy the deadline? • Upper bound (worst-case) is important </p><p>• <strong>Combination of code analysis and measurement </strong>• <strong>Jitter </strong></p><p>• Context switches • Interrupt duration • Interrupt latencies </p><p></p><ul style="display: flex;"><li style="flex:1">14 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Enemies of Real-Time </strong></p><p>• <strong>Shared resources </strong></p><p>• Heap, devices, scheduler, CPU time • Unpredictable state • Locking </p><p>• <strong>Multi-processor </strong></p><p>• Locking less predictable • Shared <br>• Cache • Memory bandwidth • Other processor units? </p><p></p><ul style="display: flex;"><li style="flex:1">15 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>More enemies </strong></p><p>• <strong>Modern hardware </strong></p><p>• Lazy algorithms • Branch predictors • Out-of-order execution <br>• Unpredictable pipeline <br>• TLB, caches </p><p>• <strong>Modern OS features </strong></p><p>• Paging, overcommit • Copy on Write • Thread migration </p><p>• <strong>Complexity in general </strong></p><p></p><ul style="display: flex;"><li style="flex:1">16 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Memory Management </strong></p><p>• <strong>Sometimes no MMU at all </strong></p><p>• FreeRTOS, some VxWorks </p><p>• <strong>Simple virtual to physical mapping </strong></p><p>X Paging, memory mapped files, copy on write …  Shared memory  Memory protection (NX bit etc.) </p><p>• <strong>No (ab-)use of free memory for buffers </strong></p><p></p><ul style="display: flex;"><li style="flex:1">17 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>PikeOS Kernel Memory </strong></p><p>• <strong>User-space needs kernel memory </strong></p><p>• Threads • Processes • Memory mappings </p><p>• <strong>Pre-allocated pools </strong></p><p>• Safe limit • Avoids extra locks </p><p></p><ul style="display: flex;"><li style="flex:1">18 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>User-space memory allocation </strong></p><p>• <strong>Heap allocator problems </strong></p><p>• Locking • Allocator latency • Fragmentation • Unpredictable failures </p><p>• <strong>General rule: avoid malloc/free </strong></p><p>• Except for initialization • Pre-allocate everything • Malloc/free is error prone anyway </p><p>• <strong>Or use task-specific allocator </strong></p><p></p><ul style="display: flex;"><li style="flex:1">19 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Scheduling </strong></p><p>• <strong>ARINC653 (avionics standard) is common </strong></p><p>• Time partitions + priorities </p><p></p><ul style="display: flex;"><li style="flex:1">0ms 20ms 40ms </li><li style="flex:1">70ms 90ms </li><li style="flex:1">150ms </li></ul><p></p><p>Active TP Scheme </p><p></p><ul style="display: flex;"><li style="flex:1">1</li><li style="flex:1">2</li><li style="flex:1">1</li><li style="flex:1">3</li><li style="flex:1">4</li></ul><p></p><p><strong>Time Partition N </strong></p><p>255 </p><p><strong>Time Partition 2 </strong></p><p>TP <br>Scheduler </p><p><strong>Time Partition 1 </strong><br><strong>Time Partition 0 </strong></p><p>... </p><p>Prio 255 <br>254 <br>254 </p><p>... <br>... <br>... </p><p>0<br>0</p><p>TP0 is PikeOS extension </p><p></p><ul style="display: flex;"><li style="flex:1">20 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Multi-Processor </strong></p><p>• <strong>Threads are bound to single CPU </strong></p><p>• Explicit migration • PikeOS has implicitmigration on IPC • Scheduler ready queues per-CPU </p><p>• <strong>Kernel should avoid locks </strong>• <strong>Especially in real-time syscalls </strong>• <strong>If locks are fair (FIFO queue), WCET is </strong></p><p>• <em>num_cpus * lock_held_time </em></p><p></p><ul style="display: flex;"><li style="flex:1">21 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Multi-Processor </strong></p><p>• <strong>Predicting resources like caches and memory is difficult </strong>• <strong>Disable HyperThreading </strong></p><p>• it is not worth the trouble </p><p>• <strong>SYSGO’s recommendation “avoid the problem” </strong>• <strong>Better solutions are being investigated </strong></p><p>CPU 2 CPU 1 </p><p>Non-realtime APP1 <br>Linux </p><ul style="display: flex;"><li style="flex:1">Idle </li><li style="flex:1">Non-realtime APP3 </li></ul><p></p><ul style="display: flex;"><li style="flex:1">Non-realtime APP2 </li><li style="flex:1">Real-time APP </li></ul><p></p><p></p><ul style="display: flex;"><li style="flex:1">22 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Other considerations </strong></p><p>• <strong>Worst-case complexity </strong></p><p>• Hash-map is O(1) in practice, O(n) in worst case • AVL or RB trees are always O(log n) </p><p>• <strong>Log messages may slow you down </strong>• <strong>Keep the code small (certification) </strong></p><p>• Sadly, it often is better to copy and specialize the code </p><p>• <strong>Build time design </strong></p><p>• Static number of FDs, buffers etc. </p><p></p><ul style="display: flex;"><li style="flex:1">23 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Other considerations </strong></p><p>• <strong>Choose a suitable HW </strong></p><p>• NXP, Xilinx … </p><p>• <strong>Control over the platform </strong></p><p>• You are not alone on X86 • System Management Mode • Intel Management Engine </p><p></p><ul style="display: flex;"><li style="flex:1">24 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Coding guidelines </strong></p><p>• <strong>MISRA C coding standard </strong></p><p>• Ex. Rule: Initializer lists shall not contain persistent side effects </p><p>• <strong>In OS development, you have to break some of them </strong></p><p>• Ex. Rule: A conversion should not be performed between a pointer to object and an integer type </p><p></p><ul style="display: flex;"><li style="flex:1">25 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Mixing critical and non-critical … </strong></p><p></p><ul style="display: flex;"><li style="flex:1">26 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Why microkernel? </strong></p><p>• <strong>Separate critical and non-critical components </strong></p><p>• MMU required </p><p>• <strong>We need to certify </strong></p><p>• The critical components • The kernel • Smaller kernel = less work </p><p>• <strong>Non-critical parts can use </strong></p><p>• Off-the-shelf software • Linux • =&gt; Easier development </p><p></p><ul style="display: flex;"><li style="flex:1">27 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Why microkernel? </strong></p><p>• <strong>Alternatives </strong></p><p>• Certify everything • Build two physically separate systems </p><p>• <strong>In PikeOS you can choose </strong></p><p>• Kernel driver • User-space driver </p><p>• <strong>Clear(er) line between levels of criticality </strong></p><p>• Desktop PC crash is not fatal if you save your work </p><p></p><ul style="display: flex;"><li style="flex:1">28 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Mixed criticality ex. </strong></p><p>• <strong>Typical examples of mixed criticality: </strong></p><p>• Control loop (critical) vs. diagnostics (non-critical) • Combined Control Unit for multiplefunctions in car </p><p></p><ul style="display: flex;"><li style="flex:1">Leastcritical </li><li style="flex:1">Most critical </li></ul><p></p><p></p><ul style="display: flex;"><li style="flex:1">29 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p><p><strong>Partitioning example - Airbus A400M </strong></p><p></p><ul style="display: flex;"><li style="flex:1"><strong>Level B </strong></li><li style="flex:1"><strong>Level B </strong></li><li style="flex:1"><strong>Level C </strong></li><li style="flex:1"><strong>Level D </strong></li></ul><p></p><p>Ramp, Doors, Aerial Delivery, <br>Cargo Locks <br>... <br>Graphics OpenGL <br>GUI <br>Winches, <br>Crane <br>.... <br>9 Applications incl. <br>Waste&amp;Water <br>HMI </p><p><strong>PikeOS Virtualization Platform </strong></p><p>Hardware </p><p>Pictures: Rheimetall Defense A400M </p><p></p><ul style="display: flex;"><li style="flex:1">30 </li><li style="flex:1">© SYSGO AG · INTERNAL </li></ul><p></p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    48 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us