Linux And Real Time

Major Concerns of selecting RTOS

1) Interuppt latency
2) Footprint (size of the executable which is generated
after compiling)
3) Context switching time is also considered as vital
element in selection

Linux and Real Time

Linux is built as a general-purpose multiuser operating system. General-purpose operating systems are tuned to maximize average throughput even at the expense of latency, while real-time operating systems attempt to minimize, and place an upper bound on, latency, sometimes at the expense of average throughput. There are several reasons why standard Linux is not suitable for real-time
use:

  • Non-preemptive kernel procedure – This is a fancy way of saying that kernel system calls are not preemptible. Once a process enters the kernel, it can’t be preempted until it’s ready to exit the kernel. If an event occurs while the kernel is executing, the process waiting for that event can’t be scheduled until the currently executing process exits the kernel. Some kernel calls, fork() for example, can hold off preemption for tens of milliseconds.
  • Paging – The process of swapping pages in and out of virtual memory is, for all practical purposes, unbounded. We have no way of knowing how long it will take to get a page off a disk drive and so we simply can’t place an upper bound on the time a process may be delayed due to a page fault.
  • Fairness in Scheduling – Reflecting its Unix heritage as a multi-user time-sharing system, the conventional Linux scheduler does its best to be fair to all processes. Thus, the scheduler may give the processor to a low-priority process that has been waiting a long time even though a higher-priority process is ready to run.
  • Request Reordering – Linux reorders I/O requests from multiple processes to make more efficient use of hardware. For example, hard disk block reads from a lower priority process may be given precedence over read requests from a higher priority process in order to minimize disk head movement or improve chances of error recovery.
  • Batching – Linux will batch operations to make more efficient use of resources. For example, instead of freeing one page at a time when memory gets tight, Linux will run through the list of pages, clearing out as many as possible, delaying the execution of all processes.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License