You are on page 1of 8

A Firm Real-Time System Implementation Using Commercial Off-The-Shelf

Hardware and Free Software

Balaji Srinivasan, Shyamalan Pather, Robert Hill, Furquan Ansari, Douglas Niehaus
Electrical Engineering and Computer Science Department
University of Kansas
Lawrence, KS 66045

Abstract timing and scheduling capabilities. These extensions sel-


dom preclude the soft real-time applications from accessing
The emergence of multimedia and high-speed networks the services offered by these operating systems. Hard real-
has expanded the class of applications that combine the time applications, in contrast, typically require specialized
timing requirements of hard real-time applications with the operating systems that run on very specific hardware and
need for operating system services typically available only come at a significant cost. In order to meet the strict timing
on soft-real time or timesharing systems. These applica- requirements of hard real-time applications, these operating
tions, which we describe as firm real-time, currently have systems can often provide only a very austere execution en-
no widely-available, low-cost operating system to support vironment, offering few application services.
them. In this paper we discuss modifications we have made Recent developments in many areas, including multime-
to the popular Linux operating system that give it the abil- dia and ATM networking, have spawned several applica-
ity to support the comparatively stringent timing require- tions that defy the binary hard/soft classification system.
ments of these applications, while still giving them access Multimedia video applications, for example, exhibit com-
to the full range of Linux services. Using our firm real-time paratively strict timing requirements typical of hard real-
system as a basis, we have developed the ATM Reference time applications, since they need to maintain very precise
Traffic System (ARTS) that is capable of recording and ac- display refresh rates. However, most hard real-time oper-
curately reproducing packet-level ATM traffic streams with ating systems cannot, or can only partially, support such
timing resolution in microseconds. The effectiveness of this multimedia applications because they require a wide va-
application, as well as the comparative ease with which it riety of system services. Our own research in the devel-
was developed, illustrate the performance and utility of our opment and performance evaluation of ATM networks has
system. included several applications with similar combinations of
fine grain timing requirements (typical of hard real-time
systems) with system service requirements typical of soft
real-time systems. These applications, which fall neither
1 Introduction into the hard nor soft real-time classes, might reasonably be
called firm. Furthermore, many of these applications exhibit
Until the fairly recent past, most real-time applications fit stringent cost constraints. We could find no system which
into two broad categories. The first consists of those appli- adequately satisfied the combination of temporal, service,
cations with soft real-time constraints which require timely and cost constraints exhibited by this class of applications.
execution of tasks at coarse temporal resolution, but do not Another important characteristic of firm real-time ap-
produce catastrophic consequences if their deadlines are vi- plications is that they are seldom designed to be run
olated. The second group consists of hard real-time applica- on dedicated real-time hardware. For example, a video-
tions. These applications impose stringent timing demands conferencing application would typically be targeted for
on their operating systems, with disastrous, and sometimes use on a standard desktop system, in conjunction with
fatal, consequences resulting from temporal errors. conventional applications such as word processors or web
Soft real-time applications can usually be supported by browsers. Therefore, a crucial requirement of any operat-
generic desktop operating systems with slightly extended ing system claiming to support firm real-time applications
is that it allow real-time and non-real-time tasks to coexist.
This work was supported by grants from Sprint Corporation. We have created the KU Real-Time (KURT) system
which satisfies the constraints of many applications in the operating systems. In Section 3 we describe the implemen-
firm real-time category. KURT is based on the freely avail- tation of the UTIME Linux extension, the KURT system on
able Linux operating system, modified in several important top of it, and the implementation of ARTS. The experimen-
ways. First, by running the hardware timer as an aperiodic tal results from our tests of UTIME, KURT, and ARTS are
device (as described in Section 3) we have increased the presented in Section 4 and in Section 5 we discuss our con-
system’s temporal resolution without significantly increas- clusions and possible future work. We have not included a
ing the overhead of the software clock. We call this the detailed description of the KURT application programming
UTIME extension to Linux, which alone increases the util- model, as this has been discussed fully elsewhere [8].
ity of Linux for soft real-time applications.
The KURT system builds on top of UTIME, adding a 2 Related Work
number of features. KURT enables the system to switch be-
tween three modes: normal mode, in which it functions as
The recent proliferation of firm real-time applications
a normal Linux system, mixed real-time mode, in which it
has motivated several efforts to produce a suitable operat-
executes designated real-time processes according to an ex-
ing system for them. In this section, we discuss a few of
plicit schedule, serving non-real-time processes when the
the systems which share some of the characteristics of our
schedule allows, and focused real-time mode, in which
system.
only real-time processes are run. Focused real-time mode
The Rialto [5] operating system, developed at Microsoft
is useful when KURT is being used as a dedicated real-time
Research, was designed from the beginning to support the
system. When real-time applications share a generic desk-
type of applications that we classify as firm real-time. Ri-
top workstation, KURT’s mixed real-time mode is most of-
alto real-time applications specify their time constraints and
ten used, since it allows both real-time and non-real-time
interact dynamically with the system to achieve their de-
processes to run. When in either real-time mode, real-time
sired scheduling properties. Rialto provides a wide array of
processes can access any of the system services that are nor-
operating system services to its real-time tasks and these are
mally available to non-real-time processes. However, as
accessed through a per-machine resource planner. In a man-
discussed in Section 4.2, the use of different subsystems
ner similar to the one we have employed, Rialto runs the
introduces different levels of scheduling distortion. While
hardware timer as an aperiodic device, allowing for much
many approaches to scheduling can be easily implemented,
finer timing resolution than is typically available in generic
we have found explicit scheduling to be the most appropri-
operating systems. While Rialto has been successful in its
ate for our current applications.
development context, it suffers from two main drawbacks.
One such application is the ATM Reference Traffic Sys- First, it is an entirely new operating system and hence has
tem (ARTS), described further in Section 3. This appli- no existing base of application software. This limits its ap-
cation can record and generate packet-level ATM traffic plicability in production environments. Also, it is a propri-
streams with microsecond accuracy. ARTS uses KURT’s etary system, making it unsuitable for use in many research
scheduling abilities in its traffic generation module by plac- environments, where low cost and access to source code are
ing packet transmission events in an explicit KURT sched- essential.
ule. KURT and closely related approaches are also being Stanford’s SMART system [7] is a real-time sched-
applied in our lab to a range of problems, including syn- uler for multimedia applications, implemented within the
chronized distributed real-time computation, the implemen- Solaris operating system. It uses a weighted fair queu-
tation of a software ATM switch with precise rate control, ing scheme to ensure that real-time tasks meet their dead-
and support for multimedia applications. lines, while at the same time providing acceptable levels of
We believe KURT fills an important gap in the existing responsiveness to non-real-time tasks. It shares with our
spectrum of real-time systems by providing a low cost sys- system the advantage of being implemented inside a full-
tem with fine-grain temporal resolution, capable of satisfy- featured, widely used operating system and thus can be eas-
ing firm real-time performance constraints. However, the ily deployed in production environments. However, it uses
generic Linux services have not been specifically adapted a periodic clock, limiting the timing resolution it can offer.
to real-time execution and are thus sources of scheduling Real-Time Linux (RT-Linux), developed at New Mexico
distortion. Such adaptations are part of the future work we Tech [3], is another system based on the Linux. Instead of
intend to do. In spite of this limitation, KURT has pro- improving the abilities of Linux directly as KURT does, RT-
vided excellent support to our firm real-time applications Linux implements a small real-time executive which runs
for which no other system was as appropriate. In addition, a non-real-time Linux kernel as a completely preemptable,
it provides a well structured environment within which to low-priority task. This approach is similar to the one used at
investigate and resolve the sources of scheduling distortion. the University of North Carolina to allow the IBM Micro-
In the next section we discuss related work in real-time kernel to coexist with a simple real-time kernel on a sin-
gle system [4]. The RT-Linux model requires that real-time 3.1 Implementation of UTIME
applications be split into real-time and non-real-time parts.
The real-time parts run under the real-time executive and In order to increase the resolution of the Linux software
the non-real-time parts under the low-priority Linux kernel. clock, we had to alter the basic mechanism by which it is
Communication between the two environments is supported implemented. In standard Linux, a hardware timer chip is
by lock-free queues and shared memory, but the parts run- programmed to interrupt the CPU at a fixed rate. Each time
ning under the real-time executive cannot access any of the the CPU is interrupted, the kernel updates its software clock
Linux services. to indicate the passing of another tick and checks if there
This approach is interesting and useful for applications are any scheduled events that are due for processing. Thus
fitting the RT-Linux model. It is not, however, appropri- the software clock is nothing more than a running count of
ate for the class of applications KURT addresses, precisely the number of ticks, or hardware timer interrupts, that have
because these applications require a combination of access passed since the kernel was started. The length of time be-
to system services and support for real-time constraints, tween each software clock tick is referred to as a jiffy. Since
though these constraints are often less stringent than those the kernel only checks its list of pending scheduled events
RT-Linux can support. For example, if ARTS were imple- at each timer interrupt, the length of time between interrupts
mented under RT-Linux, then its real-time module would (or the length of each jiffy) is the smallest meaningful unit
have to be able to send an ATM packet into the network. of time with which events can be scheduled. Thus the length
This is not possible, however, because access to the net- of a jiffy determines the kernel’s timing resolution.
working subsystem of Linux is not supported by RT-Linux. A naive approach to increasing the timing resolution
There are also several commercially available systems, would be to simply program the timer chip to interrupt the
including LynxOS [1] and QNX [2], which offer real-time CPU at a higher frequency. This would reduce the length of
performance and a number of services to the applications a jiffy and therefore increase the software clock resolution.
they run. While these systems are attractive from the point However, since the timer chip would regularly interrupt the
of view of features, they are too costly to be used in research CPU, irrespective of whether any events were scheduled to
institutions operating on limited budgets. occur at the time of each interrupt, this approach leads to
unnecessary overhead.
Our solution to the problem of increasing the kernel’s
3 Implementation
timer resolution is based on the following observation: there
is a crucial difference between the temporal resolution and
KURT is based on the Linux operating system, a freely the frequency of events. In other words, even though firm
available, popular Unix clone. Linux was chosen because real-time applications schedule events with microsecond
it enabled us to meet two important design goals. First, we level deadlines, events are rarely scheduled to occur every
wanted our system to be easy to integrate into existing com- microsecond. To support such applications, what is needed
puting environments. In order to achieve this goal, we had is a mechanism by which timer interrupts are allowed to oc-
to target an operating system that people already use. Over cur at any microsecond, not necessarily every microsecond.
the past few years, Linux has grown exponentially in pop- Our system departs from the common practice of using
ularity, leading to the development of a broad software and the timer chip to interrupt the CPU at a fixed rate. Instead,
user base. Also, since low cost was a primary design goal, the timer chip is programmed to interrupt the CPU in time
Linux was an ideal choice as it runs on commercial off-the- to process the earliest scheduled event. When an interrupt
shelf hardware and is distributed without charge. is serviced, the kernel checks its list of pending events to
In order to implement KURT, several changes had to see when the next event is due for processing and programs
be made to Linux. First, its temporal granularity had to the timer chip to interrupt it in time to service that event.
be refined, since many firm real-time applications need to Thus the CPU is interrupted only when it needs to be and
track time at a resolution much higher than that convention- not at regular intervals. In this simple form, our scheme
ally used. In the ARTS application, for example, schedul- eliminates the timer interrupts at which no events are due for
ing resolution on the order of 10 microseconds is required. processing. Since the timer chip can be programmed with
This makes the standard Linux software clock resolution of microsecond accuracy, we effectively achieve microsecond
10 milliseconds (1 millisecond on the DEC Alpha architec- resolution.
ture), and that of most other systems, unacceptable. In addi- In this simple version of our system, the count of ten
tion, the standard Linux timesharing scheduler was unsuit- millisecond jiffies is no longer updated, since there are no
able for firm real-time applications, so we had to implement regular ten millisecond interrupts at which to do so. This
a scheduler that would give firm real-time tasks the prefer- presents a problem since there are several kernel subsys-
ential treatment required to satisfy their timing constraints. tems that assume, both implicitly and explicitly, that the
jiffy counter is being updated at regular intervals. To keep specific modules can be added to a running kernel at any
these systems working, we had to devise a way to reproduce time.
this periodic “heartbeat” in the absence of regular, periodic
interrupts. To do this, we determine the correct jiffy count The module-centric approach used by the KURT sched-
value at each timer interrupt by computing the number of uler lends itself well to many types of real-time applica-
CPU cycles elapsed since boot time. This computation is tions. For example, in the ARTS system described earlier,
performed using the time stamp counter (TSC), a 64-bit reg- we implemented a real-time module that could transmit an
ister that increments at the clock rate of the 200 MHz Intel ATM packet. The ARTS traffic generator then simply con-
Pentium Pro processor used in our test system. sisted of a program that would generate a KURT schedule
When the computed jiffy counter increments, we per- file specifying the times at which to invoke this ATM trans-
form the various activities that are usually done by the stan- mit module, together with a program that would pass this
dard kernel during each timer interrupt. Since our interrupts schedule file to KURT and start the scheduler. The fact
occur with little regularity, we could miss one or more jiffy that the transmit module could run in kernel mode added
boundaries. To overcome this problem, when reprogram- greatly to the effectiveness of our system, because packets
ming the timer chip to trigger the next interrupt in time to could be written directly to the network interface card. If
process the next event, we check to see if that event occurs this application were written as a user-level process, then
after the next jiffy counter increment would have occurred. unpredictable delays would be incurred while copying data
If this is found to be the case, then we schedule an interrupt between user and kernel space and while performing con-
to occur just in time to increment the jiffy counter. This text switches.
introduces some interrupts at which no events are due for
processing, but keeps all kernel subsystems, including the Although applications such as ARTS are well-suited to
software clock, working as normal. The implications of this a real-time system based on kernel modules, there are other
scheme, in terms of system overhead and scheduling distor- applications that work better as a group of coordinated user
tion, are discussed in Section 4. processes that are scheduled in real-time. To facilitate such
applications, the KURT system includes the process mod-
3.2 KURT Scheduler ule. This is a built-in real-time kernel module whose func-
tion is to switch context to a specified user process. A
As discussed earlier, in addition to increasing the tem- schedule file for an application that consists of real-time
poral resolution of Linux, we also had to implement a new user-level processes simply specifies the times at which the
scheduling algorithm for firm real-time applications. To the built-in process module should be invoked and to which
FIFO, round-robin, and normal timesharing scheduling al- user-level process context should be switched. Since, from
gorithms available in standard Linux, we have added the the perspective of the KURT scheduler, the process module
KURT scheduler. This is an explicit plan scheduler, re- is the same as any other real-time module, the schedule file
quiring real-time applications to state explicitly the times for such an application is written in exactly the same format
at which events are to occur. We have also introduced the as that used for an application such as ARTS.
concept of real-time modes, in which those processes that
are marked as using the KURT algorithm are scheduled, Explicit scheduling using schedule files as described
either exclusively (focused real-time mode) or in conjunc- above works well for many real-time applications. How-
tion with non-real-time processes (mixed real-time mode). ever, some applications have periodic execution flows,
When operating in focused real-time mode, normal non- wherein a certain section of code is executed repeatedly at
real-time processes cannot interfere with the timely execu- a fixed time interval. For these applications, explicit event
tion of real-time processes, but the real-time processes still times can be specified, but this approach is not natural. A
have full access to all Linux services such as network pro- more attractive approach is to allow these applications to
tocol implementations and hardware device drivers. specify the length of one period and then be scheduled by
The KURT system consists of real-time kernel modules KURT to run once every period. To accomplish this, a peri-
which perform certain application-specific activities and odic application can switch KURT into periodic mode and
a base system which invokes these modules at scheduled use a system call to specify its period. The application can
times. Applications pass the KURT base system a sched- then use a KURT system call to suspend its execution at
ule file that lists the times at which certain real-time kernel the top of its periodic loop. Once the scheduling is begun,
modules are to be invoked. These modules execute in ker- KURT will allow the application to run and cause the pe-
nel mode and can therefore access devices, as well as other riodic loop to execute. Once an iteration is complete, the
parts of the kernel, in ways that would not be permitted to application should suspend itself once again and wait for
normal user-level processes. Furthermore, new application- KURT to re-activate it for the next iteration.
4 Evaluation
Mean Std. Dev. Min 99% Max
Standard 1.0 s 1.2 s 0.5 s 7.9 s 13.1 s
To evaluate our system, we chose to test each piece in- UTIME 7.3 s 2.8 s 6.3 s 22.5 s 31.7 s
dividually and then test the system as a whole by means of
an application. In this section, we will present the results Table 1. Timer Interrupt Processing Times for
of the tests we ran to measure the overhead of the UTIME Standard Linux and Linux with UTIME
system, the associated clock drift that it introduces, and the
accuracy of the KURT scheduler. In addition, we will show
that these systems worked together to lend the ARTS traffic
generator a very high degree of accuracy, as evidenced by dard Linux, the count of ten millisecond jiffies is the pri-
tests performed using an external network analyzer. mary means by which the kernel tracks time. Unfortu-
nately, the assumed jiffy length is rarely correct, because
4.1 UTIME Tests the hardware timer chip has a finite resolution and the small-
est value by which it can be incremented usually does not
As stated in section 3.1, running the hardware timer as an divide evenly into ten milliseconds. The accumulation of
aperiodic device allows the UTIME system to achieve sig- error due to the imprecision in the jiffy length causes the
nificant gains in temporal resolution without dramatically software clock to drift over time. Since timer interrupts do
affecting the system overhead. Since most of the UTIME not occur at regular intervals in UTIME, a different method
implementation centers around changes to the Linux timer is employed to update the jiffy counter. At each interrupt,
interrupt handler, comparing the processing time of a timer a TSC reading is taken and used to compute the number
interrupt under UTIME with that of a timer interrupt in stan- of cycles elapsed since boot time. Using the pre-computed
dard Linux gives a quantitative measure of the overhead re- number of cycles per second, the number of elapsed cycles
sulting from UTIME. is converted into time and used to update the jiffy counter
We measured the processing time of timer interrupts us- appropriately.
ing the TSC, described in Section 3.1. Approximately 8000 It would seem that this method would be more precise
timer interrupts were measured, first on standard Linux and and hence lead to less clock drift than is observed in stan-
then on Linux with the UTIME modifications applied. Ta- dard Linux, but this is not the case. As the lines labelled
ble 1 shows the results. Without UTIME, timer interrupts “UTIME” and “Standard Linux” in Figure 1 show, the two
take 1 microsecond to process on average and virtually all systems show similar clock drift. This is explained by the
take less than 8 microseconds. With UTIME in place, the fact that even though UTIME uses the more accurate TSC
average timer interrupt requires just over 7 microseconds of to track time, it still uses the timer chip at boot time to de-
processing time and 99% of all timer interrupts require 22.5 termine the number of CPU cycles per second and thus cal-
or fewer microseconds. It should be noted that the times ibrate the TSC.
described here do not include the time required to process
0.05
any scheduled events: the timer interrupt handler simply
checks which events are due for processing and marks them 0
Adjusted UTIME

