Race condition

ImprimirCitar
Race condition in a logical circuit. Δt1 and Δt2 represent the delay of propagation of logical elements. When the input value (A) change, the circuit generates in the output a peak of duration (t1 + Δt2) − Δt2 = Δt1.

Race condition or sequence condition (from English race condition) is an expression used in electronics and programming. When the exit or state of a process depends on a sequence of events that are executed in arbitrary order and are going to work on the same shared resource, an error can be produced when said events do not arrive (they executed) in the order that the programmer expected. The term originates from the similarity of two processes competing in a race to arrive before the other, in such a way that the state and the exit of the system will depend on which one arrived before, being able to cause inconsistencies and unpredictable behaviors that are not compatible with a deterministic system. In certain scenarios, the high execution speed of a thread is not enough to guarantee that concurrent operations give expected results. Race conditions can occur at the process level or even at the system level when it is distributed.

As high-level examples: a poorly designed ticket reservation system could cause two users accessing the web at the same time to legitimately reserve the same seat. Or an automatic counting system of free spaces for a parking space at its vehicle entry and exit barriers could indicate that it is completely empty when it is actually full (or vice versa). In the same way, two people depositing and withdrawing cash at the same time from the same bank account could see their balance increased or, on the contrary, their income made but not materialized in the available balance. Although these are situations that may be unlikely, they are possible and can be and should be avoided in software development.

If the processes that are in a race condition are correctly synchronized, everything should work correctly, so the result will be as expected. Multiple processes are in a race condition if their outcome depends on the order of their arrival, and if they are not correctly synchronized, data corruption can occur that can even lead to a system security problem capable of being exploited malicious. Similarly, in electronic circuits a race condition occurs when the output of a system or subsystem depends on the order in which the activation or deactivation requests of its components have been sent.

The unpredictable nature of race conditions often leads to the sudden appearance of bugs that normally do not occur during software testing. In addition, they can be difficult to trace, difficult to replicate in a controlled manner, or visible even with program debugging tools.

Contenido relacionado

Meteosat

Meteosat are a series of geostationary weather satellites built and launched by ESA, which is operated and developed by the European Organization for the...

EXPENSIVE

In 1991 the Computer Antivirus Research Organization established criteria for naming malware. This nomenclature is based on following the following...

Automatic Repeat Request

ARQ are protocols used to control errors in data transmission, guaranteeing their integrity. These are usually used in systems that do not act in real time...
Más resultados...
Tamaño del texto:
Copiar