The "Goodbye" Problem - Computerphile

Computerphile · Beginner ·📐 ML Fundamentals ·1y ago

Key Takeaways

The video discusses the 'Goodbye' problem in computer networks, specifically in the context of Transmission Control Protocol (TCP) connections, and how it relates to the two generals problem, a classic problem in computer science that illustrates the difficulty of achieving consensus in the presence of unreliable communication. Dr Richard G. Clegg explains the concept of a polite protocol, the three-way handshake, and the challenges of closing a TCP connection.

Full Transcript

have you uh ever heard it said sometimes it's hard to say goodbye if you're teenagers in love and you're chatting away on the phone at least when I was young you you'd be talking and a and you finish your phone call but you really like that person you're awkward you're an awkward teenager oh you say goodbye first no you say goodbye first oh no you say goodbye no are you still there have you said goodbye so now all right what's that got to do with computer science what's that got to do with networks when we are communicating with computers most of modern uh internet connections are using transmission control protocol TCP right we've talked about it a few times on the channel TCP I always told my students it's a polite protocol it begins with a hand hand shake a three-way handshake cuz we we establish a connection I don't just go hey get some data I go hey um uh can I can I give you some data yeah if you want to yeah I'm ready to give you some data ready so it's it's the three-way handshake so let's start off with saying hello the problem here is we need to be robust to failure it's the internet no matter how much you design it an individual message might be corrupted might just not get delivered so we want to set up a system where the client can connect to the server and know it's connected and the server also knows it's connected so say say hello it's fine we start off with a packet we call an Sy YN a sin packet so this is to create the TCP connection the S packet if it goes missing after a certain amount of time or another one but let's for the sake of simp say it hasn't and now the server should reply with a sin act so that act is an acknowledgement it's saying ah thank you for uh your interest in connecting with me today uh I would also like to connect to you and then the client is going to send back an act and it's going to send back some data as well so this is the data might be like please send me a web page or I would like to open an SSH session or something whatever it's the thing the client's going to send and that works really well and if one of these is lost you send it again H all fine but closing down it seems like it's going to be the same problem so Finn oh bye Sean see you see you okay uh so you're going to send back so I send a Finn finac and fin obviously cuz it's a fin no dare there that seems kind of symmetrical right but you also need to shut down the computer at some point and then what happens if a packet goes missing when we were opening up the connection it's easy the computer's still connected if something's not sent after a little bit of time send it again but here if something's not sent you've Switched Off you're not going to send it again now this is going to seem like a big segue big kind of jump of uh what we're doing let's Imagine This is called the two generals problem so here ah I am not a splendid digital artist here's a general with a sword so there's the purple General and there's the green General and they both want to attack this city here and they know if they attack together they win if only one of them attacks and the other one hasn't got a message they Le they're free to send messages but the messages might be intercepted by the enemy so attack green General sent a message to the purple General to attack H but it's going to go past the very thing they're trying to attack maybe it's going to be intercepted so you think when you first hear this it seems like child is she simple right right I mean what would you what would you do what sort of system might you set up well you got to you got to get somebody to do a bit like the hello the ACT send a message back saying okay got your message thank you yeah okay so he just going to send up uh okay yeah send an I will attack goodness me so he's sent back and I will attack all right so he sent an attack and they sent I will attack and if that happens oh that's great right we're both going to attack but any of these messages might go missing so let's imagine that message goes missing so he's sent out attack he sent I will attack but that's that message is died that messenger has been shot by the enemy City purple General charges in or confident green General hasn't got his receipt so green General sitting on the hillside going uh what can I do purple General's Ked and you can keep on going this you think the first time you hear this problem you think there's got to be a solution there's got to be some way of doing it provably provably this is impossible the sort of sketch proof is imagine there is some message MN so in a in a deterministic protocol some protocol where receipt of messages has a determined not a probabilistic meaning um if there some message MN that if it was received definitely means attack so MN received implies attack if that is the case then if m is received by a general it means attack the other General is therefore bound to attack but if that message is lost the general receiv receiving it won't attack so any message that you you say is going to be the last one which definitely means attack could be lost so this this problem exactly maps onto the TCP finish problem the general attacking it's a a committed irrevocable action just like shutting down the TCP connection if I decide to shut down my TCP connection I won't hear your message saying please could you repeat your acknowledgement so so this weird thing that the seemingly symmetrical actions of opening a tcv connection very very easy polite triple handshake Sin Sin a a closing down your TCB connection no it just doesn't work I've been teaching this for many many years and every year it just annoys me it should be easy but it's provably impossible how do we solve it in real life honestly it's what you'd call a clutch you just kind of wait around a little bit you you say oh yeah yeah definitely going to shut down and then you swe around go you still there it's like the teenager on the phone it's like the teenager on the phone have you said goodbye Sean yeah I'm just still listening waiting for a click used yeah yeah you used to get the click on the old phones that's true not on the modern ones not on the modern ones so yeah it's uh hard to say goodbye about here is what's called time to live every Internet Protocol packet when it's created is set up with this flag time to live it's as if they've all got a Doomsday Clock on them um they've got a little counter

