What Makes A Real-Time Operating System?


Two basic areas separate real-time operating systems from non-real time operating systems — task scheduling and fast response to external events. A real-time program requires an operating system that guarantees a maximum response time to external events. The key to fast servicing of interrupts is the pre-emption of currently executing tasks, including those tasks that are active within system calls. UNIX allows the system kernel to be interrruped, but it cannot be pre-empted while performing a system call. MS-DOS BIOS calls can be interrupted, but the system code is not reentrant. (Two concurrent tasks cannot make the same system call). Even in real-time systems, response time is hard to measure. Instructions vary in execution time and portions of the operating system may lock out interrupts during critical sections.

The other basic difference is task scheduling. UNIX uses a time-sharing task scheduler that changes priorities of tasks so that system resources are shared fairly among users. A real-time task scheduler does not change task priorities. Task priorities are set by the user and remain set, so an infinite loop running at higher priority than a shell or login task cannot be interrupted and will never end.

A real-time system also requires a set of system facilities for efficient inter-process communication and task control. The operating system must provide facilities for creating and deleting tasks, setting priorities, synchronizing, and sharing information.

The DIAL Lidar project uses the LynxOS operating system from Lynx Real-Time Systems. The LynxOS system is based on UNIX but was completely rewritten to support real-time programming. The time-sharing task scheduler was replaced with a real-time scheduler, and the kernel was rewritten to allow pre-emption and to be reentrant. System V communication facilities provide inter-process communication, including semaphores, shared memory, message queues, signals, and pipes.