---
title: "Discussion on \"What Is a Race Condition? When Two Programs Step on Each Other's Toes\" | Hashnode"
description: "Discussion on \"What Is a Race Condition? When Two Programs Step on Each Other's Toes\". Two pieces of code read the same number, both add one, both write it back — and one of the additions quietly vanishes"
url: "https://hashnode.com/posts/what-is-a-race-condition-when-two-programs-step-on-each-other-s-toes/6af66a02b6a5245dad28cb8c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [What Is a Race Condition? When Two Programs Step on Each Other's Toes](https://itsmeminsithu.hashnode.dev/what-is-a-race-condition-when-two-programs-step-on-each-other-s-toes?utm_source=hashnode&utm_medium=feed)

Two pieces of code read the same number, both add one, both write it back — and one of the additions quietly vanishes

4d ago · 6 min read · itsmeminsithu.hashnode.dev  
Read the article

-   [#concurrency](https://hashnode.com/tag/concurrency)
-   [#multithreading](https://hashnode.com/tag/multithreading)
-   [#debugging](https://hashnode.com/tag/debugging)
-   [#python](https://hashnode.com/tag/python)

## Written by

[Min SiThu](https://hashnode.com/@itsmeminsithu)

@itsmeminsithu · Singapore

  
[View profile](https://hashnode.com/@itsmeminsithu)

Software Engineer

Nubbad Developer. | Now I accidentally create problems.

## Responses 1

Markdown supported · ⌘↵ to post

[OneLifeVibe](https://hashnode.com/@onelifevibe)

[4d ago](https://hashnode.com/posts/what-is-a-race-condition-when-two-programs-step-on-each-other-s-toes/6af66a02b6a5245dad28cb8c/comment/6af6bb7c5bc1768a1dbab6fa)

The shared bank account example is what made this click for me. Two ATMs both reading 100 dollars, both writing back 90, and ten dollars appearing from nowhere shows the bug better than any definition. I also liked the point that balance equals balance plus one looks like one step but is really three, and that the result can be 2000 one run and 1947 the next. The warning about locks creating their own trouble with deadlock is a useful balance to the fix.
