The Two Generals’ Problem

  • Yayınlanma Tarihi:  1 hafta önce
  • 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: MORE BASICS: Written by Sean M Elliott and Tom Scott 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
  • Video Süresi: 00:08:26
  • tom scott tomscott the basics computer science two generals problem two generals' problem the two generals problem idempotency idempotency key idempotency token idempotence 

Yorum Sayısı: 2128

  • Tom Scott
    Tom Scott 4 hafta önce

    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

  • Jeff Sergeant
    Jeff Sergeant 11 saat önce

    If Dashlane is compromised, an unauthorised update to the App could be sent which takes your master password and sends it in plaintext to the attacker; it’s much easier to break than you imply... that’s just one attack I thought up in about 5 seconds! you know no system is perfectly secure, such a sell-out move... to imply it is just because they’re sponsoring you

  • Bibi Mizrah
    Bibi Mizrah 22 saat önce

    Dash Lane is good. If you want self hosted multi device password manager that’s open source I recommend Bitwarden

  • deka W
    deka W 1 gün önce

    Are you sure you want to send this form again?

  • 607
    607 1 gün önce

    Ah! When I was in Rome in 2016 with school (a Dutch school), a few text messages sent to me on one of the days, from two different people, arrived 3-6 times each, with an interval between each time that seemed to increase. Maybe that could have been solved by such an idempotency key system! In fact, maybe the messages do have one, but my phone simply doesn't do anything with it.

  • blooDDragoNNetwork
    blooDDragoNNetwork 1 gün önce

    This guy is something between 20 and 60 years old i cant tell

  • ben brunyee
    ben brunyee 1 gün önce

    Try IBM MQ

  • Burning Wang
    Burning Wang 1 gün önce

    I use just eat, never used Deliveroo so I’m reet

  • Bernd Knauer
    Bernd Knauer 1 gün önce

    Send smoke signals, PrObLeM SoLvEd

  • Christian Rasmussen
    Christian Rasmussen 1 gün önce

    Neat. I'll float this to pupils who might appreciate this kind of problem. :)

  • Stephen Cooper
    Stephen Cooper 1 gün önce

    There is a fix though, General A just sends the messenger over and over again until they receive a reply?! General B knows that as long as the message keeps arriving then his own messenger hasn't gotten through?!

  • Lysergesaure1
    Lysergesaure1 1 gün önce

    7:40 you can definitely bribe the company to make the app send the master pasword to their servers, and none would be the wiser. Use something open source, and audited.

  • Guinness
    Guinness 1 gün önce

    What you're saying is use the order, user and date but not the time add the key?

  • Guinness
    Guinness 1 gün önce

    Easy way to run a scam

  • Dominic Quick
    Dominic Quick 1 gün önce

    Make sure the same soldier gets back?

  • Ahmad Pujianto
    Ahmad Pujianto 2 gün önce

    This is quiet a basic thing for payment gateway.. System should consider multiple order as a sign of failure, either in user device or on any infrastructure within the system itself.

  • فاء بن ألف'
    فاء بن ألف' 2 gün önce

    Can’t just 1 red messenger send the message then come back?

  • Souvik Aswad
    Souvik Aswad 2 gün önce

    Great video!

  • J Espinola
    J Espinola 2 gün önce

    How did this not happen sooner?

  • Yasir Arshad
    Yasir Arshad 2 gün önce

    So like free food?

  • Silverwolf0080
    Silverwolf0080 3 gün önce

    So what would be the equivalent of the idempotency for the two generals. Damn it, now I'm gonna be thinking about that all day.

  • Brian Bacc
    Brian Bacc 3 gün önce

    you're awesome subbed and liked

  • gepisar
    gepisar 3 gün önce

    !! I just came from another one of your videos that warns us not say "Tired and Emotional"... i think i know what you mean by "Tired and Exhausted" AND "Tired and Hungry"... is this self-libel?

  • Autotrope
    Autotrope 3 gün önce

    By your own description of the two generals problem, an idempotency token does not solve the problem.

  • alex chamber
    alex chamber 3 gün önce

    Why don't you keep acknowledging until everyone has more than 3 ack-ah...

    Why don't you send 20 messengers at once? One will get through.... Ah, that too.

    Right time to watch the solution.

  • jammin023
    jammin023 3 gün önce

    I wish these videos had been around back when I was doing Soft Eng at uni... your explanations are so much clearer than my lecturers could manage!

  • Orion Red
    Orion Red 3 gün önce

    This is exactly how I ended up with two gallons of milk in my fridge and two loaves of bread in my cupboard last week. It's also how I ended up with a gallon of spoiled milk and a loaf of stale bread this week.

  • ruwiki
    ruwiki 3 gün önce

    "it's unsolveable"

    me at 2 am: well, there must be a way ...

  • Oz El Coskuner
    Oz El Coskuner 3 gün önce

    Just giving thumbs down for showing 2 long (unskippable) ads. I hope creators puts some pressure on YouTube. Because YouTube literally don't give a damn about feelings of customers who are not paying. WHY WE STARTED WATCHING YOUTUBE? The biggest argument was "so that you don't have to watch long commercials of TV and get brainwashed". Now average ad on YouTube is surpassing TV. Anyway, since I got Amazon prime, I reduced YouTube time to 2 hours a week. Much happier. And I will never pay for YouTube, just because their approach. You cannot shove your will down to people's throat and expect success. When I see YouTube logo, I see a RABID DOG with dollar symbols on his red eyes. Disgusting.

  • John Dean
    John Dean 3 gün önce

    There IS answer to the Two Generals' Problem: go to your local chippie.

  • Airpolygon
    Airpolygon 3 gün önce

    Very interesting!

  • Rens Breur
    Rens Breur 4 gün önce

    But this anecdote isn't REALLY an example of the two generals problem right? The only 'attacker' is the server processing the order request. The two generals problem can't be solved by using a unique key.

  • Joseph Thomas
    Joseph Thomas 4 gün önce

    Can you find a different shirt?

  • iammaxhailme
    iammaxhailme 4 gün önce

    "Next time, I'll just cook for myself"

    Or, you can just call the restaurant and place your order verbally. Magic!

    I don't know how it is in the UK, but in NYC you sometimes get it a bit cheaper this way becuase apps take a cut

  • Jonathan Tikhonoff
    Jonathan Tikhonoff 4 gün önce

    Actually the two general story is already solved through encryption system. I know of one encryption system that can confirm to both users at same time that each other got the message. I assume that Deliveroo didn't use such encryption because it might be thought of as a bit too complicated and too costly for such simple service.

    Source: I took cryptography class few years ago so my memory are a bit shaky on details but I clearly remembered Bob, Alice, and Oscar model system about this problem.

  • Nubby Tope
    Nubby Tope 4 gün önce

    The main problem is that they built a castle in a valley.

  • Zen Lucas-Divers
    Zen Lucas-Divers 4 gün önce

    wouldn't the best option to just meet somewhere else, send a message to one side and keep doing so until a messenger gets through and tell them to meet a one point so that you can attack together.

  • M
    M 4 gün önce

    And then that "idempotency key" resets when you hit "try again" :D

  • Techno_mage_21
    Techno_mage_21 4 gün önce

    Maybe a joke comment cause excuse my incompetence but why isn’t the problem set in 3D? Cause then they could just go around?

  • Zachary Wilson
    Zachary Wilson 4 gün önce

    Are you in the Centre for Computing History in Cambridge?