KURT: The KU Real-Time Linux



0. Copyright and Credits

Copyright (C) 1997 by the University of Kansas Center for Research, Inc. This software was developed by the Information and Telecommunication Technology Center (ITTC) at the University of Kansas. Partial funding for this project was provided by Sprint. This software may be used and distributed according to the terms of the GNU Public License, incorporated herein by reference. Neither ITTC nor Sprint accept any liability whatsoever for this product.

This project was developed under the direction of Dr. Douglas Niehaus.

Authors:

Please send bug-reports/suggestions/comments to kurt@ittc.ku.edu

There is also a mailing list for KURT related questions. If you would like to subscribe to this list please send mail to majordomo@ittc.ku.edu with the body

        subscribe linux-kurt <your-email-address> 
An archive of the list can be found here.


I. Introduction

A real-time system is one in which, in addition to the logical correctness of results, the timeliness is also of importance.

Generally, real-time systems are classified into two categories:

Some types of processing (eg. multimedia) do not fit well into the hard or soft real-time categories. The periodic requests made by multimedia applications are sensitive to variations in timing. As such, they are not well served by the loose guarantees provided by soft real-time systems. Hard real-time systems are often faced with providing guarantees at the expense of providing services. Thus, while they can meet the timing requirements of a multimedia application, many times they cannot meet it's other service requirements. For example, real-time processes running under RTLinux have no access to any of the Linux services.

A purely binary distinction between hard and soft real-time is clearly not acceptable for all applications. Many applications have requirements spanning a continuum between the two. To service a wider range of requirements, we have developed a firm real-time Linux. We call this system "KURT" Linux for KU Real-Time Linux.

KURT Linux allows for explicit scheduling of any real-time events rather than just processes. This provides a more generic framework onto which normal real-time process scheduling is mapped. Since event scheduling is handled by the system, addition of new events such as periodic sampling data acquisition cards (video, lab equipment, etc.) is highly simplified.

KURT introduces two modes of operation - the normal mode and the real-time mode. In normal mode, the system acts as a generic Linux system. When the kernel is running in real-time mode, it only executes real-time processes. While in real-time mode, the system can no longer be used as a generic workstation, as all of its resources are dedicated to executing its real-time responsibilities as accurately as possible.

A simple system call allows the kernel to be toggled between real-time and normal mode. During the setup phase, the schedule of events to be executed in real-time mode is specified and the various processes that are to be executed in real-time mode are marked. The kernel is then switched to real-time mode. When all of the real-time tasks finish execution, the kernel can be switched back to the normal mode.

Presently, this system is available only for the i386 architecture. Porting KURT to other architectures requires only minimal additions. If you are interested in porting KURT to other architectures, please send mail to kurt@ittc.ku.edu.


II. Glossary of Terms:


III. Structure of a Executive Process:

An executive process controls the scheduling of all KURT processes and all RTMods. The main actions the executive process takes are shown below:

    int main()
    {
         set the scheduler of the current process to SCHED_KURT;
         wait for all of the KURT processes to register themselves;
         switch to real-time mode;
         schedule the real-time events;
         switch to normal mode;
    }
    
An example executive process is available.

NOTE:

In the current version of KURT (v1.23) we do not need an executive process to schedule periodic processes. Each of the periodic processes schedule themselves. This scheduling is started when the first rt_suspend call is issued.


IV. Structure of a KURT Process:

Most KURT processes have the following structure:

    int main()
    {
 
        set the scheduler of the current process to SCHED_KURT;
        while(1) {
              suspend until woken up by the executive process;
              do stuff;
         }
    }
    
An example KURT process is available. An example of a periodic KURT process is also available.


V. System Calls:

System Calls in the Real-Time Framework

The following system calls are present in the core real-time framework:

System Calls in the Process Module

The "process" module, takes care of switching context to a specified process when it is invoked. It modifies some existing system calls and, in addition, provides the other system calls mentioned below:


VI. /proc filesystem:

