Race conditions
What are race conditions and why do they happen?

Just a guy who loves to write code and watch anime.
Search for a command to run...
What are race conditions and why do they happen?

Just a guy who loves to write code and watch anime.
No comments yet. Be the first to comment.
Qualities that make outstanding builders.

Bipedal vs quadrupedal: how many legs This is about the number of legs the creature walks on. Bipedal. Two legs. Humans, ostriches, T-rex, kangaroos, most fantasy humanoids. Quadrupedal. Four legs. Do

Intro You hear "lerp" and "smoothstep" everywhere in game dev. They sound like math jargon. They're not. Both are small tools that do the same job: smoothly move from one value to another. The problem

What is Kinematics Kinematics is the math field. It's the study of how things move without worrying about forces (which would be dynamics). FK and IK are the two branches: forward kinematics and inver

Intro Textures are usually the biggest cost in a 3D scene. Memory, bandwidth, and load time all get eaten by them. Resizing them is the obvious lever. There's more. This post is about the less obvious

I won't lie, I often heard the term race conditions but always assumed I understood what it meant, but when I tried to explain it, I just couldn't find the right words. I've always understood race conditions, speaking in the context of making network requests, as an undesired behavior that occurs when multiple requests are in-flight that modify the same or similar things.
This has always been an assumption of mine though, hence I dug into what race conditions really are and wrote this article.
By definition: A race condition happens when two or more operations are happening at the same time, and compete for which one will be executed first.
Race conditions are common in multi-threaded applications.
Race conditions can cause unexpected bugs or behaviors in our programs.
I made a visual below. Let's say for instance user spam clicks a button that makes requests to the server.

At least my understanding of race conditions is more clear, and I hope yours too.