• No results found

RTAI. Antonio Barbalace (modified by M.Moro 2011) RTAI

N/A
N/A
Protected

Academic year: 2021

Share "RTAI. Antonio Barbalace (modified by M.Moro 2011) RTAI"

Copied!
17
0
0

Loading.... (view fulltext now)

Full text

(1)

DEI Universit y of Padova

RTAI

Antonio Barbalace [email protected] (modified by M.Moro 2011) DEI Universit y of Padova

RTAI

Real Time Application Interface by Dipartimento di Ingegneria

Aereospaziale dell’Università di Milano (DIAPM)

(2)

© Antonio Barbalace 2008 RTOS - RTAI course 3

DEI Universit

y of Padova

RTAI

• It is not a complete RTOS

• It makes Linux kernel fully pre-emptable

• Some (limited) changes must be applied to the kernel, i.e. interrupt handling and scheduling policies

• RTAI acts essentially as an interrupt dispatcher • RTAI consider Linux as a background task

© Antonio Barbalace 2008 RTOS - RTAI course 4

DEI Universit y of Padova

RTAI

User space RT processes standard processes RT processes standard processes Hardware System calls

(3)

© Antonio Barbalace 2008 RTOS - RTAI course 5

DEI Universit

y of Padova

RTAI

History and evolution (1/2):

• At first it was PCDOS-DIAPM-RTOS (16bits real mode);

• Then it was implemented in 32 bits real/protected mode;

• Approaching Linux (2.0.25);

• NMT-RTL appears and goes on DIAPM-RTL variant was born

• RTHAL-RTAI patch for 2.2.xx kernel ready (beginning 1999)

DEI Universit

y of Padova

RTAI

History and evolution (2/2):

• April 1999 first version of RTAI for UP and SMP; • Jan 2001 NMT-RTL now RTLinux was patented; • Jun 2002 ADEOS was firstly released;

• ADEOS substitutes RTHAL and from now on no patent problems;

• LXRT scheduler was introduced; • More than one branch of RTAI;

• October 2005 Fusion branch becomes a stand-alone distribution Xenomai;

(4)

© Antonio Barbalace 2008 RTOS - RTAI course 7

DEI Universit

y of Padova

RTHAL

• To encapsulate all the data structures and time critical functions of the kernel in one defined structure

• All the original operations work through RTHAL pointers

• RTHAL pointers are dynamically modifiable ⇒ RTAI can be selectively activated/disactivated • Successively substituted by (a modified version

of) ADEOS

DEI Universit

y of Padova

ADEOS

Adaptive Domain Environment for

Operating Systems

(5)

© Antonio Barbalace 2008 RTOS - RTAI course 9 DEI Universit y of Padova

ADEOS

Dual-kernel approach

Nano kernel

Open source

NEW NAME:

ADEOS/ipipe

CHANGES:

• Functions name

• Various improvements

DEI Universit y of Padova

ADEOS

Dual Kernel with ADEOS/ipipe nano kernel

Hardware ADEOS/ipipe Linux RTOS

(6)

© Antonio Barbalace 2008 RTOS - RTAI course 11

DEI Universit

y of Padova

ADEOS

Many different OS (or multiple instances of the same OS) running on the same machine, sharing the same hardware.

OS User Process 1 User Process 2 User Process 3

Hardware

Hardware OS User Process 2

User Process 1 User Process 3

Hardware ADEOS/ipipe OS 2 OS 1 OS 3 User Process 1 User Process 2 User Process 1 User Process 2 User Process 3 User Process 1 User Process 2 co-DOS era OS era ADEOS era

© Antonio Barbalace 2008 RTOS - RTAI course 12

DEI Universit y of Padova

ADEOS

Basics:

• Domains

• Pipeline

• Interrupts

• Events

(7)

© Antonio Barbalace 2008 RTOS - RTAI course 13

DEI Universit

y of Padova

ADEOS

- Resource virtualization layer available as a Linux kernel patch/module

- It enables multiple

domains

to share hardware resources

- A domain is generally a complete OS but no assumption is made by Adeos on the

