Sunday, May 13, 2007

Fast system <> real time system

Why a lot of people think that systems that have fast response are "real time" systems? I often hear things like "It's a real time system, the values are constantly updated in real time.", "It's a real time system, it responds immediately after it receive a request". Real time is about compromise to give a response in a window of time, I mean, the system has to produce a response in x seconds, no matter what, it has to produce it in x seconds, point. A formal definition from

A Real-Time System responds in a (timely) predictable way to unpredictable external stimuli arrivals. In short, a Real-Time System has to fulfill under extreme load conditions:

  1. Timeliness: meet deadlines, it is required that the application has to finish certain tasks within the time boundaries it has to respect;
  2. Simultaneity or simultaneous processing: more than one event may happen simultaneously, all deadlines should be met.;
  3. Predictability: the real-time system has to react to all possible events in a predictable way;
  4. Dependability or trustworthiness: it is necessary that the real-time system environment can rely on it.

Common examples of real time system are: automobile airbag systems, temperature control system of a nuclear power plants, etc.

In one of my current projects we have to control PLCs for pallets transportation in a warehouse, we have to reply the PLCs quick, otherwise the efficiency of the warehouse goes down, but it's far from being a real time system, even so I bet someone (colleagues, partners, client, providers, etc.) will call it a real time in some moment in the future.

The majority of systems people call real time are .NET or Java (not JSR-001/JSR-282) systems. However, the garbage collector in .NET and Java is not deterministic, so you cannot be sure about when some things will happen. For this reason, you cannot build real time systems in .NET or Java, at least not a “hard” real time system.

With JSR-001/JSR-282, Java will be able to build hard real time system; however, I've never saw anything similar for .NET, unfortunately.