Original Description

You say "bye" first! - no, you say "bye" first! - how do you know when to close the connection? Dr Richard G. Clegg of Queen Mary University London talks us through this frustrating network problem. nb As some eagle-eyed commenters have spotted, Richard meant to say FIN FIN/ACK ACK for the shut down sequence. Computerphile is supported by Jane Street. Learn more about them (and exciting career opportunities) at: https://jane-st.co/computerphile This video was filmed and edited by Sean Riley. Computerphile is a sister project to Brady Haran's Numberphile. More at https://www.bradyharanblog.com
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Computerphile · Computerphile · 0 of 60

← Previous Next →
1 Follow the Cookie Trail - Computerphile
Follow the Cookie Trail - Computerphile
Computerphile
2 EXTRA BITS - Follow the Cookie Trail - Computerphile
EXTRA BITS - Follow the Cookie Trail - Computerphile
Computerphile
3 Musical Floppy Drives - Computerphile
Musical Floppy Drives - Computerphile
Computerphile
4 The Hair Algorithm - Computerphile
The Hair Algorithm - Computerphile
Computerphile
5 Getting Sorted & Big O Notation - Computerphile
Getting Sorted & Big O Notation - Computerphile
Computerphile
6 Quick Sort - Computerphile
Quick Sort - Computerphile
Computerphile
7 Hyper History and Cyber War - Computerphile
Hyper History and Cyber War - Computerphile
Computerphile
8 Entropy in Compression - Computerphile
Entropy in Compression - Computerphile
Computerphile
9 Original Elite on the BBC B - Computerphile
Original Elite on the BBC B - Computerphile
Computerphile
10 IP Addresses and the Internet - Computerphile
IP Addresses and the Internet - Computerphile
Computerphile
11 A Career in Video Games - Computerphile
A Career in Video Games - Computerphile
Computerphile
12 Error Detection and Flipping the Bits - Computerphile
Error Detection and Flipping the Bits - Computerphile
Computerphile
13 Programming BASIC and Sorting - Computerphile
Programming BASIC and Sorting - Computerphile
Computerphile
14 Birthplace of the World Wide Web - Computerphile
Birthplace of the World Wide Web - Computerphile
Computerphile
15 Punch Card Programming - Computerphile
Punch Card Programming - Computerphile
Computerphile
16 Programming Paradigms - Computerphile
Programming Paradigms - Computerphile
Computerphile
17 CERN Computing Centre (and mouse farm) - Computerphile
CERN Computing Centre (and mouse farm) - Computerphile
Computerphile
18 Error Correction - Computerphile
Error Correction - Computerphile
Computerphile
19 Home-Made Code - Computerphile
Home-Made Code - Computerphile
Computerphile
20 Security of Data on Disk - Computerphile
Security of Data on Disk - Computerphile
Computerphile
21 Gesture Controls - Computerphile
Gesture Controls - Computerphile
Computerphile
22 How Intelligent is Artificial Intelligence? - Computerphile
How Intelligent is Artificial Intelligence? - Computerphile
Computerphile
23 Encryption and Security Agencies - Computerphile
Encryption and Security Agencies - Computerphile
Computerphile
24 Virtual Machines Power the Cloud - Computerphile
Virtual Machines Power the Cloud - Computerphile
Computerphile
25 Hacking Websites with SQL Injection - Computerphile
Hacking Websites with SQL Injection - Computerphile
Computerphile
26 How Huffman Trees Work - Computerphile
How Huffman Trees Work - Computerphile
Computerphile
27 Cracking Websites with Cross Site Scripting - Computerphile
Cracking Websites with Cross Site Scripting - Computerphile
Computerphile
28 Cloud Computing (Cloudy with a Chance of Pizza) - Computerphile
Cloud Computing (Cloudy with a Chance of Pizza) - Computerphile
Computerphile
29 Texting Cabbage with a Recorder - Computerphile
Texting Cabbage with a Recorder - Computerphile
Computerphile
30 Hashing Algorithms and Security - Computerphile
Hashing Algorithms and Security - Computerphile
Computerphile
31 How YouTube Works - Computerphile
How YouTube Works - Computerphile
Computerphile
32 How NOT to Store Passwords! - Computerphile
How NOT to Store Passwords! - Computerphile
Computerphile
33 A New Golden Age of Video Games - Computerphile
A New Golden Age of Video Games - Computerphile
Computerphile
34 A Universe of Triangles - Computerphile
A Universe of Triangles - Computerphile
Computerphile
35 Cross Site Request Forgery - Computerphile
Cross Site Request Forgery - Computerphile
Computerphile
36 The True Power of the Matrix (Transformations in Graphics) - Computerphile
The True Power of the Matrix (Transformations in Graphics) - Computerphile
Computerphile
37 The Great 202 Jailbreak - Computerphile
The Great 202 Jailbreak - Computerphile
Computerphile
38 EXTRA BITS - Printing and Typesetting History - Computerphile
EXTRA BITS - Printing and Typesetting History - Computerphile
Computerphile
39 Triangles to Pixels - Computerphile
Triangles to Pixels - Computerphile
Computerphile
40 The Problem with Time & Timezones - Computerphile
The Problem with Time & Timezones - Computerphile
Computerphile
41 The Visibility Problem - Computerphile
The Visibility Problem - Computerphile
Computerphile
42 Lights and Shadows in Graphics - Computerphile
Lights and Shadows in Graphics - Computerphile
Computerphile
43 The Penguin Barcode - Computerphile
The Penguin Barcode - Computerphile
Computerphile
44 Typesetters in the '80s - Computerphile
Typesetters in the '80s - Computerphile
Computerphile
45 The Font Magicians - Computerphile
The Font Magicians - Computerphile
Computerphile
46 The Little Mac with the Big Bite - Computerphile
The Little Mac with the Big Bite - Computerphile
Computerphile
47 EXTRA BITS - More on the Original Mac at 30 - Computerphile
EXTRA BITS - More on the Original Mac at 30 - Computerphile
Computerphile
48 XP to Ubuntu with an 8yr old Hacktop - Computerphile
XP to Ubuntu with an 8yr old Hacktop - Computerphile
Computerphile
49 EXTRA BITS - Hacktop Real-Time Boot Comparison - Computerphile
EXTRA BITS - Hacktop Real-Time Boot Comparison - Computerphile
Computerphile
50 EXTRA BITS - Making a Bootable USB in Linux - Computerphile
EXTRA BITS - Making a Bootable USB in Linux - Computerphile
Computerphile
51 EXTRA BITS - Installing Ubuntu Permanently - Computerphile
EXTRA BITS - Installing Ubuntu Permanently - Computerphile
Computerphile
52 The Dawn of Desktop Publishing - Computerphile
The Dawn of Desktop Publishing - Computerphile
Computerphile
53 What is Bootstrapping? - Computerphile
What is Bootstrapping? - Computerphile
Computerphile
54 Reverse Polish Notation and The Stack - Computerphile
Reverse Polish Notation and The Stack - Computerphile
Computerphile
55 Home-Made Z80 Retro Computer - Computerphile
Home-Made Z80 Retro Computer - Computerphile
Computerphile
56 Should Everybody Learn to Code? - Computerphile
Should Everybody Learn to Code? - Computerphile
Computerphile
57 Programming in PostScript - Computerphile
Programming in PostScript - Computerphile
Computerphile
58 Heartbleed, Running the Code - Computerphile
Heartbleed, Running the Code - Computerphile
Computerphile
59 YouTube's Secret Algorithm - Computerphile
YouTube's Secret Algorithm - Computerphile
Computerphile
60 YouTube Search & Discovery - Computerphile
YouTube Search & Discovery - Computerphile
Computerphile

The video explains the 'Goodbye' problem in computer networks, which is related to the two generals problem, and discusses how it is addressed in TCP connections. The problem arises when trying to close a connection, and the solution involves using a timeout mechanism, such as the time to live flag in IP packets. The video provides a detailed explanation of the three-way handshake and the challenges of connection closure.

Key Takeaways
  1. Understand the three-way handshake in TCP connections
  2. Recognize the challenges of closing a TCP connection
  3. Apply the concept of time to live to IP packets
  4. Design a network protocol that addresses the 'Goodbye' problem
  5. Implement a connection closure mechanism
💡 The 'Goodbye' problem in computer networks is a fundamental challenge that arises when trying to close a connection, and it is related to the two generals problem. The solution involves using a timeout mechanism, such as the time to live flag in IP packets.

Related AI Lessons

Up next
Learn Deep Learning by Hand (Beginner's Guide - Part 1)
Thu Vu
Watch →