The Two Generals’ Problem

Wyświetleń 1 000 942
98% 45 774 663

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: 4strefa.pl/group/PL96C35uN7xGLLeET0dOWaKHkAlPsrkcha
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

Published on


Aug 12, 2019




Loading link...

Dodaj do:

My playlist
Watch later
Komentarze 1 925
Tom Scott
Tom Scott 22 dni temu
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
Andrew F
Andrew F 13 godzin temu
How is it unsolvable? Wouldn't you just need a maximum of two confirmations sent in order after the original message? If you get at least one confirmation in the correct order after the original message then you know both parties received the original, right? What am I not understanding here?
john smith
john smith 17 godzin temu
who would put the castle in the valley but a computer tech
ERMAN ATES Dzień temu
It was very well put. Animations were only fabulous. Thanks
John Jennings
John Jennings 2 dni temu
Glad to know Dashlane is sponsoring you and you trust them! Been using them for 3 years now
Treqqing 3 dni temu
Could you do an episode on the flat earth
Bloodthirsty 4 godzin temu
How about lighting the biggest fire the blue general has ever seen
Patrick Armstrong
Patrick Armstrong 4 godzin temu
OMG look at all those IBM PCs!!
Red Jellonian
Red Jellonian 5 godzin temu
Anikthias 5 godzin temu
General A: "General B, I propose to you a plan of attack. Upon receiving this message, send one of your messengers back with mine. At the midway point, yours shall turn around and return to you. An hour after both our messengers have arrived, we will commence the siege; should either messenger not return, the other must also have been spotted and destroyed." Repeat this process until the messenger of General A returns, and begin the siege.
J G P 5 godzin temu
google already does for free what dashlane charges for.
Mostwanted 5 godzin temu
Had this with dominos, same I had the instinct to Not risk paying again..that's just silly
Frank Harr
Frank Harr 6 godzin temu
O.K., so A can just keep sending a proposal until one of B's acceptance has been recieved. B assume A is serious and A assumes B is . . . well, nothing. A doesn't have to. Clever.
cubeincubes 7 godzin temu
Dominykas Turčinavičius
Dominykas Turčinavičius 7 godzin temu
"A single human error is never the root cause" A single human error: I'm about to end this man's whole career
RipleySawzen 7 godzin temu
To say this problem is unsolvable is ludicrous. The only way that happens is if the trip is somehow one-way. Otherwise, the sender can just keep sending the request till it gets a confirmation. Computers can do this literally millions of times a second, so probability dictates this eventually WILL happen 100.0000000% of the time. You can make the probability arbitrarily as high as you like. Now, if there is some significant packet loss going on somewhere, you just display the "Cannot contact server" message and send a few dozen cancellation packets just to be sure.
dfasdfasdfasdf 7 godzin temu
A lot of FUD in the intro, when this problem is not affecting people in the real world hardly at all anymore.
Ricky 9 godzin temu
The great part of this episode of the basics is that it is more like 2 episodes, one about the generals problem, and one about password managers.
a z
a z 10 godzin temu
The two general's problem is nonsenical because war is never planned and structured this way. Instead the following applies: There will be ONE general and TWO commanders each commandeering one army. The general plans and sends messages to the commanders and they execute his/her commands relaying relevant feedback to the general so the general has realtime information on the state of play from the perspective of each commander. Extrapolating, you see this in IT in every large corporate as the admin (or general) sends out messages to each commander (each computer attached to the corporate network) with the computers relaying realtime statuses back to the admin. By contrast the foodordering problem is one of STRUCTURE and is analogous to the following battle structure. you are the general, you have one army and one commander but the army is fragmented into different specialisms (eg tanks, jet fighters, ground soldiers etc etc ) with each specialism controlled by a lieutenant. The structure SHOULD BE that the general commands the commander and the commander relays to each lieutenant HOWEVER some of the lieutenants are BYPASSING the commander and relaying directly to the general thereby creating INFORMATION-CONFUSION, and this is combined with the fact information lines between the general and the commander have been cut. The general thus doesn't have correct realtime information. Therefore the solution is that the lieutenants ONLY exchange information with the commander and anytime general-commander information lines are cut the commander issues a "STOP WHAT YOU ARE DOING" command to every lieutenant. Extrapolating and applying this to the food ordering system, the user (general) is communicating with the app (commander), the app then communicates to each lieutenant (eg food ordering, delivery, payment etc etc) and anytime the information line between user-general and app-commander is cut the app-commander issues a "STOP WHAT YOU ARE DOING" command to every lieutenant
Neodimium 10 godzin temu
The solution is send them information in quantum entanglement state. (-;
Wolf Slayer
Wolf Slayer 10 godzin temu
even thieves can't avoid a traceable digital fingerprint....just a logical fact.
4our 20wenty
4our 20wenty 12 godzin temu
The actual same thing happens to me
Louis Wouters
Louis Wouters 12 godzin temu
But they don't know that we know they know!
Ursula Panzer
Ursula Panzer 13 godzin temu
Just go around the castle and talk to them
Vagabond Wastrel
Vagabond Wastrel 13 godzin temu
obviously war drums or bag pipes.
The Sinful Gamer
The Sinful Gamer 14 godzin temu
That problem isn't nearly that difficult. Once A has sent B a message, B sends a message back, confirming they got that message, A then sends a confirmation that they have indeed got the message, if they get a reply to that message, they are all good, considering they both at this point understand at 8pm they would attack, both would attack.
Matt Kazachinsky
Matt Kazachinsky 14 godzin temu
Am I the only one that got an ad for that same company?
ano nym
ano nym 17 godzin temu
Couldn't the message chain be: Red: We attack at 8PM. Blue: we both Attack at 8PM, please confirm that this message is recieved. Red: Your message is recieved, we will both attack at 8. Regardless of if the last message makes it, they will both have the agreement to attack.
FateEntity 19 godzin temu
Video IMMEDIATELY jumps into it and I felt lost and confused about what was going on. Maybe have a small few second intro or a preface? Disliked.
TechByte 19 godzin temu
So how exactly does this fix the two generals problem? There’s still now way for each general to know if his message made it...
terrorzilla 19 godzin temu
Had a similar problem ordering pizza in the USA recently. I actually got the order acknowledgement and tracker notice after the pizza arrived. Like you, I suspected it had worked and was right.
Famalamadingdong GE/PD
Famalamadingdong GE/PD 20 godzin temu
Suggest recipes for Tom to cook tbh
Mohsen Javaed
Mohsen Javaed 20 godzin temu
Cheese Borger
Cheese Borger 21 hour ago
These comments are excellent, wish I could see them more than once!
Cheese Borger
Cheese Borger 21 hour ago
These comments are excellent, wish I could see them more than once!
Sean Webb
Sean Webb 21 hour ago
Captain Kirk would have solved the problem.
Paul Anderson
Paul Anderson 22 godzin temu
Figured it out - the general would turn his entire division, including himself into messengers. Crisis averted, you're welcome.
shake bake
shake bake 23 godzin temu
Please do a video that explains to us simple/matrix folk, why we have to enjure annoying adverts that nobody acknowledge's, understands or care's for. Let alone ever buys from? The moon landing or 9/11 makes more sense 🚀🙄
Gold Fishy
Gold Fishy Dzień temu
But his token solution doesn’t actually solve the generals problem presented in the beginning. However, a solution to the generals problem was discovered in 2009. That solution was Bitcoin. Seriously. Google it.
SnipahWoolF Dzień temu
Wrong! there is a solution for this Problem, it's called quantum entanglement.
Luny Moon
Luny Moon Dzień temu
Couldn't you just have the messengers meet in the middle, shout the time, and then run back quick as they can?
Dank_Bandit Dzień temu
To solve the two generals problem, just tell the other side to raise tall flags before the attack begins to signal that its time. Is there some way that wouldn't work? Both sides of the valley are above the castle so that won't be blocking their view.
Kronus Exodues
Kronus Exodues Dzień temu
okay, what about the solution of brute forcing this? A sends B a hundred messages that they'll attack at midnight. many of them might get decepted, but a few ought to get through. A then just relies on the brute force being successful, B relies on A relying on it, both attack at midnight and win. and if B gets that message multiple times, that's no tragetdy either. Is that brute force approach something that get's done in practice?
GoodISnipr Dzień temu
Call of Duty is a game of Rock, Paper, Scissors. Play split screen local. Choose a loadout. Only 1. The other player, if they see what you chose, can then choose their loadout to have a very high kill/death ratio. But, this is why there are 5 custom loadout slots. Use them wisely and then take what you've learned and apply the principles in reality.
Tevan Pinrut
Tevan Pinrut Dzień temu
Power to the deliveroo strikers tho
StoneyGames Dzień temu
got randomly recommended this video an hour after it came out......... i am now subbed and have been bingeing your videos
Clarence's Real Life
Clarence's Real Life Dzień temu
why did I watch this so long hahaha
Nathaniel Echeverria
Nathaniel Echeverria Dzień temu
Walk around
jimifloydrix Dzień temu
Re: idempotency. How does the phone know that it's the same order twice? How do you prevent the phone from creating a new idempotency key the second time you request something?
Nil Haul
Nil Haul Dzień temu
Quantum computing
Ask to seduce Miss
Ask to seduce Miss Dzień temu
attack from different locations then one of the Generals takes their army there and waits for the agreed time.
Chuck Dzień temu
Only drawback to Dashlane is cost. Free as single use, but to sync it is expensive..
Ask to seduce Miss
Ask to seduce Miss Dzień temu
Solution: General A marches his army through the danger zone suffers losses and meets up with General B and army. They agree to attack at a set time. If it’s important that t
Jimmy Jams
Jimmy Jams Dzień temu
Take the long way round, at night?
filevans Dzień temu
where do they ever put castles in valleys? I've never seen one, all the ones I've seen are on hilltops
Prof.Tu.nichts Dzień temu
Use Smoke signs
Tay Woode
Tay Woode Dzień temu
I almost read the title as “The two genders problem” and was about to comment that there is only two genders, not 72 😂
Ultra .26
Ultra .26 Dzień temu
I thought it said the 2 genders problem
Leopard Bra Brado
Leopard Bra Brado Dzień temu
not accurate, a castlee would have been built on the highest point :)
Logan 22 godzin temu
Not neccessarily if the valley is an important trade route and it is surrounded my steep cliffs
Umar Abd Aziz
Umar Abd Aziz Dzień temu
If army A and B had send messages back and forth mentioning attack time at 8 pm, wouldn't you kinda know that 8 pm Is confirmed already?
Leopard Bra Brado
Leopard Bra Brado Dzień temu
army have received the message and both will attack at the same time.
oldcowbb Dzień temu
i was very skeptical of dashlane, but now it is tom scott verified, hmmm
Shemsy Dzień temu
Why not use a a pigeon?
Udai Kumar
Udai Kumar Dzień temu
My IQ increases watching even a single Tom Scott video.
Mercury2wo Dzień temu
So I understood the concept of “imdepotency” (forgive the miss-spelling) but how does that solve the “2 Generals Problem” who want to attack at the same time?
Mitchell Wong Ho
Mitchell Wong Ho Dzień temu
Best narration of Game of Thrones ever!
Stalking Like Candy
Stalking Like Candy Dzień temu
Is Tom 20 or 50?
Luna Protege
Luna Protege Dzień temu
How does Hashgraph solve this?
Danté Dzień temu
A sends a messenger, then B sends a messenger halfway back with A's messenger, and they both leave from the castle to their respective armies making sure the other makes it past the castle, then both armies know the message has been sent. This wouldn't apply to coding, but it follows the rules of the riddle.
Mark Hansen Muzyka
Mark Hansen Muzyka Dzień temu
Solution: General A marches his army through the danger zone suffers losses and meets up with General B and army. They agree to attack at a set time. If it’s important that they attack from different locations then one of the Generals takes their army there and waits for the agreed time.
MightyElemental Dzień temu
I had this exact problem when buying plane tickets. So I ended up buying duplicate plane tickets.
112steinway Dzień temu
I'm sorry, but if someone is stupid enough to build a fortress at the bottom of a valley like that AND allow two armies to surround them like that...then they're not very good at their jobs.
Everyday Learner
Everyday Learner Dzień temu
Where and when did the problem happened? Is there a captain here?
CommanderS Dzień temu
Wow, this is a really interesting problem I hadn't thought about before. Thanks, Tom!
Blinded Toaster
Blinded Toaster Dzień temu
Send the original messanger back. Jesus it's so simple.
Louis Wouters
Louis Wouters 12 godzin temu
In both cases B won't know that A received the confirmation so they will nkt attack, because they can't be sure that A is going to attack
A VERY horny Mr.Dinosaur
A VERY horny Mr.Dinosaur Dzień temu
but did you _REALLY_ order that food, or was it just for the story purposes?
RaisedByCats Dzień temu
What if both generals send a messenger simultaneously. The messengers meet in the middle and negotiate a time for the attack. Once agreed on a time, they each set off back to their home base. If one is killed, the other messenger sees that, knows the attack is off and relays that information to their general. When the dead messenger doesn't come back, their general knows no agreement was made on timing and that the attack is off. If both are killed, neither returns and the generals know the attack is off. If one or both messengers are killed, the generals send another two messengers to try again. However, if both messengers return, they both have knowledge of the timing of the attack and that the other messenger wasn't killed.
F M Dzień temu
What about creating a third army consisting of soldiers from both armies and place it in the middle where the original armies can view it and attack when the new army attacks. A third reliable server, perhaps a satellite can solve this issue by receiving and recording data from both parties and re-communicate what it received to assure correct information during transactions. Expensive, but solvable. Edit: Another simpler solution is to not to attack until the same messenger sent has arrived back, which would assure the other army have received the message and both will attack at the same time.
leonselbst Dzień temu
not accurate, a castlee would have been built on the highest point :)
xcheesyindianx Dzień temu
To be honest, the biggest problem I see is that someone put a fort in a valley and not at the top of one of the hills...
Joel Walby
Joel Walby Dzień temu
Also a situation where a fast cryptocurrency could be used. To reliably prove a transaction has taken place.
pixlion Dzień temu
If there’s one known point that the chance of failure to send the message always happens at. What if you send two messengers, and at that point one goes back while the other continues, the one that went back can tell wether the other succeeded or not. And in the event it works they can storm the fortress together.
OrcinusDrake Dzień temu
I don't get it, didn't you just solve the problem? General A sends the message and asks for a confirmation. They wait the return trip, if confirmation arrives great. If it doesn't arrive then resend the message. General B receives the message, then responds with the confirmation. They assume the confirmation was a success unless they receive the same message again, in which case they just resend their confirmation.
Rem Sutton
Rem Sutton Dzień temu
This happened to me on saturday with uber eats
spam onme
spam onme Dzień temu
Way back in 2000 JSP had session IDs, to help mitigate this problem.
Lol Xava
Lol Xava Dzień temu
Is 4Strefa your full time job??
Dingo Prod
Dingo Prod 2 dni temu
really interesting :-)
Reid Wallace
Reid Wallace 2 dni temu
Rather than feeling you have to choose between trusting your credit card info to a poorly coded app OR cooking yourself... you could phone a restaurant that still employes its own delivery staff... and order food the way that involves somebody being payed decently and not have to worry about some 'disruptive' big tech nonsense resulting in a 90 minute wait for pizza.
Why You Can't Trust Me
Wyświetleń 1 059 695
How Auto-Tune Works
Wyświetleń 660 058
Why You Can't Trust Me
Wyświetleń 1 055 312
The Bielefeld Conspiracy
Wyświetleń 924 631
Taylor Swift - Lover (Lyric Video)
Miley Cyrus - Slide Away (Audio)
Wyświetleń 3 319 782
Wyświetleń 290 210
Wyświetleń 72 404