Real Time Linux | Lab. de Electrónica | Dto. de Física | UNLP

Linux has proved to be very flexible in handling hardware and interfacing laboratory equipment. It provides a very attractive platform for developing a Gateway for our labs, so that they can be monitored remotely. Such Linux box can also be used to control the whole experiment. In this case, there are generally very important tasks that are assigned to the system, with strict deadlines (hard real-time tasks).

In order to characterize the ability of Linux in handling real time tasks, we have tested the performance of a 120 MHz Pentium with Linux kernel 2.0.29 (standard or Non Real-Time Linux), versus the same kernel with the real time patch from New Mexico Tech (RT-Linux).

RT-Linux is an extension to Linux that handles time-critical tasks. It shares a PC between a small hard-real-time kernel and standard Linux, so that the PC can be used for applications like data acquisition, control, and robotics while still serving as a standard Linux workstation.

Std-Linux is the standard kernel that is provided in the different distributions. It should be noted that this kernel basically lacks of preemptive scheduling (it implements a time-slice strategy) and memory locking, requirements that are basic for a real time operating system.

Two different tests were designed.

For the first one, a mark with an output bits of the parallel port is generated, when a fixed period of time has elapsed, using as time generator the internal clock of the PC (with both Std and RT-Linux). The intention of this test is to measure the variations that come up when Linux is performing synchronic tasks.

For the second test, the time that both Std and RT-Linux take to response to an external interrupt is measured. The intention of this test is to characterize the ability of Linux in handling asynchronic tasks.

Both tests are performed under different kinds of load for the system:

See appendix for details about circuits and instruments utilized for the measure.

The data from the experiments, in ascii format, is available as a zip file.

TEST 1: Time Interval Generation.

A 40 msec. period square wave is generated in an output bit of the parallel port. The histograms present the distribution of the time between the leading edge and the trailing edge of the square wave, measured for single periods.

In Std-Linux (see code) nanosleep is used to count time. A very simple driver for the parallel port was used (see driver code) to command the output bits.

In RT-Linux (see code) the provided real time clock is used to synchronize two tasks. The first one toggles on an output bit of the parallel port, and the second one toggles it off.

TEST 2: Interrupt Response time.

In response to interrupt 7, a pulse is generated in an output bit of the parallel port. In the histograms, the elapsed time between the interrupt edge and the leading edge of the response pulse is presented.

In Std-Linux (see code) the new parallel port driver is modified (see driver code) so that in response to external interrupt 7, it wakes up the read command, that is blocked. In this way, the read command on /dev/lpv returns synchronized with IRQ7.

In RT-Linux (see code) the response pulse is generated in the real time task assigned to IRQ7.

See also
Home - Physics Department