as such. Standard Linux and UTIME with NTP

The exact value of the timer overhead is less important


than the fact that it is greater under UTIME than under stan-
Deviation (seconds)

dard Linux. This increase can be attributed to the fact that


timer interrupts in UTIME do not occur at regular inter-
vals and therefore some amount of extra computation is re- UTIME

quired in the handler to determine the new value to load


Standard Linux
into the timer chip to trigger the next interrupt. This is not
the case in standard Linux because the timer chip is simply
programmed, during system boot-up, to interrupt the CPU
at a fixed rate. Even though the actual time required to pro-
0 2 4 6 8 10 12 14
cess timer interrupts using UTIME increases, this penalty is Hours

incurred at most once every 10 milliseconds if no microsec-


ond events are scheduled. Thus, the overhead presented by Figure 1. Clock Drift
the UTIME modification is, on average, about 0.073%.
In addition to affecting the system overhead, the UTIME In our lab we use XNTP, an implementation of the Net-
modifications also affect the software clock drift. In stan- work Time Protocol (NTP) and associated tools to main-
100

Accumulated Deviation 90

Machine A 145.0ms
80
Machine B -137.8ms
Machine C -235.4ms 70

60

% of events
Table 2. 14-Day System Clock Deviation Using
50
Adjusted UTIME
40

