Example Programs:

KURT comes with sample programs which can be found in the user_progs subdirectory of the distribution. These sample programs are described below:


KURT Examples

All these programs should be run in the KURT/user_progs directory of the distribution.

Explicit Scheduling of User Processes Using a Schedule File

This sequence of commands will create a periodic schedule, switch the kernel to real-time mode, and schedule a particular process according to the created schedule. The scheduled process would go into a loop, suspending itself at the beginning of the loop and collect timestamps when it is woken up.

    make_sched 1000 0 100 1 sched.bin

This creates a schedule file, called sched.bin, which has a schedule for 100 KURT events. Each of these events would be 1000 microseconds apart. These events are for the RTMod 0 which is the process module which switches context to a particular process. The data that is passed to this module is 1, which is the rt_id of the process that should be woken up.

     proc 1

This starts a process which registers itself as a KURT process with rt_id 1. It enters a loop, suspending itself and collecting a timestamp whenever it wakes up. When this is started, proc will suspend without doing anything.

In a different shell, run rt_test:

     rt_test sched.bin rt-2 from_mem 3 1

This starts a scheduling process which waits for at least two real-time processes to register themselves (this includes rt_test itself). Once the processes are registered, it asks the kernel to schedule the events in sched.bin using the RT_FROM_MEM (i.e. it reads the entire schedule into memory before starting the schedule). The schedule is repeated three times and then the statistics about the real-time process with rt_id 1 is printed out.

Explicit Scheduling of Periodic User Processes without Using a Schedule File

The periodic example program performs a similar operation, using only a single command:

     periodic 1 600 300 1 ./ rt-2 1000

This forks off one child process which registers itself as a KURT process with rt_id 1, processing requirement of 600 microseconds and a period of 1000 microseconds. The parent then switches the kernel to real-time mode 2 (in which all processes are allowed to run, but KURT processes are explicitly scheduled) and then waits for the child process to exit. The child process goes into a loop, suspending at the beginning of the loop and then collects a timestamp when it is woken up. This timestamp is written to a file pid_rt_2.timing where pid is the PID of the process. As can be seen in this example, there is no need to run a separate scheduling process like rt_test.

Note on Using Real-Time Mode 1

Please be sure that if you are running real-time mode 1 then rtd is running. rtd marks a set of required processes as real-time. This set of processes is specified in a configuration file, rtd.conf.

     rtd rtd.conf

Other User Programs

In addition to the above user programs, there is run_rt which allows the user to run any application as a KURT process. For example, to run bash as a KURT process, use:

     run_rt bash

KURT @ ITTC
Last modified: Fri Mar 24 13:01:37 CST 2000

Home Up