<<

Real-Time Operating Systems

Heechul Yun

1 What is an OS?

2 Operating Systems

• A program that acts as an intermediary between users and the hardware

Applications

Operating System

Computer Hardware

3 Common OS Services

• Task () management • Inter process communication (IPC) • Virtual memory • Demand paging • Filesystem • Hardware interface and I/O handling • Protection, error handling, security

4 Real-Time

• OS for real-time systems

• Real-time systems – correctness depends on not only logical correctness but also temporal one.

• Common requirements – Bounded latency – Bounded latency – Bounded WCETs of system-calls – Support for real-time scheduling policies

5 RTOS

• Commercial – VxWorks – QNX – Nucleus – .. • Free – FreeRTOS – NuttX – ...

6 Common RTOS Services

• Task (process) management • Inter process communication (IPC) • Virtual memory (▲) • Demand paging (X) • Filesystem • Hardware interface and I/O handling • Protection, error handling, security

7 RTOS with Partitioning

• RTOS with time and space partitioning – E.g., VxWorks 653, Integrity-178

• Time partitioning – A partition’s access time to a shared resource (e.g., CPU) must be guaranteed regardless of others

• Space partitioning – A partition’s memory cannot be corrupted by other partitions

8 VxWorks 653

9 Integrity-178

10 as RTOS

• Mainline Linux – Pretty good real-time support these days – RT schedulers: SCHED_FIFO, RR, DEADLINE – Memory locking and other techniques

• Problems – Kernel used to be non-preemptible (not anymore) – Still suffer long interrupt/scheduling latencies – Due to many long non-preemptible code sections

11 Linux-RT (PREEMPT-RT patchset)

• Reduce non-preemptible code sections in various kernel code paths – Preemptible -locks (rtmutexes) – are handled by kernel threads (preemptible)

12 Scheduling Latency Comparison

(*) Figure source: A Comparison of Scheduling Latency in Linux, PREEMPT RT, and LITMUS-RT, OSPERT 2013 • w/o vs. w/ PREEMPT_RT patch • I/O heavy background tasks

13 Dual-Kernel Approach

• Linux runs on top of an RTOS – RTLinux – RTAI – – L4/Linux

14 This Week

• SCHEDULING AND LOCKING IN MULTIPROCESSOR REAL-TIME OPERATING SYSTEMS. Chapter 3.3. The Design and Implementation of LITMUSRT. Bj¨orn B. Brandenburg, PhD Thesis, 2011 – LITMUS-RT

• GPUSync: A Framework for Real-Time GPU Management, RTAS’13

• Real-Time Multi-Core Scheduling in , EMSOFT'14

15