The Two Generals’ Problem

  • Published on: 12 August 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:


    Written with Sean Elliott
    Directed by Tomek
    Graphics by Mooviemakers
    Audio mix by Haerther Productions

    Thanks 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

    I'm at
    on Twitter at
    on Facebook at
    and on Instagram as tomscottgo
  • Runtime : 8:26
  • tom scott tomscott the basics computer science two generals problem two generals' problem the two generals problem idempotency idempotency key idempotency token idempotence


  • Tom Scott
    Tom Scott   11 months ago

    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

  • Arvind Sami
    Arvind Sami   9 hours ago

    Anyone else interested in what pizza it was?

  • Jj Pelham
    Jj Pelham   11 hours ago

    use a horn, thats what they did.

  • Golden GT
    Golden GT   13 hours ago

    I’m real late to this but: one generals army sends 2 messengers at once, and tells the second messenger to only return if they both make it through to the other general and deliver the message, and if they do not come back, send another 2 messengers with the same instructions. Then they will know if they made it through because the one messenger will have guaranteed seen the other messenger make it through, and also they will have made it back so both sides are aware of the plan and they are aware the other general is aware of the plan.

  • Havoc 09
    Havoc 09   13 hours ago

    Each army sends two messengers around the same time. Each messenger meets the other and makes sure the other survived by telling the army who sent it that Their messenger made it across. This riskiest part is that either of the messengers didn’t make it after meeting with the other. Another problem might be that they may not know the plan. It might have holes but could work.

  • Daniel M
    Daniel M   15 hours ago

    In "Long Dark Tea Time of the Soul," Douglas Adams lamented the fact that Brits could not get pizza delivery, something that has been normal in the US for more than 50 years.

  • TheRealSta1k3r
    TheRealSta1k3r   19 hours ago

    Answer: If you can respawn after you die, the Generals can just send their armies one after another, nonstop

  • Goose 6.0
    Goose 6.0   22 hours ago

    Theoretically, Couldn't both generals send a message containing a time, and continue sending messages containing a time until both times were in agreement

  • Anton.fwp
    Anton.fwp   23 hours ago

    that problem applies to every single conversation

  • Dududu
    Dududu   1 days ago

    thats why i wanted to be in computers but i resigned xD

  • Master Ed
    Master Ed   1 days ago

    Could of just sent two (one from blue and one from red) messengers to meet each other in a ditch!

  • Peter Hall
    Peter Hall   1 days ago

    I might be just being slow but I don't see how being idempotent "fixes" the two generals problem? I'd like to understand

    JACOB HARMON   1 days ago

    "Many poor decisions made over a long period of time" life, bro.

  • Cloud
    Cloud   2 days ago

    "Idempotence. Idempotence is a funky word that often hooks people. Idempotence is sometimes a confusing concept, at least from the academic definition. From a RESTful service standpoint, for an operation (or service call) to be idempotent, clients can make that same call repeatedly while producing the same result."

  • Remco Hamersma
    Remco Hamersma   4 days ago

    For me it would be more logical if the castle was on a hill. In that case the generals couldnt just see eachother

  • VodShod
    VodShod   4 days ago

    I had this problem when trying to deposit a check at multiple ATMs

  • Boab Joab
    Boab Joab   4 days ago

    General C would solve the problem.

  • theWORSTluck
    theWORSTluck   4 days ago

    The same thing was happening on door dash around the same time 👀

  • SuperLemonfish
    SuperLemonfish   5 days ago

    my solution to the generals problem: send 2 messangers simultaneously, once they get to the castle they will iether be captured or not, if not, then one continues forward to the other side and one comes back, letting us know that they crossed the castle. but if they are captured, then nobody comes back, so we know we have to send another pair.

  • Podaj747
    Podaj747   5 days ago

    1. There's a chance both messengers will be sent at the same time (with the generals not knowing where they are), reach an agreement, and go back to their armies. They will attack at the same time provided both messengers will tell their general an agreement has been reached and the attack takes place on (for example) 6pm.

  • darci peeps
    darci peeps   5 days ago

    I have watched this video a few times and still don’t really get it

  • Matthew Huang
    Matthew Huang   5 days ago

    You can just send billions of cards, at least one of them would go through.

  • Bezza
    Bezza   5 days ago

    to solve it simply send a messenger from both sides to meet in the middle, exchange a message then come back, if neither come back they died if one comes back so will the other as they met in the middle and either both get killed or neither get killed by the castle

  • klarigi4219
    klarigi4219   6 days ago

    It's the people's fault for not realising the payment had gone through and bought more. Stupid-ass lazy people should've watched Tom Scott ;)

  • TrveIrrlicht
    TrveIrrlicht   1 weeks ago

    And now I have a blocked payment of 100 USD in my Paypal account because I ordered the same shipment by UPS twice

  • Sebastian Buchfink
    Sebastian Buchfink   1 weeks ago

    if the two generals problem equals the german internet connection not only the messanger will get lost but also two armies while atacking XD

  • Just one more thing
    Just one more thing   1 weeks ago

    Hey! I don't watch this series because I faked my way into nato high command. I watch it because it's entertaining. Also I'm an admiral. Could you perhaps elaborate how this problem applies to nucular submarines?

  • Marty W.
    Marty W.   1 weeks ago

    i mean, couldn't you just call the restaurant?

  • k
    k   1 weeks ago

    I couldn't track the metaphor it was too general

  • Luke Madsen
    Luke Madsen   1 weeks ago

    "Next time, I'll cook for myself"*After 4 math exams in one week*Me: Yes, I would like a pizza

  • El Fro
    El Fro   1 weeks ago

    The problem solution: why can’t the original sender just come back and say it went through

  • Papa Putin
    Papa Putin   1 weeks ago

    Aint caszles like on hills instead of in valleys

  • Silver Unknown
    Silver Unknown   1 weeks ago

    Can’t the messenger from the red army just come back to his original army?