Details of ART-Linux

Summary page of ART-Linux


Motivation: Example of a large scale Real-Time System - Robot Software

Development of a General Purpose Real-Time Operating System

A large scale Real-Time Operating System should be: Both are IMPORTANT

Possible approaches include:

Former approach requires less code

Development of a General Purpose Real-Time Operating System - Why Linux?

Conditions: Decision: Use Linux as the base general purpose operating system

Extended Linux to include Hard Real-Time scheduling capabilities based on priority inheritance

Comparison with Other Real-Time Operating Systems

Lacking Features in readily available Hard Real-Time Linux Kernels

Kernels with technically sufficient hard Real-Time performance Both require specialised Real-Time capable device drivers

Both have restricted priority inheritance which can cause trouble when designing large Real-Time Processing Systems

Characteristics of RT-Linux

Points Lacking in RT-Linux

Characteristics of ART-Linux

New System Calls

int art_enter(art_prio_t prio, art_flags_t flags, int usec)
Enable real-time for process
int art_wait(void)
Sleep until next execution period arrives
int art_exit(void)
Relinquish real-time capabilities
int art_wait_phase(unsigned long usec, art_prio_t prio)
Wait for specified amount of time
int art_yield(void)
Yield from real-time state

Sample Program

#include <stdio.h>
#include <stdlib.h>
#include <sys/io.h>
#include <linux/art_task.h>

#define TRUE 1

#define KBD_PORT 0x61
#define SPK_BIT 0x02

main(int argc, char *argv[])
    int temp, hz, i;
    hz = atoi(argv[1]);
    ioperm(KBD_PORT, 1, TRUE);
    art_enter(ART_PRIO_MAX, ART_TASK_PERIODIC, 500000 / hz);
    for (i = 0; i < hz * 5; ++i) {
         temp = inb(KBD_PORT);
         temp = (i & 1) ? temp | SPK_BIT : temp & ~SPK_BIT;
         outb(temp, KBD_PORT);

Sample Program

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/art_task.h>

int main(int argc, char *argv[])
    art_prio_t prio;
    if (argc < 3 || (prio = atoi(argv[1])) < ART_PRIO_MIN ||
         prio > ART_PRIO_MAX) {
         fprintf(stderr, "usage: %s prio file arg .../n", argv[0]);
         return -1;
    if (art_enter(prio, ART_TASK_RR, 0) == -1) {
         return -1;
    if (execvp(argv[2], &argv[2]) == -1) {
         return -1;
    return 0;

Problems adding Real-Time capabilities to the Linux Kernel, and their Solutions

Method Used for adding Real-Time Capabilities

Interrupt Handler as Periodic Task

Real-time Locking Methods

Priority Inheritance in Real-Time Locks

Hardware Interrupt Management Emulated Through Real-Time Locks

Emulation of process synchronization primitives through Real-time Locks

Inter-process Synchronization Primitives Emulated using Real-Time Locks

Adaptation of Linux Kernel 2.2(2.4)

SMP implementation on Linux kernel 2.0.x

SMP implementation on Linux kernel 2.2.x (2.4.x)

Real-time processing using SMP capabilities

Performance Measurement

Pentium !!! 600EB

Pentium !!! 800EB

Pentium !!! 1000

Pentium !!! 600EB (dhrystone)

Pentium !!! 800EB (dhrystone)

Pentium !!! 1000 (dhrystone)

Pentium !!! 600EB (copy)

Pentium !!! 800EB (copy)

Pentium !!! 1000 (copy)

To Summarise

Case with Priority Inversion

Til t=T1 Process 1 which has the highes priority is executed
At t=T1 Process 1 has to wait for the result from Process 3
From t=T1 to t=T2 Process 2 which has the next highest priority is run
At t=T2 Process 2 finishes
From t=T2 to t=T3 Process 3 is executed
From t=T3 on Process 1 is executed

Scheduling with Priority Inheritance

Til t=T1 Highest priority process is run
At t=T1 Process 1 waits for results of Process 3
Priority of Process 1 is inherited by Process 3
From t=T1 to T2 Process 3 is run
At t=T2 Process 3 ends
From t=T2 on Process 1 is run

Embedded Linux and Real-Time Linux

Both provide different features and capabilities. Some systems require features from both types