Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating...

Post on 09-Apr-2018

221 views 2 download

Transcript of Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating...

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 computer hardware

3

Applications

Operating System

Computer Hardware

Common OS Services

• Task (process) management

• Inter process communication (IPC)

• Virtual memory

• Demand paging

• Filesystem

• Hardware interface and I/O handling

• Protection, error handling, security

4

Real-Time Operating System

• OS for real-time systems

• Real-time systems– correctness depends on not only logical correctness

but also temporal one.

• Common requirements– Bounded interrupt latency– Bounded scheduling 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

Linux 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 spin-locks (rtmutexes)

– Interrupts are handled by kernel threads (preemptible)

12

Scheduling Latency Comparison

• w/o vs. w/ PREEMPT_RT patch

• I/O heavy background tasks

13

(*) Figure source: A Comparison of Scheduling Latency in Linux, PREEMPT RT, and LITMUS-RT, OSPERT 2013

Dual-Kernel Approach

• Linux runs on top of an RTOS

– RTLinux

– RTAI

– Xenomai

– 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 Virtual Machine Scheduling in Xen, EMSOFT'14

15