TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:5462] "Race Condition"?



pani@frontiernet.net wrote:
> 
> It happens when more than 1 person/task/machine try to access
> the same resource or item simultaneously when they should actually
> use it one after the other.  Two people rushing to use the bathroom
> at the same time and getting stuck at the door is also an example
> of a race condition !

I usually interpret it a little more generally, to mean that the
outcome of a situation is not determined by logic, but by
whomever happens to get there first (i.e. win the foot race). 
The winner could be determined by I/O conditions (in the case of
resource management), or task switching (in the case of threading
or IPC).  A program with a race condition cannot control the
result; the outcome is arbitrary, most likely determined by the
current state of the OS.  Race conditions can be solved through
file locking, proper thread management, etc.

Maybe that's not entirely correct, but that's how I see it.  (c:

John