The Two Generals’ Problem

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: www.dashlane.com/tomscott
MORE BASICS: frplayer.info/listPL96C35uN7xGLLeET0dOWaKHkAlPsrkcha.html
Written by Sean M Elliott and Tom Scott
Directed by Tomek
Graphics by Mooviemakers www.mooviemakers.co.uk/
Audio mix by Haerther Productions haerther.net/
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 dashlane.com/tomscott
I'm at tomscott.com
on Twitter at twitter.com/tomscott
on Facebook at facebook.com/tomscott
and on Instagram as tomscottgo

Commentaires

  1. Tom Scott

    Tom Scott

    Il y a 29 jours

    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 www.dashlane.com/tomscott

    • Sweet's Channel

      Sweet's Channel

      Il y a 2 jours

      @Masked Death True... I admit that the reply was a bit aggressive. I Should have been more polite from the start. Have a nice day 😊👌

    • Masked Death

      Masked Death

      Il y a 2 jours

      @Sweet's Channel no problem, mistakes happen, sorry for lashing out - your reply was a bit aggressive and it caught me off guard. My bad.

    • Sweet's Channel

      Sweet's Channel

      Il y a 2 jours

      @Masked Death oh... now I understand. your talking about the sponsor of the video. I'm sorry 😔

    • Sweet's Channel

      Sweet's Channel

      Il y a 2 jours

      @Masked Death No it doesn't. the issue talked about in the video... starting at 3:00 it has to do with the implementation of Fetch/Ajax/Json the coder should have made sure that communication works as it should with some sort of REST API Tester example with Restlet Client or postman I'm not aggressive but frustrated because the app you are talking about is app for end user and not a coders broblem

    • Masked Death

      Masked Death

      Il y a 2 jours

      @Sweet's Channel yes it does, it's an alternative to Dashlane except you don't have to pay for it. Not sure why your response is so aggressive unless you're shilling for Dashlane tho

  2. Bibi Mizrah

    Bibi Mizrah

    Il y a 13 heures

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

  3. deka W

    deka W

    Il y a 16 heures

    Are you sure you want to send this form again?

  4. 607

    607

    Il y a 17 heures

    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.

  5. blooDDragoNNetwork

    blooDDragoNNetwork

    Il y a jour

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

  6. ben brunyee

    ben brunyee

    Il y a jour

    Try IBM MQ

  7. Burning Wang

    Burning Wang

    Il y a jour

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

  8. Bernd Knauer

    Bernd Knauer

    Il y a jour

    Send smoke signals, PrObLeM SoLvEd

  9. Christian Rasmussen

    Christian Rasmussen

    Il y a jour

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

  10. Stephen Cooper

    Stephen Cooper

    Il y a jour

    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?!

  11. Lysergesaure1

    Lysergesaure1

    Il y a jour

    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.

  12. Guinness

    Guinness

    Il y a jour

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

  13. Guinness

    Guinness

    Il y a jour

    Easy way to run a scam

  14. Dominic Quick

    Dominic Quick

    Il y a jour

    Make sure the same soldier gets back?

  15. Ahmad Pujianto

    Ahmad Pujianto

    Il y a 2 jours

    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.

  16. فاء بن ألف'

    فاء بن ألف'

    Il y a 2 jours

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

    • فاء بن ألف'

      فاء بن ألف'

      Il y a 2 jours

      And if they want confirmation the blue’s would send one and verify it then go back, it doesn’t have to arrive even; both of them would attack anyway and they’ll win

  17. Souvik Aswad

    Souvik Aswad

    Il y a 2 jours

    Great video!

  18. J Espinola

    J Espinola

    Il y a 2 jours

    How did this not happen sooner?

  19. Yasir Arshad

    Yasir Arshad

    Il y a 2 jours

    So like free food?

  20. Silverwolf0080

    Silverwolf0080

    Il y a 2 jours

    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.

  21. Brian Bacc

    Brian Bacc

    Il y a 2 jours

    you're awesome subbed and liked

  22. gepisar

    gepisar

    Il y a 2 jours

    !! 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?

  23. Autotrope

    Autotrope

    Il y a 2 jours

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

  24. alex chamber

    alex chamber

    Il y a 2 jours

    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.

  25. jammin023

    jammin023

    Il y a 3 jours

    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!

  26. Orion Red

    Orion Red

    Il y a 3 jours

    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.

  27. ruwiki

    ruwiki

    Il y a 3 jours

    "it's unsolveable" me at 2 am: well, there must be a way ...

    • Stephen Cooper

      Stephen Cooper

      Il y a jour

      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?

  28. Oz El Coskuner

    Oz El Coskuner

    Il y a 3 jours

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

  29. John Dean

    John Dean

    Il y a 3 jours

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

  30. Airpolygon

    Airpolygon

    Il y a 3 jours

    Very interesting!

  31. Rens Breur

    Rens Breur

    Il y a 3 jours

    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.

  32. Joseph Thomas

    Joseph Thomas

    Il y a 3 jours

    Can you find a different shirt?

  33. iammaxhailme

    iammaxhailme

    Il y a 3 jours

    "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

  34. Jonathan Tikhonoff

    Jonathan Tikhonoff

    Il y a 3 jours

    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.

  35. Nubby Tope

    Nubby Tope

    Il y a 3 jours

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

    • ruwiki

      ruwiki

      Il y a 3 jours

      @Nubby Tope as well

    • Nubby Tope

      Nubby Tope

      Il y a 3 jours

      ruwiki - fortifications like castles are built on high ground.

    • ruwiki

      ruwiki

      Il y a 3 jours

      why? to protect an important river crossing, for example.

  36. Zen Lucas-Divers

    Zen Lucas-Divers

    Il y a 4 jours

    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.

  37. M

    M

    Il y a 4 jours

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

    • less kiss

      less kiss

      Il y a 3 jours

      The fact you spent £1,795 inc vat per minute of this videos graphics is beyond me

  38. Techno_mage_21

    Techno_mage_21

    Il y a 4 jours

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

  39. Zachary Wilson

    Zachary Wilson

    Il y a 4 jours

    Are you in the Centre for Computing History in Cambridge?

    • less kiss

      less kiss

      Il y a 3 jours

      very close to this idea. Her paper was entitled "Network layer protocols with Byzantine robustness"

  40. Caleb_ Artzs

    Caleb_ Artzs

    Il y a 4 jours

    Why not A send a messager at same time as B? So both can meet at the middle and both can go back and inform there general's

  41. Deep hug

    Deep hug

    Il y a 4 jours

    to prevent jamming of wireless signals.

  42. soap's alt

    soap's alt

    Il y a 4 jours

    The messengers could meet in the valley and then return with an agreement.

    • Jose Rojas

      Jose Rojas

      Il y a 4 jours

      without some form of instantaneous communication, neither general will never know with 100% confidence that the other general's messenger made it back safely to relay the agreement. The point is there's always some assumptions made at some point by one general that the last message went through and by the other general that the previously sent messages were sufficient to proceed with 'enough confidence'.

  43. BleedingRaindrops

    BleedingRaindrops

    Il y a 4 jours

    this is a really cool problem. and a really great explanation. Not being a software engineer myself, a lot of why I'm here is through sheer curiosity, but your explanations are always entertaining and easy to understand, so I keep them on a backlog for the day they become relevant to me. Thanks for keeping this channel awesome.

    • Deep hug

      Deep hug

      Il y a 4 jours

      attack. If you stop receiving messages, count 1 for each missed message, Reset counter if you receive a message. If count exceeds 6, attack. If the number "I last saw mess

  44. XerO

    XerO

    Il y a 4 jours

    couldnt you just send one messenger with a message to have the a messenger from each side to meet at some kind of halfway point and then return to their general

  45. George Hugh

    George Hugh

    Il y a 4 jours

    Castles aren't built in valleys, generally, generally.

    • ruwiki

      ruwiki

      Il y a 3 jours

      well, if they protect a river crossing

  46. Lou

    Lou

    Il y a 4 jours

    You could just get past the castle with your whole force, telling the other force to attack with you - so you become one big army. Problem solved?

  47. CS:GO сФинщини

    CS:GO сФинщини

    Il y a 4 jours

    Bitcoin solved the Byzantine generals' problem

    • ruwiki

      ruwiki

      Il y a 3 jours

      blockchain you mean

  48. Emily An

    Emily An

    Il y a 4 jours

    I earn like 20 quid an hour for deliveroo it’s not bad 😂

    • ruwiki

      ruwiki

      Il y a 3 jours

      with tip

  49. =NolePtr

    =NolePtr

    Il y a 4 jours

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

    • jammin023

      jammin023

      Il y a 3 jours

      The problem is that word means something else in British English...

  50. Giovanni Joe

    Giovanni Joe

    Il y a 4 jours

    Super informative! Thanks very much for the great content!

    • Emily An

      Emily An

      Il y a 4 jours

      story short I got 50 quids worth of Wagamamas for free.

  51. flutty bitch

    flutty bitch

    Il y a 4 jours

    You are my new favorite channel. Subscribed. BTW, I had the same problem when purchasing Dragon Age: Inquisition. Took a month for EA to return my money.

  52. Michael Thomas

    Michael Thomas

    Il y a 4 jours

    "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.

    • Orion Red

      Orion Red

      Il y a 3 jours

      Well, you're dead on.

  53. Dan Scherck

    Dan Scherck

    Il y a 4 jours

    Interesting factoid: The Spanning Tree Protocol, used in Networking to prevent network loops, was invented by Radia Perlman, whose doctoral thesis at MIT was on something very close to this idea. Her paper was entitled "Network layer protocols with Byzantine robustness"

  54. Magic Morgan

    Magic Morgan

    Il y a 4 jours

    The fact you spent £1,795 inc vat per minute of this videos graphics is beyond me

  55. Bluestripe

    Bluestripe

    Il y a 4 jours

    I had this with steam with a gift and sent 3 skyrims to my friend, by the time we'd realised the refund was no longer possible.

  56. NikoHD203

    NikoHD203

    Il y a 4 jours

    I feel so smart now😂

  57. Real Sky Luke

    Real Sky Luke

    Il y a 4 jours

    *I was a sub before you hit 200k, WTF WHEN DID YOU BLOW UP???!!!!! 1.8 Million!!! I never even noticed!!!!*

  58. Reagan Epps

    Reagan Epps

    Il y a 4 jours

    I know this probably wouldn’t work with computer science stuff but if they sent a messenger to meet the other and they both go back that might work

    • Ptao Tom

      Ptao Tom

      Il y a 4 jours

      Bitcoin

  59. alnoso

    alnoso

    Il y a 4 jours

    i dont get food delivery apps is it so hard to call a human and say "hey i want a pizza"

  60. Sebastian Nielsen

    Sebastian Nielsen

    Il y a 5 jours

    There is actually a way to "solve" this problem, and that is continually send messages. They could contain a number, my message number, and the last message number I saw from you. Of course they must be encrypted and end2end verified. Continuially send these messages, lets say with 10 minutes apart. Stop sending messages 1 hour before the attack. If you stop receiving messages, count 1 for each missed message, Reset counter if you receive a message. If count exceeds 6, attack. If the number "I last saw message number X" is more than 6 - (count), attack. Regardless on how the adversiary capture the messages, it will result in a successful attack. HINT: This is how alarm system works to prevent jamming of wireless signals.

    • Ptao Tom

      Ptao Tom

      Il y a 4 jours

      Seems like once both generals have received at least one acknowledgement they can just attack since the time hasn't changed.

  61. Black Light

    Black Light

    Il y a 5 jours

    youtube recommended, wtf? Why? I neither understand computer logics or having problems with my food arriving.

  62. Alexander Cavrich

    Alexander Cavrich

    Il y a 5 jours

    I

    • less kiss

      less kiss

      Il y a 5 jours

      err, Works fine for me... sounds like user error....

  63. Drake H.

    Drake H.

    Il y a 5 jours

    Wouldn't you be able to include a signal response request in the initial message (talking about the two generals problem) - like general a gives a time and requests that general b light a large fire in a visible area to confirm receipt and agreement of the message.

  64. [TRCZ] NoidEXE

    [TRCZ] NoidEXE

    Il y a 5 jours

    4:55 but how can you make the same order three times and the server not notice it's the same order? I mean can't you use a pseudo random number generator or something? You only get the next random number if you receive a confirmation or cancel the order. That way if the server gets the same random number for the same client it can tell it's the same order. I'm just a game designer so maybe it's harder than this but I can't think of why it wouldn't work.

    • less kiss

      less kiss

      Il y a 5 jours

      What if someone wanted to do the same order for multiple people. A certain restaurant verifies double orders

  65. Mike Pratt

    Mike Pratt

    Il y a 5 jours

    Suggestion for dinner next time - Salmon in a dishwasher..?

  66. Alexi Hickin

    Alexi Hickin

    Il y a 5 jours

    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.

  67. Alexi Hickin

    Alexi Hickin

    Il y a 5 jours

    I earn like 20 quid an hour for deliveroo it’s not bad 😂

  68. Raymon Crane

    Raymon Crane

    Il y a 5 jours

    Those look like HP 7933/7935 disk drives in back. Used to fix those back in the day.

  69. roasted pancakes

    roasted pancakes

    Il y a 5 jours

    Just send two million messengers with a paper each towards the blue army. The paper should have a time to attack and a check mark at the bottom of the page. Make the blue army check every single paper and send all of the messengers back. Then both armies will have a reasonable guarantee that each army got the message. Alternatively, reroute one of the armies to meet the other army and have a combined attack with both armies.

  70. TelFiRE

    TelFiRE

    Il y a 5 jours

    There’s nothing unethical about ordering food. I work for Grubhub. Yes there are things I would rather have different, but wouldn’t at their job? By not ordering food all you’re doing is denying me money and making my job harder

    • TelFiRE

      TelFiRE

      Il y a 5 jours

      And frankly the only unethical think you’re is to frame this is a question of ethics. Businesses are allowed to have different policies and people are allowed to agree or disagree on those policies without it being a matter of ethics. If you don’t want to work there you don’t have to

  71. Simon Johnson

    Simon Johnson

    Il y a 5 jours

    It's not "unsolvable", the word is "insuperable - Pedant

    • Ask to seduce Miss

      Ask to seduce Miss

      Il y a 5 jours

      knows if A made it and A knows B made it. Both army’s attack. Solved. I know this wouldn’t work in computers but it is a solution if it were just a puzzle

  72. invisiblebears

    invisiblebears

    Il y a 5 jours

    Why couldn't they just continually send back messengers with confirmation until the proposed time and if one of the messengers didn't show up Abort or in the case of a computer disconnect or and endhandshake?

    • Ask to seduce Miss

      Ask to seduce Miss

      Il y a 5 jours

      A sends a messenger to b. If it makes it , b sends both that messenger and a new messenger from b to the castle. Messenger B turns back and messenger A continues to a

  73. lampree

    lampree

    Il y a 5 jours

    why did this video get uploaded 3 times??

  74. Robert South

    Robert South

    Il y a 5 jours

    Seems like once both generals have received at least one acknowledgement they can just attack since the time hasn't changed.

  75. 007one

    007one

    Il y a 5 jours

    Bitcoin

  76. TheTech9

    TheTech9

    Il y a 5 jours

    This channel is awsome, and this guy is pleasant voice to listen to. No homo

  77. Carl

    Carl

    Il y a 5 jours

    Hey dude do you still see dead people? oh nevermind.

  78. Jake Wish

    Jake Wish

    Il y a 5 jours

    What if someone wanted to do the same order for multiple people. A certain restaurant verifies double orders

  79. Stuart Wilson

    Stuart Wilson

    Il y a 5 jours

    err, Works fine for me... sounds like user error....

  80. Tinka Like AngelOK

    Tinka Like AngelOK

    Il y a 5 jours

    Justeat 😂

Prochain