sophistication of a domain

- Domains compete for processing external events (interrupts) or internal ones (traps)

- It exports a generic, CPU-independent API to client domains

DEI Universit

y of Padova

ADEOS

4 ADEOS communication methods

A – general usage of the hardware made by a domain

B – Adeos receives control from the hardware (through HW o SW interrupts) C – Two-ways communication (the domain is aware of the presence of Adeos) D – Invoking of an OS’s interrupt handler (the domain could not be aware of

the presence od Adeos)

OS domain 1 OS domain 2 ADEOS Hardware C D A A B

(8)

© Antonio Barbalace 2008 RTOS - RTAI course 15

DEI Universit

y of Padova

ADEOS event pipeline

- A domain can ask ADEOS to be notified of:

- Every incoming external interrupt or auto-generated virtual interrupt

- Every system call issued by applications

- Other system events triggered by the kernel code (task switching, signal notification, task exit, etc.)

- Events are dispatched by ADEOS in orderly manner assigning a static priority to each domain

- Active domains are orderly queued into a

pipeline

© Antonio Barbalace 2008 RTOS - RTAI course 16

DEI Universit

y of Padova

ADEOS

ADEOS/ipipe interrupts/events pipeline (on interrupt) Root domain OS domain 3 OS domain 2 OS domain 1 OS domain n OS domain idle wired? Hardware Interrupt Linux

(9)

© Antonio Barbalace 2008 RTOS - RTAI course 17 DEI Universit y of Padova

ADEOS

Interrupts PROPERTIES: • Asynchronous • Raised in Hardware

• Maskable (a domain could be stalled) • Propagated down the pipeline

• Logged (Optimistic interrupt protection scheme)

– A domain can temporarily stall its stage in the

pipeline

– In this state an incoming interrupt is not delivered to the domain’s handler, is logged, and is not flowed down to the lowest priority domains

DEI Universit y of Padova

ADEOS

Events PROPERTIES: • Synchronous

• Raised mostly for software cause • Non maskable

• Propagated from the source domain up the pipeline

(10)

© Antonio Barbalace 2008 RTOS - RTAI course 19

DEI Universit

y of Padova

ADEOS

References:

• Karim Yagmour et others (OperSys Inc)

• www.adeos.org

© Antonio Barbalace 2008 RTOS - RTAI course 20

DEI Universit

y of Padova

RTAI/ADEOS

- RTAI is installed as domain with the maximum (relative) priority, higher than the Linux domain ⇒ RTAI serves interrupts before Linux

Standard processes Linux kernel RT processes

(11)

© Antonio Barbalace 2008 RTOS - RTAI course 21

DEI Universit

y of Padova

RTAI VS Xenomai

RTAI immediate dispatching Xenomai

RTAI pipeline (no immediate dispatching) asm low-level Linux Hardware ADEOS/ipipe Linux Xenomai asm low-level Linux Hardware ADEOS/ipipe Linux RTAI DEI Universit y of Padova

RTAI VS Xenomai

RTAI

Currently ported on: • ARM

• I386, ia64 (SMP, MUP) • PowerPC Run: • Kernel • User Main goal : • Fast dispatching API interface: • RTAI • Posix 1003.1b • RTDM Xenomai

Currently ported on: • ARM • i386, ia64 (SMP) • PowerPC, PowerPC64 (SMP) • Blackfin Run: • Kernel • User Main goal : • Portability API interface: • Xenomai native • Posix 1003.1b • RTAI • VxWorks • pSos+ • VRTX • uITRON • RTDM

(12)

© Antonio Barbalace 2008 RTOS - RTAI course 23

DEI Universit

y of Padova

RTAI VS Xenomai

From our tests:

LESS INTEGRATION PROBLEMS: Xenomai

BETTER PERFORMANCE: RTAI (immediate dispatching)

EASY APPLICATION PORTING: Xenomai

DEBUGGING SUPPORT: Both

CLEAR, AND WELL ORGANIZED SOURCE CODE: Xenomai

DEI Universit

y of Padova

RTAI

(13)