30

20
Focused: Kernel Module
tain clock synchronization among workstations [6]. This 10
Focused: User Process
Mixed: Kernel Module
Mixed: User Process
works equally well for both unmodified Linux and UTIME
0
as shown in Figure 1. These lines lie essentially on top of 0 10 20 30 40 50 60 70 80
Difference between scheduled and actual event time (microseconds)
90 100

one another and appear to be a single line labeled “Stan-


dard Linux and UTIME with NTP”. As the figure shows, Figure 2. Distribution of Differences between
the clock drifts initially, but once NTP begins to take effect, Scheduled and Actual Event Times
the deviation is soon corrected. The line labelled “Adjusted
UTIME” in Figure 1 shows the clock drift in a UTIME sys-
tem where the number of cycles per second is adjusted to
the correct value using an external reference instead of the that a small percentage of events are still substantially late.
timer chip. The figure shows that in this case, the clock This is most likely caused by interrupt service routines ex-
drift is minimal over the 14-hour testing period. This illus- ecuted on behalf of non-real-time system services and pro-
trates that with proper calibration, our method of updating cesses in mixed real-time mode, which block interrupts for
the jiffy count using the TSC introduces very little accumu- various periods of time. The fact that the distortion is in-
lated clock deviation. creased under the mixed real-time mode supports this hy-
To further investigate this point, we monitored the pothesis.
amount of deviation in the software clocks of three different The scheduler’s performance, illustrated in Figure 2, can
UTIME machines over a 14-day period. These machines all be improved by trading accuracy for event service over-
ran the version of UTIME in which the number of cycles per head. For example, consider the statistic from Table 3 stat-
second was calibrated accurately against an external refer- ing that 99.5% of kernel module events occur within 19 mi-
ence, as described above. The results shown in Table 2 indi- croseconds of their scheduled times. In order to make these
cate that the accumulated deviation is minimal, amounting 99.5% of kernel module events occur within a few (3 to 5)
to less than one-half second per month. microseconds of their scheduled times, we could schedule
them 19 microseconds early and then busy-wait, monitor-
ing the TSC, in the case of events requiring less time than
4.2 KURT Scheduler Tests
19 seconds to be dispatched. Slightly less waiting will be
required if the cutoff point is chosen below 99.5%, but in
To test the effectiveness of the new firm real-time any case, this method introduces idle cycles into the event
scheduling modes, we measured the difference between the service overhead. This might be a worthwhile design trade-
times at which real-time kernel modules were scheduled to off, however, for applications with scheduling constraints
be invoked and when they were actually invoked. Figure 2 more stringent than their utilization constraints.
summarizes the results of 10,000 such measurements. As In order to characterize the magnitude and source of the
mentioned in Section 3.2, some real-time applications use distortion introduced by blocked interrupts, we measured
the built-in process module to schedule user processes. As a the lengths of the time periods during which interrupts were
reflection of the effectiveness of KURT in scheduling these disabled in the various subsystems of a standard Linux ker-
processes, Figure 2 also shows the distribution of differ- nel running under heavy disk load . The distribution of the
ences between scheduled process module invocation times lengths of these periods is shown in Table 4. It should be
and the times at which the appropriate user processes began noted that these numbers may vary substantially with the
running. hardware configuration. They also vary with the load and
The tests were performed in both focused and mixed the amount of stress that it places on the various kernel sub-
real-time modes. Table 3 shows the values below which
99.5% of the differences between actual and scheduled These tests were performed on an 200 MHz Intel Pentium Pro
times fell. The maximum value in each category indicates machine
application were rejected by the KURT scheduler, since it
Kernel User would not have been able to meet the resulting timing de-
Mode 99.5% Max 99.5% Max mands. Figure 3 shows the distribution of differences be-
Focused 19 s 192 s 35 s 210 s tween the desired and actual execution periods. As can be
Mixed 44 s 590 s 81 s 793 s seen, the Linux FIFO scheduler introduces essentially an
order of magnitude more scheduling variation than does the
Table 3. Differences Between Scheduled and KURT scheduler and degrades significantly with increased
Actual Event Times Using KURT load. The KURT scheduler shows almost no degradation in
performance when the number of concurrent executions is
raised from 10 to 30. This is evident from the fact that the
lines for these two cases lie almost exactly on top of one
Subsystem Min Mean Max another.
Disk 0.35 s 6.50 s 407.62 s 100

