The Two Generals’ Problem

  • Loading...
  • Published on:  Monday, August 12, 2019
  • Time to tell a story about idempotency, computer science, and the Night of the Multiple Orders. • Sponsored by Dashlane —try 30 days for free at: BASICS: by Sean M Elliott and Tom ScottDirected by TomekGraphics by Mooviemakers mix by Haerther Productions to Dashlane for sponsoring the video! If you're techie enough to watch this video, you should be using a password manager. Get a 30-day free trial at'm at https://tomscott.comon Twitter at Facebook at on Instagram as tomscottgo


  • Tom Scott
    Tom Scott  21 days ago +2574

    Yes, I had help with the graphics for this series. There's no way I'd have animated that myself! On that note, thanks to Dashlane for sponsoring and helping me hire an animator: their free trial link is

  • Kinetik07
    Kinetik07  7 days ago +3566

    So it's like double posting by accident?

  • WMTeWu
    WMTeWu  7 days ago +574

    There are only two hard problems in distributed systems: 2. Exactly-once delivery 1.Guaranteed order of messages 2. Exactly-once delivery
    ~ Mathias Verraes

  • Putin did nothing wrong.
    Putin did nothing wrong.  7 days ago +248

    See you all in 2023 when this video gets recommended again

  • Philip Melchert
    Philip Melchert  5 days ago +198

    Everyone else: Goes to bed a reasonable time
    Me: Stays up all night trying to solve the unsolvable general problem with 0 knowledge of computer science

  • Brian Certain
    Brian Certain  7 days ago +189

    1:24 Spelled out "Tom" with the semaphore flags! ( ͡° ͜ʖ ͡°)

  • Kinetik07
    Kinetik07  7 days ago +3604

    So it's like double posting by accident?

  • z beeblebrox
    z beeblebrox  7 days ago +180

    idempotency: when you're able to have children, but just the one time.

  • MarbleSwan666
    MarbleSwan666  6 days ago +83

    I find the idea of two armies going one by one through a valley sending acknowledgments back and forth until everyone is dead hilarious
    Just imagine the army in the castle being confused.

  • Dominykas Turčinavičius

    "A single human error is never the root cause"
    A single human error: I'm about to end this man's whole career

  • Voodoomancer
    Voodoomancer  7 days ago +112

    Moral of the story: If you want to be a programmer, learn to cook.

  • Romi
    Romi  7 days ago +5235

    Oi nothing wrong with ordering the exact same things 5 times in a row I have my reasons

  • Ikis DragonFist
    Ikis DragonFist  6 days ago +75

    -"So what are we having? Chinese? Mexican?"

  • =NolePtr
    =NolePtr  23 hours ago +2

    I've never heard it referred to as an idempotency key. I've always heard it called a "nonce"

  • twinkle star
    twinkle star  7 days ago +67

    I almost ordered pizza multiple times recently when they said payment wasn't recieved, but I was too tired to care about reordering and gave up.
    Imagine my surprise when it showed up an hour later, lmao

  • Alexi Hickin
    Alexi Hickin  yesterday +1

    I work for deliveroo and I remember this evening, i delivered Wagamamas to a house who had already received their order. I had to wait with them while they got a refund, long story short I got 50 quids worth of Wagamamas for free.

  • Sean O'Brien
    Sean O'Brien  7 days ago +3715

    Nobody would put a castle in a valley between two perfectly good hills, therefore the entire video is invalid.

  • Kingsly9802
    Kingsly9802  2 days ago +2

    >If you are in computer science and working on a problem that involves potential loss of life, I really hope you aren't watching a series called "The Basics".
    But they're fun!

  • Michael Thomas
    Michael Thomas  yesterday +1

    "A single human error is never the root cause"
    Tell that to my development manager who came in to the position with nothing more than a background in marketing & graphic design and understands absolutely nothing about coding anything more complicated than changing a few things on an HTML template.
    edit: I don't even work in tech currently, so I'm just meme-ing not speaking from experience.

  • Maldus Alver
    Maldus Alver  6 days ago +43

    "Would you like to pay again?"
    Sounds like everything is working as intended to me.