real-time operating systems - ku ittcheechul/courses/eecs753/s17/slides/w11-rtos.pdf · operating...

15
Real-Time Operating Systems Heechul Yun 1

Upload: tranphuc

Post on 09-Apr-2018

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

Real-Time Operating Systems

Heechul Yun

1

Page 2: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

What is an OS?

2

Page 3: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

Operating Systems

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

3

Applications

Operating System

Computer Hardware

Page 4: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

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

Page 5: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

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

Page 6: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

RTOS

• Commercial– VxWorks

– QNX

– Nucleus

– ..

• Free– FreeRTOS

– NuttX

– ...

6

Page 7: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

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

Page 8: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

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

Page 9: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

VxWorks 653

9

Page 10: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

Integrity-178

10

Page 11: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

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

Page 12: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

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

Page 13: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

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

Page 14: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

Dual-Kernel Approach

• Linux runs on top of an RTOS

– RTLinux

– RTAI

– Xenomai

– L4/Linux

14

Page 15: Real-Time Operating Systems - KU ITTCheechul/courses/eecs753/S17/slides/W11-RTOS.pdf · Operating Systems •A program that ... –Bounded interrupt latency ... –RTLinux –RTAI

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