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. 1Explain why a lock inside one program does not stop other programs
  2. 2Watch the stick work when both workers share one counter.
  3. 3Guess what happens with two counters.
  4. 4Compare one shared stick with two separate sticks.