Distributed

Lesson 02.9

Application mutex vs multiple instances

An application mutex coordinates work inside one process, but separate server instances need coordination through shared infrastructure.

One stick per counter

A cookie shop's computer shows how many cookies are left. Right now it says 1 🍪. Two workers, Ava and Ben, each get an order at almost the same moment.

At their counter, the workers share a talking stick 🪄. Only the worker holding the stick may check or change the number of cookies. Then the shop gets busy and opens a second counter, with its own stick.

In this lesson you'll

  1. 1Watch the stick work when both workers share one counter.
  2. 2Guess what happens with two counters.
  3. 3Compare one shared stick with two separate sticks.