Real Time Application Interface (RTAI) Zubair Ahmad - Ilhan Akbas.

Slides:



Advertisements
Similar presentations
Real Time Versions of Linux Operating System Present by Tr n Duy Th nh Quách Phát Tài 1.
Advertisements

User-Mode Linux Ken C.K. Lee
Bilgisayar Mühendisliği Bölümü GYTE - Bilgisayar Mühendisliği Bölümü Multithreading the SunOS Kernel J. R. Eykholt, S. R. Kleiman, S. Barton, R. Faulkner,
Chap 2 System Structures.
Operating System Structure
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Computer Systems/Operating Systems - Class 8
Chapter 13 Embedded Systems
Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Chapter 5 Processes and Threads Copyright © 2008.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
Chapter 13 Embedded Systems
Chapter 11 Operating Systems
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
1 Operating Systems Ch An Overview. Architecture of Computer Hardware and Systems Software Irv Englander, John Wiley, Bare Bones Computer.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
1 I/O Management in Representative Operating Systems.
The Design of Robust and Efficient Microkernel ManRiX, The Design of Robust and Efficient Microkernel Presented by: Manish Regmi
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Cyclic Scheduling –Advantages Simple implementation (no real-time operating system is required). Low run-time overhead. It allows jitter control. –Disadvantages.
CprE 458/558: Real-Time Systems (G. Manimaran)1 RTLinux Lab – Introduction Cpre 558 Anil
Performance Evaluation of Real-Time Operating Systems
Chapter 3 Operating Systems Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
Chapter 6 Operating System Support. This chapter describes how middleware is supported by the operating system facilities at the nodes of a distributed.
1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not.
Tittle:Real Time Linux
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
The Performance of Micro-Kernel- Based Systems H. Haertig, M. Hohmuth, J. Liedtke, S. Schoenberg, J. Wolter Presentation by: Seungweon Park.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Operating Systems CSE 411 Multi-processor Operating Systems Multi-processor Operating Systems Dec Lecture 30 Instructor: Bhuvan Urgaonkar.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 2 (Part II) Operating System Overview.
Real-Time, Clocking, and Porting (My Job ) Determining the Real Time Capabilities of various Operating Systems. Writing code to support Real Time Clocking.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
What is a Process ? A program in execution.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Concepts and Structures. Main difficulties with OS design synchronization ensure a program waiting for an I/O device receives the signal mutual exclusion.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Introduction to Operating Systems Concepts
Processes and threads.
Process Management Process Concept Why only the global variables?
CS 6560: Operating Systems Design
Real-time Software Design
Chapter 3: Windows7 Part 2.
Threads, SMP, and Microkernels
Chapter 3: Windows7 Part 2.
Process Description and Control
Lecture 4- Threads, SMP, and Microkernels
B.Ramamurthy Chapter 2 : Appendix
CS510 Operating System Foundations
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

Real Time Application Interface (RTAI) Zubair Ahmad - Ilhan Akbas

Content OS Requirements Linux Kernel Core RTAI Description LXRT Future Directions

OS Requirements Software components relying on a platform offering both real time support and "standard" general purpose API The Platform needs a real-time executive and a comprehensive OS The Linux OS exports the same application service level but suffers from a lack of real time support. Some options:  Native real time support in Linux  Linux Modifications for real time constraints (KURT): no outstanding background.  Linux and real time sharing resources ( L4Linux) : experimental project.  Linux as a task of a real time executive: RTLinux, RTAI, eCos, Nucleus.

Real time support in Linux Linux has support for the POSIX real-time extensions POSIX API and the real-time kernel offer distinct services (multi- user, multi-tasking) Hard real-time tasks in Linux using POSIX approaches provide little efficiency Linux kernel uses coarse-grained synchronization allowing a kernel task exclusive access for long times Does not preempt execution of any task during system calls High priority tasks are made to wait for low priority ones Time slices, batch operations, frequent hardware reorder requests