We have added an entry into the /proc filesystem called rt. This directory has entries for the statistics of the real-time system (ie. the number of events handled, the number of events delayed, etc.) in the stats subdirectory. The various registered RTMods can be found in the rt_mods entry. The various realtime processes that have been registered and their statistics can be found in the processes.


VII. Files changed:

A whole new directory called rt has been introduced into the kernel source. Apart from the files in this directory, the following files have been modified or added:

kernel/sched.c
kernel/sysctl.c
kernel/fork.c
kernel/exit.c
arch/i386/kernel/entry.S
arch/i386/kernel/setup.c
mm/vmscan.c
init/main.c
include/asm-i386/unistd.h
include/linux/rt.h
include/linux/sched.h
drivers/char/sysrq.c

Please visit the UTIME page for information on the files that have been modified as part of the UTIME patch.


VIII. Download and Installation instructions

Current Release (v1.23)

Update: March 31, 1999: 2.1.126 Patch Available (Beta version)

The release archive v1.23 is available for five Linux kernel versions. See the Change Log for details on what has changed in version 1.23.

Use tar -xvzf kurt-v1.23-2.1.XXX.tar.gz to uncompress the archive. This will create a subdirectory, KURT, which has the KURT patch:

kurt-v1.23.patch

Patch the kernel using patch -p1 -s < kurt-v1.23.patch.This patch contains the KURT modifications as well as the UTIME modifications.

Finally, configure and build the kernel. Enable the UTIME (Microsecond resolution timer support) and the KU Real-Time features with make config or make menuconfig (NOTE: If you enable the realtime features but disable UTIME then you can schedule events only with 10ms granularity). These options are present in the Kernel Hacking section of the configuration.

Next, make the user programs and the library by running make in the KURT directory of the distribution. This will make a librt.a in the lib subdirectory and make the user programs described above in the user_progs subdirectory (NOTE: that you need to make /usr/src/linux point to the patched kernel before making the user programs and library).

Make the new kernel, boot into it and start playing.

Make sure you run rtd before you switch the kernel to realtime mode.

New as of July 1, 1998
Some changes have been made recently to KURT and UTIME by Robert Hill that are chronicled in the documents available below. Those changes are availble here: KURT-etc-2.1.90-patch.tar.gz (~200KB). This patch contains KURT, UTIME, ATM, and changes to the SCSI subsystem. It also contains our Data Stream Kernel Interface. All of the changes made are detailed in Robert Hill's thesis. Be forewarned that the changes to the SCSI subsystem come with a risk. That is to say that if you use the changes made therein, you should be aware that the changes made may cause data loss or hard drive damage. We do not anitcipate such problems occuring, but at the same time, there is always a risk involved when tampering with such delicate systems. These changes were made on Linux 2.1.90 and are, at this time, only available all or nothing. We are planning to dissect the patch into its component pieces in the near future.

IX. Related Papers and Presentations

A technical report has been written on KURT and UTIME. It is available in several formats:

If you would like these files in some other format, please send mail to kurt@ittc.ku.edu.

Balaji Srinivasan's Master's thesis focused on the design and motivation for KURT (and UTIME) as well as measuring several aspects of its performance.

Robert Hill's Master's thesis focused on improving Linux real-time support. Specifically, scheduling, the I/O subsystem, and network QoS.

Real-Time Technology Applications Symposium

X. Future Work


XI. Acknowledgments

We would like to thank Sprint Inc. for funding the research in this area. We are indebted to them. Obviously without Dr. Niehaus' support and continued encouragement, we would never have had this in its present form.


XII. Contacts and Mailing List

Please send all bug-reports/questions/suggestions to kurt@ittc.ku.edu. Comments are welcome on how we can improve this system and this document.You can also subscribe to the KURT mailing list by sending a mail to majordomo@ittc.ku.edu with the body

 subscribe linux-kurt <your-email-address> 

KURT @ ITTC
Last modified: Fri Mar 24 13:20:52 CST 2000

Home Up