Introduction:
Real time systems can be divided into two categories, the hard real time system and the soft real time system. RT-Linux(hard real time system) uses another kernel beneath Linux kernel and the new kernel handles the real time event only. It has some disavantages because the process can not use any of the Linux services. The other type is soft real time system (POSIX 1003.1b), which provide the system call to achieve the real time task in the non-time-critical situation. It has the problem of accuracy. The combination of these two system, firm real time system, is proposed to have the benefitions of these two systems. For example, KURT (Kansas University Real Time) Linux , is the one that takes advantage of all the utilities of Linux and has the desired accuracy of hard real time system. In this project, we want to compare the mechanism between the hard real time and firm real time system using certain multimedia application. In this kind of application, resources other than linux kernel are needed and the requirement of time-accuracy can be an option depends on different usage. We choice the video player finally as our plateform because of the following reasons:We choice kernel 2.2.0 with RT-Linux releaseDpatch as the plateform for the hard real time system and kernel 2.1.126 with kert-v1.23.126 as the plateform for the firm real time system. The detailed implementatoins of these two sytems are described below.
- It reads the data from the external hardware device. The drivers for this device can be treaed as module. Then we can modify these modules to satisfiy the real time requirements
- Video4Linux driver is combined with linux after kernel 2.2.0. It's a new field and contains interesting topics as for as the kernel is concerned.
RT Linux
- Mechanism
- Communication between real-time task and non-real-tme task
- bttv (kernel side)
- xawtv (application)
- RT-Linux HOWTO
KURT Linux
- Mechanism
The KURT separate the scheduling and actual execution into two different entities. This framework makes the kernel having more flexibility to scheduling between real time task and normal tasks.
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.- Scheduling
To enable the real time kernel in the KURT Linux system, the main actions to be executed are as following:
- Register the application: get the rt_id from the kernel
- Write the schedule file: schedule these applications according to their rt_id and then pass these rt_id to process 0, which is reponsible for the framework of scheduling
- Transfer the kernel to the real time kernel.
- KURT Linux HOWTO
Comparison
- Comparability
- Application property
Conclusion
HOWTOs
- RT-Linux HOTWO:RT-Linux right now has release two versions for kernel 2.0.26 (release1.1) and 2.2.0 (releaseDpatch), respectively. releaseD is not completed yet, it only provided basic scheduling mechanism. Becase of using video driver, kernel 2.1.0 or above is required ( the author of the vider driver mentioned that 2.0.34 is enough for bttv, but in fact 2.0.x can't compile succussfully with bttv driver). Thus we choice patchD with linux kernel 2.2.0.
- Installation
- Assumed kernel 2.2.0 is installed, link /usr/src/linux to the directory containing kernel 2.2.0
- Get the releaseDpatch.tar.gz, type " tar xvfz releaseDpatch.tar.gz" under /usr/src
- type "cd linux; patch -p1<../patchD;
- compile the kernel with RT-Linux patched: make dep;make clean;make bzImage
- add the new kernel entity to the lilo configuration file.
- make the scheduling module: rtl_sched (under /usr/src/rtlinux/ schedullers). In order to do so, you need to copy the head files (/usr/src/rtllinux/include/*.h & /usr/src/rtlinux/schedulers/x86/*.h ) to the proper positions and modify the files pointed to those files.
- install the module rtl_sched in rc.local or load it everytime before running the xawtv.
- Trouble shouting
- lost jiffies: In my machine at home ( Cyrix 6x86, 32MB mem., with the kernels mentioned above), I encounter the following problem: after the RT-Linux kernel is booted up, if the PC speaker is triggered ( either by hitting in-precise key and then use tab to search all possible candidates or shutdown the system, and etc.), the screen will keep showing " lost jiffies" and then the whole system is dead. The only way to reboot the system is power off. And then the system is shutdown incompleted. My file system is dead once owing to too many times of incomplete shutdown.
Reason: The reason of showing "lost jiffies" from the kernel is because some process spends time, say t, between disable and enable the interrupt. If t is longer than the reguler inturrupt by the system clock (irq 8, 10 ms. in intel CPU), then this process will cause the error of the system clock . Thus the kernel will launch this warnning message. I figure out everytime the PC speaker is triggered, then the system is dead. It's not a probem without real time kernel patched.
Solution: After asking for help from the authors, dejanews, and UMBC-LUG. One guy from UMBC-LUG did suggest a way to remidy the problem and it did work. (The author did reply also, he just suggest me to change to releast1.1 and said this is the beta version :<). The solution is to disable the PC speaker from the kernel, modify the file in /usr/src/linux/driver/char/vt.c find the key word: mksound and comments the part from cli()to teh sti() part in that function.- KURT Linux HOWTO
- Installation
- Again, owing to the bttv drivers, linux kernel must be above 2.1.x. The kurt system support linux kernel 2.1.105, 2.1.107, 2.1.126. After trying all these kernels, 2.1.105 and 2.1.107 didn't work with kurt kernels. Thus kernel 2.1.126 is selected.
- Trouble shouting
- You can look up the directory: /proc/rt to observe the stats of the real time kernel. There are several problems I found in this version.
- The kernel_mode file always show NORMAL_MODE even though the kernel is transferred to real time mode
- In the function call:switch_to_rt() with SCHED_KURT_PROCS options, only the process registered as SCHED_KURT is allowed to be executed. But in this version, these process did have highest prioriety but when other processes (non-real-timeprocess) are executed, they both share the resources. This is different from what the authors declaim
- In compiling the kernel, the files about soundcard modules need are not completed (kernel 2.1.* are all experimented, I think that's the reason). Reference to the kernel 2.2.0, it's easy to remidy these problems.
- In the bttv drivers, the msp3400.c using function call not provided in linux kernel 2.1.126. Again, by modifing the parameters in the function call, finally kernel 2.1.126 is happily worked with bttv drivers. And it also means the bttv drivers can't be shared between linux kernel 2.2.0 and kernel 2.1.126.
Reference
Documents
- video4linux ( more advance: video4linux2 )
Sites