Thursday, January 3, 2008

What is a Real Time System (RTS)?

Real Time system does not mean a "fast" system. It means the system should respond to a worldly-event reliably and predictably. For example:

  1. When an elevator reaches a floor, an event is generated. In response to this event, the system should stop the elevator immediately. If the system responds to this event late, the elevator would stop halfway. In this case, the timing is critical. If the system is very fast, but does not confirm to timing-contracts, it would not serve the purpose.
  2. Another example is 'Anti-braking System (ABS)' in a car. When a wheel is locked, the system must respond to it by releasing it in timely manner. Any delay may have dangerous outcome.

A system is said to be real-time if the total correctness of an operation depends not only upon its logical correctness, but also upon the time in which it is performed. One of the definition (I found on Internet) is:

"A real-time system is one in which the correctness of the computations not only depends upon the logical correctness of the computation but also upon the time at which the result is produced. If the timing constraints of the system are not met, system failure is said to have occurred."

Most of the real-time systems are low level applications to control the physical hardware.

Hard and Soft Real Time System

In real time system, the time constraint is the one of the most important factor. In some applications, the time constraint is not flexible. Any minor deviation from the time constraint is considered as failure. This type of system is called Hard Real Time System. For example, a car engine control system is a hard real-time system because a delayed signal may cause engine failure or damage. Other examples of hard real-time embedded systems include medical systems such as heart pacemakers and industrial process controllers.

There are other scenarios where some latency is acceptable, which are called Soft Real Time System. Example: the software that maintains and updates the flight plans for commercial airliners. These can operate to a latency of seconds. Live audio-video systems are also usually soft real-time; violation of constraints results in degraded quality, but the system can continue to operate.

Components to implement a Real Time System

  1. Operating System: The operating should support real time processing. It provides all the facilities to build a real-time application. It is a multi-tasking operating system and guarantees that the deadlines are met.

    VxWorks, QNX are few examples of operating system. Windows XP is not a real-time operating system. Through, there are few third party plug-ins, which are plugged into Windows XP to provide real-time facilities.

    If an application is developed & deployed on a real time operating system, it does not mean that the application is real-time. The application must be designed in a proper way to provide real-time behavior. It is similar to saying that everybody cannot drive the car. You need good training too for driving the car.
  2. Application Framework: To create a new real-time system, the application development framework or environment should provide real-time facility too. For example: Java is not a real-time development environment. It has garbage collector, which can be initiated anytime to claim the free memory. When Garbage collection runs, it takes a lot of resources and other threads slow down. This delays in processing the event by other threads. This is one example where Java fails as real-time application development framework. Same is true for .NET too.

    Usually, C & C++ languages are usually used to develop real-time applications.
  3. Application Design: The design of application should be such that it provides real-time functionality. If resources are available and design is not correct, you can't have a real-time solution.

No comments: