P
Hello All,
This is an incomplete and simplified overview of options for real time linux as it would apply to the LinuxPLC. Please see http://www.realtimelinux.org for
links to much more detailed information.
*Problems with Periodic Tasks in the Normal Linux Kernel*
1. Linux has system calls to suspend a process for a given time period, but there is no guarantee that the process will be resumed as soon as this time interval has passed.
2. Any user process can be pre-empted at an unpredictable moment.
3. Assigning high priority to critical tasks doesn't help much since Linux has a "fair" time-sharing scheduling algorithm. See 5 below.
4. Under Linux, virtual memory can be swapped out to disk at any time and swapping back into RAM takes an unpredictable amount of time. See 5
below.
5. Linux now has POSIX style system calls for soft real-time tasks. Virtual memory can be locked in RAM, and the scheduler policy can be changed to a priority based policy.
6. Linux disables interrupts in critical sections. Tasks running in kernel mode cannot be scheduled out. The disk subsystem can delay user tasks by unpredictable amounts of time by disabling interrupts.
7. Processes can be set to SCHED_FIFO to give them soft real-time characteristics. This
may be enough for 20 - 30 ms periodic tasks (scan times).
8. Linux has low granularity timers (10 ms).
*Real Time Linux (NMT's RTLinux)*
1. RT Linux is a small, simple, real time OS that runs Linux as a low priority task. Changes
to the Linux kernel are minimal.
2. Real Time tasks can be scheduled precisely. On a P120 system a task can be scheduled with
under 20 uS precision.
3. RT Linux uses kernel modules and Linux can dynamically load and unload them just like normal
kernel modules.
4. RT Linux tasks CANNOT use Linux system calls or directly call routines and access linux data
structures in the linux kernel.
5. Users can write their own schedulers as loadable kernel modules.
6. RT Linux can communicate to linux user processes through FIFOs or shared memory.
7. RT Linux is considered to be hard real time.
*KU Real Time Linux (KURT)*
1. KURT is a modification to the linux kernel which adds microsecond timing and three modes to
the kernel.
2. (A)Normal Mode behaves like the normal linux kernel (with microsecond resolution). (B)Focused
Real Time Mode where only designated real time processes are allowed to run.
(C)Mixed Real Time
Mode where all processes are allowed to run with real time processes being explicitly scheduled and
normal processes running in the constraints of the real time processes.
3. In either Focused or Mixed Real Time Modes the real time processes can still access any of the
system services of the linux kernel.
4. Real Time tasks are kernel modules and execute in kernel mode. There is a rtmod_cmd system call
to allow user processes to directly communicate with a real time module. This system call is
similar to the *NIX ioctl.
5. There is a built in real time module called Process RTMod that switches context to a specific user mode process when invoked. This allows real time user processes! There is some overhead with a context switch, but the advantage is that you can make your user process real time.
6. A process can be scheduled periodically without an explicit schedule. This would be applicable to a scanned system.
*Other Real Time Linux Projects*
1. ART Linux - documentation is in Japanese so I'm not sure how it fits in.
2. RED Linux - heavy modification to the Linux Kernel and very early in the development stages.
3. RTAI - based on RT Linux, but adds POSIX type calls, etc.. see the link at realtimelinux.org
Phil Covington
vHMI
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
This is an incomplete and simplified overview of options for real time linux as it would apply to the LinuxPLC. Please see http://www.realtimelinux.org for
links to much more detailed information.
*Problems with Periodic Tasks in the Normal Linux Kernel*
1. Linux has system calls to suspend a process for a given time period, but there is no guarantee that the process will be resumed as soon as this time interval has passed.
2. Any user process can be pre-empted at an unpredictable moment.
3. Assigning high priority to critical tasks doesn't help much since Linux has a "fair" time-sharing scheduling algorithm. See 5 below.
4. Under Linux, virtual memory can be swapped out to disk at any time and swapping back into RAM takes an unpredictable amount of time. See 5
below.
5. Linux now has POSIX style system calls for soft real-time tasks. Virtual memory can be locked in RAM, and the scheduler policy can be changed to a priority based policy.
6. Linux disables interrupts in critical sections. Tasks running in kernel mode cannot be scheduled out. The disk subsystem can delay user tasks by unpredictable amounts of time by disabling interrupts.
7. Processes can be set to SCHED_FIFO to give them soft real-time characteristics. This
may be enough for 20 - 30 ms periodic tasks (scan times).
8. Linux has low granularity timers (10 ms).
*Real Time Linux (NMT's RTLinux)*
1. RT Linux is a small, simple, real time OS that runs Linux as a low priority task. Changes
to the Linux kernel are minimal.
2. Real Time tasks can be scheduled precisely. On a P120 system a task can be scheduled with
under 20 uS precision.
3. RT Linux uses kernel modules and Linux can dynamically load and unload them just like normal
kernel modules.
4. RT Linux tasks CANNOT use Linux system calls or directly call routines and access linux data
structures in the linux kernel.
5. Users can write their own schedulers as loadable kernel modules.
6. RT Linux can communicate to linux user processes through FIFOs or shared memory.
7. RT Linux is considered to be hard real time.
*KU Real Time Linux (KURT)*
1. KURT is a modification to the linux kernel which adds microsecond timing and three modes to
the kernel.
2. (A)Normal Mode behaves like the normal linux kernel (with microsecond resolution). (B)Focused
Real Time Mode where only designated real time processes are allowed to run.
(C)Mixed Real Time
Mode where all processes are allowed to run with real time processes being explicitly scheduled and
normal processes running in the constraints of the real time processes.
3. In either Focused or Mixed Real Time Modes the real time processes can still access any of the
system services of the linux kernel.
4. Real Time tasks are kernel modules and execute in kernel mode. There is a rtmod_cmd system call
to allow user processes to directly communicate with a real time module. This system call is
similar to the *NIX ioctl.
5. There is a built in real time module called Process RTMod that switches context to a specific user mode process when invoked. This allows real time user processes! There is some overhead with a context switch, but the advantage is that you can make your user process real time.
6. A process can be scheduled periodically without an explicit schedule. This would be applicable to a scanned system.
*Other Real Time Linux Projects*
1. ART Linux - documentation is in Japanese so I'm not sure how it fits in.
2. RED Linux - heavy modification to the Linux Kernel and very early in the development stages.
3. RTAI - based on RT Linux, but adds POSIX type calls, etc.. see the link at realtimelinux.org
Phil Covington
vHMI
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc