When we talk about real time, our mind usually associates this term with the rendering of graphics on the fly that we usually see in video games, but the concept of real-time computing goes beyond that and refers to an area of the hardware that we use every day without knowing it. That is why we have decided to explain how it works and what it consists of.
A person may have a pacemaker because of a heart condition, well, although it is a relatively simple piece of hardware, it must always give an answer in a given time. If we are already moving in the driving environment, we can find a microcontroller in charge of ensuring that the entire system works at the ideal times to avoid a mechanical or electrical failure in the vehicle.
If we already talk about things of being more at home, the clearest example is in the communication between two devices, which has to be carried out at certain times that the standard sets. This happens especially in wireless printers that send bursts of data as it is printing on the paper. Nor can we forget the 8 and 16 bit consoles that due to video memory limitations had to send the data to the video output as the electron beam crossed the screen.
What is real-time computing?
We understand real-time computing as all that in which the execution of the instructions or sets of them, processes or programs, must be carried out in the shortest possible time, causing fatal results if the process is not carried out within said limit. established temporary. To do this we need to quantify said period using a measure, which can be a standard target time such as microseconds, milliseconds or seconds, or if we cannot do it this way we will have to use the clock cycles of the processor that is executing said instruction or instruction set.
So a real-time system has to give a response in a given time from a user action regardless of the processes that existed before. A very clear example of this is when we press a button on our mouse or control knob in a video game, we expect the response on the screen to appear as quickly as possible, if it takes too long then we understand that the system does not work properly.
Thus, real-time computing systems are those sensitive to the execution time of the processes and where their operation can be totally or partially affected by not solving the processes in a certain time.
Real Time Computing Categories
As real-time computing has time requirements, we can divide these into two types, hard and soft.
- In a real-time system of the hard type, if the process does not get to be executed in the specified time, it results in a total system failure. For example, the real-time airbag system of a car may not work on time and the person having an accident hits the steering wheel and dies instantly.
- On the other hand, a real-time system of the soft type only suffers a loss in the quality of the service, but not a general failure of the system, a clear example is the Input Lag in a video game or the delay in a broadcast.
We usually see the first type in devices that work autonomously and in a continuous loop, where the addition of any more instruction can result in a delay in the process that can be fatal, that is why microcontrollers are used for this that work in In isolation and with each of its instructions measured for a performance worthy of a Swiss watch. Are they on our PCs? Well yes, for example the systems that control the Boost periods of the CPU and the GPU are examples of real-time computing systems
The reason why microcontrollers are used is due to the fact that their RAM memory is inside the processor itself, so its latency is minimal and a cache system is not necessary, moreover, it would be totally counterproductive, since in these cases would add latency and be fatal for the proper functioning of the system. In microcontrollers, the set of instructions is not only given in the sense of what each one of them does, but also of the time they consume.
Use of special operating systems in real time
However, the problem with a microcontroller is that they are not capable of executing more than one process at the same time and it is at that point where the use of more complex hardware and software is necessary, especially the latter and therefore this is where they come in. real-time operating systems that are responsible for managing the processes that will run on the processor, here again we have two types:
- Systems guided by events, the execution of the programs is done in a normal way, but the events do not have an execution preference for a system of privileges and hierarchy in origin, but these are solved as they appear.
- A time-sharing system, in which each instruction is given a time to execute to avoid delays, if a process cannot be executed in the expected time then it is paused and skipped to the next process.
These types of operating systems run on much more advanced microcontrollers, with cores capable of executing several processes at the same time and that therefore can carry out much more complex tasks or a succession of them in an orderly manner that together require more power for their operation. functioning. Regarding the categorization of Real Time Operating Systems or RTOS, these are categorized according to the type of real-time computing that you want to use, so there are hard and soft types.