© Antonio Barbalace 2008 RTOS - RTAI course 25 DEI Universit y of Padova

RTAI

Basics: • ADEOS/RTHAL • RTAI Scheduler • RTAI IPC RTAI Scheduler RTAI IPC ADEOS/RTHAL DEI Universit y of Padova

RTAI

ADEOS/RTHAL PROVIDES:

• Immediate Interrupts dispatching

• Interrupt registering/deregistering functions • PIC management routines

• Hardware Timers (8254/APIC) management routines • registering/deregistering timers handler functions • Trap handlers registering/deregistering functions • Provides rt_printk/rt_synch_printk

(14)

© Antonio Barbalace 2008 RTOS - RTAI course 27

DEI Universit

y of Padova

RTAI

8254

Native RTAI timer; it supports at least two modes that are used: • Periodic Mode

• Oneshot Mode This timer is used in: • UP

• SMP

Counter 0 shared with Linux.

APIC

At first used with multiprocessor hardware only. Same modes: • Periodic Mode • Oneshot Mode Used in: • SMP • MUP ADEOS/RTHAL timers

© Antonio Barbalace 2008 RTOS - RTAI course 28

DEI Universit

y of Padova

RTAI

Periodic Mode

Automatic timer register reload

Oneshot Mode

Compulsory timer register update

timer_handler{ ... } timer_handler{ ... } timer_handler{ ... } timer_handler{ ... } Timer update timer_handler{ ... } timer_handler{ ... } timer_handler{ ... } timer_handler{ ... } Timer update

(15)

© Antonio Barbalace 2008 RTOS - RTAI course 29 DEI Universit y of Padova

RTAI

Scheduler PROVIDES:

• Task creation/destruction routine • Task suspend/yield/sleep routine • Task Timer related function

• Scheduling disciplines/policy

• LXRT Linux (user space) Real-Time capability • Task interface with IPC mechanisms

DEI Universit y of Padova

RTAI

Scheduler

Scheduling policy:

• RMS

• EDF

• FIFO, default scheduler

• RR

(16)

© Antonio Barbalace 2008 RTOS - RTAI course 31 DEI Universit y of Padova

RTAI

Scheduler Scheduling point: • on timer interrupt • on ISR exit • on task self-suspending Self-suspending examples: • Yield • Suspend • Sleep

© Antonio Barbalace 2008 RTOS - RTAI course 32

DEI Universit y of Padova

RTAI

Scheduler

LXRT

Scheduler kernel

Scheduler user

(17)

© Antonio Barbalace 2008 RTOS - RTAI course 33 DEI Universit y of Padova

RTAI

IPCs PROVIDES:

• Bits (a sort of signals) • Fifo

• Message • Mailbox

• Message queue

• NetRPC (now requires RTNet) • Semaphore • Shared memory DEI Universit y of Padova

RTAI

RTAI References:

Paolo Mantegazza, DIAPM

www.rtai.org

Xenomai References:

www.xenomai.org

References

Related documents

Mu Mu Shwe, Teruo Harano, Shigeru Okada, Aye Aye Win, Khin Saw Aye, Hlaing Myat Thu, Mo Mo Win, Khin Khin Oo and Myo Khin: Prevalence of high risk human Papillomavirus

To transfer every specific element from one text into another is important for students and future translators to form translator’s linguistic and cultural outlook, derived

The next section adopts the aesthetic motivation (with a focus on the sublime) as a lens to examine management students’ engagement in a higher education context,

It is becoming increasingly clear that there are important, distinctive and creative contributions that the arts and humanities can make to the development of approaches to the use

The purpose of this study was to answer two questions about the impact of robotics on problem-solving skills: (1) How does the introduction of robotics challenges in a

By proposing the concept of miniature and exploring its diverse facets and conceptual implications in the context of specific examples of museum displays of Chinese ethnic

Using passive integrated transponder (PIT) telemetry, this study evaluated the efficacy of two conventional, technical fishways of different designs (pool and

Fishing village as an object of observation, in the South Coast of East Java, on the coast of Prigi Trenggalek regency, the condition of the settlement environment requires