Sections
A Real Time Operating System is an operating system tailor made for giving quick responses in real time applications. RTOS is not characterized by the volume of work it can perform in a given time interval but rather the consistency in the time taken to do it. This makes them very predictable and their predictability is their value.The focus on consistency can be misleading. Even though RTOS based systems are expected to be consistent and there is less emphasis on throughput they are also expected to respond quickly. They must generate results in time short enough to produce an impact of those results on the environment they are controlling.
Structure of RTOS
Real Time Operating System are classified into two based on their predictability. Every process has a deadline before which it must be finished. If an RTOS is able to to it more often than not it is called a soft RTOS. If it meets the deadline invariably deterministically it is called a hard RTOS.
A task is a logically complete execution path through a user program demanding the use of system resources. Many real time operating system support multitasking so that the processor does not remain idle during I/O operations as in the case of single task. In a multitasking environment the CPU control is provided by the RTOS task scheduler. Tasks operate asynchronously but may engage in inter-task communications.
Tasks Enviornment in RTOS
Task switching used to be a very resource hungry process that consumed many CPU clock cycles in the early real time operating system developed. This limited the use of task switching. For this reason RTOS designs do not allow unnecessary task switching.
RTOS have two types of designs based on task switching – event driven and time sharing. Event driven designs switch tasks only when a task of higher priority needs to be serviced. This is called preemptive priority or priority scheduling. Time sharing designs switch tasks only on clocked interrupts or events. This is called round robin.
The predictable nature of RTOS provides a very narrow set of applications and calls for a strict scheduling. Tasks have states – running, ready and blocked. Most of the time there are most number of tasks with blocked state than on the ready or running states. In the case of multi-core systems there can be multiple number of tasks running at a time but they shall all be of the highest priority.
Tasks States in RTOS
In RTOS processes are either event driven or initiated on a time sharing basis. This relieves the user from the burden of frequent intervention for rescheduling. There are provisions though, to intervene in the flow of execution. A user can do this in two ways – system calls and task calls.
System calls are generally user requests to perform I/O operations. Task calls allow users to perform task management functions. These calls are issued as program instructions. In this manner RTOS satisfies requests received from users as user programs.
RTOS permits the real time application to stand suspended and offer the control to a user device handler on the occurrence of interrupts. A user can define interrupt service routines using system calls. The device handler can send messages to user program allowing influence of external events on the real time application.
RTOS allows suspension of currently executing programs and giving control to an interrupt service. This hand over of control does not occur immediately but rather only after the type of interrupt is determined. Interrupts can originate from three sources – standard or system devices, user devices and high priority devices.
The standard devices are the ones for which RTOS provides interrupt services. They may be extended during the process of system generation by which RTOS is made to adapt to the requirements of a specific application. User devices are non-standard devices that are not announce during system generation.
The high priority devices are the ones that require the shortest time for carrying out interrupt services. They often generated critical system related interrupts like in the case of providing auto-restart feature. The user can specify devices as high priority by specifying them at the time of system generation and writing special interrupt service routines.
Input/Output operations are a very key part in ensuring proper responsiveness of real time operating system. I/O devices are generally slower than the system much of their operations are minimized by introducing computations wherever possible. This increases throughput, efficiency and saves CPU time.
Due to factors peculiar to the RTOS several features of modern non-real time operating system cannot be included with it. RTOS based systems are expected to work without any need for reboot. This calls for more meticulous approach to memory allocation and management. There should not be memory leaks leaving some allocated memory unused and not usable any more. For this reason RTOS seldom allow dynamic memory allocation.
RTOS also have to take memory fragmentation into consideration. Frequent allocation and release of available memory may leave it fragmented and unsuitable for contiguous allocation of large blocks. This is not ideal for RTOS because it is exhibition of a very uncharacteristic behavior. RTOS also cannot afford the time consumed for memory allocation by scanning linked lists of indeterminate lengths.
A solution to this limitation is the use of memory pools or fixed-size blocks allocation. By this method memory locations are preallocated into several blocks of the same size. An example for such memory pooling is the Transaction Processing Facility(TPF) used by the real time operating system by IBM. TPF is very much capable of handling enormous memory blocks without compromising on performance.
1. User programs are relieved from several critical tasks.
2. Parallel processing
3. Inter-task communication
4. Users can add device handlers and define high priority interrupts
There are several examples of real time operating system. QNX and Lynx are Unix -like operating systems. Free RTOS is an open source RTOS licensed under GPL2 that supports a long list of chips. RTLinux is a real time Linux operating system. There are many other real time operating systems that are licensed under GPL, MIT License and many that are proprietary.
Sections