Memory 0.34 s 0.60 s 10.31 s


90
Network 0.33 s 0.37 s 3.26 s
Process 0.33 s 1.11 s 43.66 s 80

Timer 0.35 s 2.33 s 52.98 s 70

TTY 0.34 s 0.60 s 8.79 s


60
Other 0.33 s 0.39 s 82.61 s

% of events
50

Table 4. Distribution of Intervals During Which 40

Interrupts Were Disabled in a Standard Linux


30
Kernel
20

10

0
0 0.2 0.4 0.6 0.8 1
systems. Also, it is important to observe that the maximum Difference between desired and actual periods (milliseconds)

values shown in Table 4 do not represent an upper bound


on the scheduling distortion introduced by blocked inter- Figure 3. Performance of the FIFO and KURT
rupts because several blocking periods can occur one after Schedulers Executing Periodic Processes
another with little or no spacing between them. However,
they do show that most interrupts are relatively short, and
that the disk driver is the most immediate area for further
investigation. 5 Conclusions and Future Work
As a further test of the scheduling quality, we used a
hardware ATM cell analyzer to observe traffic streams gen- With the increasing popularity and availability of multi-
erated by ARTS. The observed packet interarrival times media and high-speed networking, a new class of applica-
closely resembled those that ARTS was told to generate. tion software has emerged. The applications in this class
In fact, with a packet scheduled for transmission every 500 require many of the services offered by generic timesharing
microseconds, 99.7% of all packets arrived within 1% of or soft real-time operating systems, but have timing con-
their scheduled times. straints characteristic of hard real-time applications. Appli-
To test the KURT scheduler’s periodic mode, we wrote a cations of this nature cannot be described as either hard or
KURT application that was supposed to run once every 10 soft real-time, so we have chosen to call them firm real-time
milliseconds. We also wrote a version of this application applications. In addition to the unique computing require-
that would use only the timing provided by standard Linux ments presented by firm-real time applications, many are
running its FIFO scheduler (which claims to offer soft real- developed and used under significant budgetary constraints,
time performance). By comparing the effectiveness of these precluding the use of expensive commercial hard real-time
two applications with respect to the actual length of time operating systems to support them.
between executions, we were able to evaluate the gains in We have developed the KURT system, based on the well-
scheduling accuracy provided by KURT. known and widely-used Linux operating system that offers
Tests were performed in the KURT and non-KURT cases a broad range of services to the applications it runs. We
using first 10, and then 30 concurrent executions of the ap- were able to increase the temporal resolution of Linux with-
plication. Beyond 30, new attempts to invoke the periodic out causing a significant increase in system overhead. The
new scheduler that KURT adds to Linux is able to achieve [6] D. L. Mills. Internet Time Synchronization: the Network
high levels of scheduling accuracy and can coexist with the Time Protocol. IEEE Transactions on Communications,
other currently available schedulers. As evidenced by the COM-39:1482–1493, October 1991.
ARTS application, which makes use of existing ATM net- [7] J. Nieh and M. Lam. The Design of SMART: A Sched-
uler for Multimedia Applications. Technical Report CSL-TR-
working services offered by Linux, the changes we made do
96-697, Computer Systems Laboratory, Stanford University,
not prevent firm real-time applications from using the exist-
June 1996.
ing operating system services. For these reasons, KURT [8] B. Srinivasan. A Firm Real-Time System Implementation Us-
successfully transforms Linux into a firm real-time operat- ing Commercial Off-The-Shelf Hardware and Free Software.
ing system. In addition to the ability to support firm real- Technical Report 11510-02, Information and Telecommuni-
time applications, our system has the added advantage of cation Technology Center, University of Kansas, February
low cost, since it runs on commercial off-the-shelf hardware 1998.
and is based on free software.
As the evaluation shows, KURT was able to demonstrate
firm real-time scheduling capabilities, although limitations
remain, in the form of sources of scheduling distortion. It
should be noted, however, that the frequency of distortions
in our system is low and falls well within the limits appro-
priate to a number of interesting applications. Since most
distortions occur because the generic operating system ser-
vices made available to applications by KURT often intro-
duce unpredictable delays, developers need to experiment
and discover which kernel subsystems are suitable for use
in their applications.
Future work will include investigations into sources of
scheduling distortion that degrade real-time scheduling ac-
curacy. The kernel sub-systems that are found to gener-
ate this latency might have to be re-designed to work more
predictably. The disk driver subsystem is the obvious first
choice for this. We will explore the use of alternate schedul-
ing methods within the KURT framework and intend to use
the system as the foundation for development of a real-time
ORB. It is also interesting to consider how the methods used
to implement KURT might be combined with those used for
RT-Linux to produce a system capable of supporting and
even wider range of applications.

References

[1] LynxOS - Hard Real-Time OS Features and Capabilities.


WWW: http://www.lynx.com/products/ds lynxos.html. Ob-
tained November 28, 1997.
[2] QNX Realtime OS.
WWW: http://www.qnx.com/product/qnxrtos.html. Obtained
November 28, 1997.
[3] M. Barabanov and V. Yodaiken. Introducing Real-Time
Linux. Linux Journal, Issue 34, February 1997.
[4] G. Bollella and K. Jeffay. Support for Real-Time Computing
Within General Purpose Operating Systems. In Proceedings
of the IEEE Real-Time Technology and Applications Sympo-
sium, pages 4–14, May 1995.
[5] M. Jones, J. Barrera III, A. Forin, P. Leach, D. Rosu, and
M. Rosu. An Overview of the Rialto Real-Time Architec-
ture. In Proceedings of the Seventh ACM SIGOPS European
Workshop, pages 249–256, September 1996.

You might also like