Linux Kernel Core Linux, offers to the applications at least : HW management layer dealing with event polling or Processor/peripheral Interrupts Scheduler classes dealing with process activation, priorities, time slice, soft real-time Communications means among Applications (at least FIFO).

Real-Time Application Interface It is a module in dormant state ready to overtake Linux Not a RTOS. Makes Linux kernel fully pre-emptable. Adds the features of RTOS to Linux. interrupt dispatcher: traps the peripherals interrupts and if necessary re-routes them to Linux. Hardware abstraction layer (HAL): Gets information from Linux and traps fundamental functions. Provides few dependencies to Linux Kernel. Minimizes intrusion on the standard Linux kernel Localizes interrupt handling and emulation code Linux is a background task for RTAI

Real-Time Application Interface Offers some services related to: HW management layer dealing with peripherals. Scheduler classes dealing with tasks, priorities, hard real-time. Communications means among tasks & processes (at least FIFO).

RTAI Block Description The software architecture of RTAI is made of:  1 I/F to Linux HW Management (HAL): basically a data structure.  3 basic components (dispatcher, scheduler, fifo's).  1 I/F (set of functions) used in user tasks to initialize and start the components. From a Linux point of view these entities populate modules.

Control flow in a RTAI/Linux system

Virtual Interrupt Control Cli () and Sti () RTAI functions set flags recording incoming and ignored interrupts Sti () records incoming interrupts Cli () records ignored interrupts RTAI registers all interrupts and signals them at an appropriate time

Real-Time Application Interface HAL supports five core loadable modules  Rtai –> provides basic framework  Rtai_sched -> provides periodic or one shot scheduling  Rtai_mups -> provides simultaneous one-shot and periodic schedulers  Rtai_shm -> allows memory sharing (both inter-linux and intra linux)  Rtai_fifos -> adaptation of the RTLinux FIFO’s

Scheduling a task in real time insmod /home/rtai/rtai insmod /home/rtai/modules/rtai_fifo insmod /home/rtai/modules/rtai_sched insmod /path/rt_process insmod – Load a module (could be used with ldmod)

Stop application and remove RTAI rmmod rt_process rmmod rtai_sched rmmod rtai_fifo rmmod rtai rmmod – unload module (remod could be used)

RTAI Mounting Sets up the global hard lock handler Hard locks all CPUs Redirects rthal interrupts enable/disable and flags save/restore to its internal functions doing it all in software Recovers from rthal a few functions to manipulate 8259 PIC and IO_APIC mask/ack/unmask staff Redirect all hardware handler structures to its trapped equivalent Changes the handlers functions in idt_table to its dispatchers Releases the global hard lock Linux appears working as nothing happened but it is no more the machine master

RTAI Modules To use RTAI, the modules with RTAI capabilities must be loaded:  rtai  rtai_sched  rtai_fifos  rtai_shm  lxrt  rtai_pqueue  rtai_pthread  rtai_utils

rtai core module initializes all of its control variables&structures, makes a copy of the idt_table and of the Linux irq handlers entry addresses and initializes the interrupts chips (ic) management functions. must be mounted by calling rt_mount_rtai(). Linux work toward the hardware is filtered by rtai,the only master of the hardware.

rtai_sched real time scheduler module Distributes the CPU to different tasks. The first initialized task will run to completion unless a task with a higher priority is elected or it terminates or the task calls a blocking system function. 3 different schedulers: - UP, only for uniprocessors - SMP, for multiprocessors - MUP, only for multiprocessors

Uniprocessor Scheduler Process with the highest priority gets the CPU. It is a multi-list priority based scheduler. Linux is a real-time task as any other but remains at the lowest priority level. Implementation of the scheduler is split between two complimentary functions:  rt schedule(): Invoked by different facilities to enforce a scheduling change to reflect a modication in the state of a process.  rt timer handler(): Exclusively targeted at dealing with the timer interrupt.

SMP&MUP Scheduler SMP can schedule tasks to more than one CPU. Different degrees of additional services can be dealt with on a specific CPU. SMP scheduler remains a priority driven scheduler. MUP scheduler views a multiprocessor machine as a collection of many uniprocessors. Each CPU can have its timer programmed differently. With MPU, a CPU can run in periodic mode while another running in one-shot mode.

rtai_fifos Implements the fifo services for RTAI. Forms a synergy between the real-time system side and the Linux side. (managing data logging and displaying). rtai_fifos module performs creation, destruction, reading and writing functions for the real-time task interface. Linux user processes see rt-fifos as ordinary character devices. No more required in RTAI, but kept for compatibility reasons and because they are very useful tools to be used to communicate with interrupt handlers. Once you have your interrupt handler installed you can use fifo services to do all the rest.

FIFO Within a kernel module, FIFO API identifies a FIFO using its ID. A real-time task can collect data in real-time while making this data available to a normal Linux process. A sample of the API available to modules:  rtf create(): Creates fifo with a given size and ID.  rtf destroy(): Destroys a fifo.  rtf reset(): Empties the content of a fifo.  rtf put(): Puts data in a fifo.  rtf get(): Gets data from the fifo.  rtf create handler(): Associates a handler to deal with the addition of data to the fifo in an asynchronous way. Semaphore primitives have been added to provide for the synchronization of the access to the fifos.

rtai_shm Allows sharing memory among different real time tasks and Linux processes. It is another mechanism available to users, like fifos. The services are symmetrical. The first allocation does a real allocation, any subsequent call with the same name just maps the area to the user space or return the related pointer to the already allocated space in kernel space. Freeing calls have just the effect of unmapping till the last is done.

lxrt The LX(Linux)RT(RealTime) module Implements services to make RTAI schedulers functions available to Linux processes. Makes it possible to share memory, send messages, use semaphores and timings: Linux Linux, Linux RTAI,RTAI RTAI

LXRT User Space Services By LXRT, user space tasks can call on exported RTAI services like they call on exported Linux system calls. The services exported to userspace using LXRT are all the services previously only available to loadable modules. One can use the same functions and semantics in either user space or kernel space with the same effect. To test real-time applications in user space prior to inserting them as kernel modules. User space applications using LXRT to access RTAI services are not hard-real-time tasks, they are only soft-real time tasks.

Posix RTAI Modules There are multiple Posix standards for real-time. RTAI Posix module implements c and a part of the b. rtai_pthread.o provides hard real-time threads, where each thread is a RTAI task. All threads execute in the same address space and can work concurrently on shared data. rtai_pqueue.o provides kernel-safe message queues. POSIX API and the real-time kernel offer distinct services (multi- user, multi-tasking) Hard real-time tasks in Linux using POSIX approaches provide little efficiency

Memory Management Support for higher-level languages which require new and delete operators. The algorithm provides for real-time memory allocation. Initially reserves a chunk of memory from the kernel. Thereafter, chunks of memory are provided upon request to the callers of rt malloc() using a deterministic algorithm. Freeing of the request memory is done using the rt free() call.

Watchdog To further insure that RTAI is a safe environment Can be used to insure that no one task will freeze the system because of its misbehaviors. Using watchdog facility it is possible to:  ensure that infinite loops and task scheduling overruns do not handicap the system's ability to continue operating  suspend offending tasks or even kill them.

Future Directions More ports of RTAI to other architectures. Extensive framework for C++ programming for RTAI. Real-time RAM filesystem. POSIX I/O layer to support filesystem. Integration of RTNet and socket layer. Integration of Linux Trace Toolkit hooks. Using RTAI services on RTLinux. Standalone RTAI. Standard real-time development environment. Multiple interrupt priorities. Latency verification of code paths.

Questions ??