AI Dictionary › Fondamenti AI

Race Condition

A race condition is a defect occurring when a system's outcome depends on the unpredictable order in which two or more processes access a shared resource. Like two people unknowingly editing the same document at once, the processes step on each other's toes: whoever arrives last overwrites the other's work.

Definition

What it is

A race condition is a defect occurring when a system's outcome depends on the unpredictable order in which two or more processes access a shared resource. Like two people unknowingly editing the same document at once, the processes step on each other's toes: whoever arrives last overwrites the other's work.

How it works

The classic example: two operations read a balance of 100 euros, both add 50, both write 150. One deposit has vanished. Defenses include locks (one process at a time in the critical section), atomic operations, transactions and optimistic concurrency control. Race conditions are among the most insidious bugs: they appear rarely, depend on timing and vanish when you try to reproduce them.

Applications

In AI they show up in multi-agent systems where several agents modify the same resource, in parallel pipelines writing to the same indexes and in serving systems updating models while handling requests. Beyond AI they have caused historic accidents: the lethal doses delivered by the Therac-25 radiotherapy machine (1985-87) were partly caused by software race conditions, and the 2003 Northeast American blackout was aggravated by a race condition in an alarm system.

History & etymology

The term comes from electronics: 1950s logic circuit design spoke of races between signals traveling different paths, where the result depends on which arrives first; the treatment of races in sequential circuits appears as early as David Huffman's 1954 dissertation. Concurrent computing inherited both the term and the problem.

Definizione (italiano)

Una race condition (condizione di corsa) è un difetto che si verifica quando il risultato di un sistema dipende dall'ordine imprevedibile con cui due o più processi accedono a una risorsa condivisa. Come due persone che modificano lo stesso documento contemporaneamente senza accorgersene, i processi si pestano i piedi: chi arriva per ultimo sovrascrive il lavoro dell'altro.

L'esempio classico: due operazioni leggono un saldo di 100 euro, entrambe aggiungono 50, entrambe scrivono 150. Un deposito è sparito. Le difese sono i lock (un processo alla volta nella sezione critica), le operazioni atomiche, le transazioni e il controllo ottimistico della concorrenza. Le race condition sono tra i bug più insidiosi: si manifestano di rado, dipendono dai tempi e spariscono quando si prova a riprodurle.

Nell'AI compaiono nei sistemi multi-agente in cui più agenti modificano la stessa risorsa, nelle pipeline parallele che scrivono sugli stessi indici e nei serving system che aggiornano modelli mentre servono richieste. Fuori dall'AI hanno causato incidenti storici: le dosi letali della macchina per radioterapia Therac-25 (1985-87) furono causate anche da race condition nel software, e il blackout del Nord-Est americano del 2003 fu aggravato da una race condition nel sistema di allarme.

Il termine viene dall'elettronica: nei circuiti logici degli anni '50 si parlava di corsa tra segnali che viaggiano su percorsi diversi, dove il risultato dipende da chi arriva prima; la trattazione delle race nei circuiti sequenziali compare già nella tesi di David Huffman del 1954. L'informatica concorrente ha ereditato termine e problema.

Related terms

More in Fondamenti AI

Put it into practice

From our network

AGORÀ Intelligence — Enterprise AI Governance Platform

Govern AI at scale: policies, adoption and measurable results on your data. Built for boards and C-suite.

Visit agora-intelligence.com →

From the Agora Intelligence blog

More on agora-intelligence.com →

📱 Download the Android app (beta) iOS coming soon

Say what you mean. Get what you need.

Grace Certified — the AI coach that trains and certifies your prompt engineering — by Agora Intelligence.