real time with linux real time with linux
play

real-time with Linux real-time with Linux 06.02.2019 Lukas Pirl, - PowerPoint PPT Presentation

real-time with Linux real-time with Linux 06.02.2019 Lukas Pirl, Daniel Richter, and Andreas Polze lecture on embedded operating systems Operating Systems & Middleware Group Hasso Plattner Institute at the University of Potsdam, Germany


  1. real-time with Linux real-time with Linux 06.02.2019 Lukas Pirl, Daniel Richter, and Andreas Polze lecture on embedded operating systems Operating Systems & Middleware Group Hasso Plattner Institute at the University of Potsdam, Germany based on Prof. Andreas Polze’s slides on real-time Linux (https://www.dcl.hpi.uni-potsdam.de/teaching/EOS17/Slides/08.3_rtLinux.pdf) real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 1

  2. agenda agenda terminology motivation RTLinux history overview architecture concepts interrupt emulation, threads, scheduling, IO, synchronization, … other real-time Linux implementations PREEMPT_RT real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 2

  3. terminology in this presentation terminology in this presentation task when referring to abstract concepts in Linux, a synonym for “process” process when referring to the operating system concept (with virtual memory, handles, etc.) in Linux, a synonym for “task” thread when referring to the operating system concept (belonging to a process) real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 3

  4. motivation motivation use standard operating system for real-time applications maturity level rich existing ecosystem e.g., services, development tools, community use existing knowledge/experiences use Linux for real-time applications POSIX compatibility open source kernel modi�cation possible �nancial aspects real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 4

  5. use cases use cases reduce costs for high-frequency tasks e.g., software-implemented AD/DA conversion software routing robotics e.g., to re-use frameworks for graphical interfaces and high-level functionality audio and video streaming use a standard Web server as control interface reduced development costs inspired by http://www.yodaiken.com/papers/lwtalk.pdf real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 5

  6. challenges challenges scheduling latency for real-time processing # let’s ignore malloc , other shared resources, device latencies, etc. for now but in a general purpose OS, kernel threads might be non-preemptable https://blog.emtrion.de/en/details/real-time-linux-part1-introduction-and-problematic-73.html real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 6

  7. RTLinux RTLinux real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 7

  8. RTLinux history RTLinux history developed by Michael Barabanov as master’s thesis under the direction of Prof. Victor Yodaiken at New Mexico Institute of Mining and Technology development, ownership and rights moved to Finite State Machine Labs (FSMLabs) timeline 1997: Version 1: master’s thesis / research project 1999, October: Version 2: �rst production version 2001, February: Version 3: �rst industry-grade version real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 8

  9. RTLinux overview RTLinux overview adds hard real-time capabilities to Linux interrupt emulation real-time scheduler periodic tasks high resolution timer non-RT tasks run as idle tasks of RT core real-time IPC between real-time and non-real-time tasks multi-platform X86, PowerPC, Alpha, MIPS, AMD Elan NetSC520 real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 9

  10. RTLinux overview RTLinux overview some other OS with “retro�tted” real-time capabilities use similar concepts i.e., real-time operating system hosts a “virtualized” standard operating system a mix of GPL and commercial (FSMLabs) licenses partly patented (U.S. Patent 5,995,745) interrupt interception, hardware abstraction, etc. real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 10

  11. Linux architecture Linux architecture Aarno, D. (2004). Autonomous path planning and real-time control-a solution to the narrow passage problem for path planners and evaluation of real- time linux derivatives for use in robotic control. Unpublished master’s thesis, Department of Numerical Analysis and Computer Science (NADA), KTH, Sweden. (TRITANA-E04006). real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 11

  12. RTLinux architecture RTLinux architecture Aarno, D. (2004). Autonomous path planning and real-time control-a solution to the narrow passage problem for path planners and evaluation of real- time linux derivatives for use in robotic control. Unpublished master’s thesis, Department of Numerical Analysis and Computer Science (NADA), KTH, Sweden. (TRITANA-E04006). real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 12

  13. RTLinux basic concept: interrupt emulation RTLinux basic concept: interrupt emulation layer of emulation software between “real” Linux and interrupt controller hardware patched into Linux source all hardware interrupts are caught by emulator Linux has no direct control over the interrupt controller so it does not in�uence processing of real-time interrupts real-time interrupts handled in emulator don’t pass through to Linux real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 13

  14. RTLinux basic concept: RTLinux basic concept: interrupt emulation interrupt emulation U.S. Patent 5,995,745 real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 14

  15. RTLinux interrupt emulation: soft interrupts RTLinux interrupt emulation: soft interrupts disabling a hardware interrupt unsets a variable within the emulator when hardware interrupt occurs, the variable is checked if set: Linux interrupt handler routine will be invoked if unset: Linux interrupt handler routine won’t be invoked but but: a bit is set, which holds information about pending interrupts re-enabling interrupts causes pending Linux interrupt handlers to be invoked real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 15

  16. RTLinux interrupt RTLinux interrupt emulation: emulation: soft interrupts soft interrupts U.S. Patent 5,995,745 real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 16

  17. how RTLinux catches Linux’ interrupt handling how RTLinux catches Linux’ interrupt handling instructions for interrupt handling replaced with emulating macros cli (clear interrupt �ag) → S_CLI sti (set interrupt �ag) → S_STI iret (interrupt return) → S_IRET real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 17

  18. RTLinux’ RTLinux’ S_CLI / / S_STI code modi�ed for presentation purposes real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 18

  19. RTLinux’ RTLinux’ S_IRET code modi�ed for presentation purposes real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 19

  20. RTLinux RTLinux interrupt handler interrupt handler U.S. Patent 5,995,745 real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 20

  21. RTLinux modules RTLinux modules rtl_core.o : main module rtl_time.o : controls processor clocks rtl_sched.o : implements a real-time scheduler rtl_posixio.o : provides a POSIX-like interface to device drivers rtl_ipc.o provides POSIX-style blocking mutexes and semaphores mbuff.o : provides a shared memory between real-time and Linux tasks rtl_fifo.o : provides a real-time non-blocking FIFO rtl_debug.o adds support for source-level debugging rtl_com.o interface with serial ports real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 21

  22. RTLinux threads RTLinux threads POSIX thread API for real-time threads all real-time tasks are threads in one real-time process per processor real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 22

  23. RTLinux thread scheduling RTLinux thread scheduling real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 23

  24. RTLinux thread scheduling: example module RTLinux thread scheduling: example module real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 24

  25. RTLinux scheduling RTLinux scheduling original scheduler: priority-based FIFO, one-shot 1.000.000 priorities does not perform well with > 20 tasks EDF and RMS scheduler available one-shot mode i.e., reprogramming of timer chip at each scheduling decision periodic modes i.e., timer chip programmed once better performance but not all periods available real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 25

  26. inter-process communication in RTLinux inter-process communication in RTLinux real-time FIFOs implemented using soft interrupts non-blocking real-time interface enables communication between real-time and Linux tasks character device for Linux tasks shared Memory enables communication between real-time and Linux tasks support of mmap() in posixio.o real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 26

  27. RTLinux real-time FIFO API RTLinux real-time FIFO API no surprises: real-time with Linux lecture on embedded operating systems lukas.pirl@hpi.de 06.02.2019 27

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend