Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 05 · How Computers Work · Talking to the kernel · with code: Go · about 17 min to read

Play it as a journeyTutor comes with a plan

The five calls that open a door

TCP Handshake
TCP Handshake · Open board

The opening exchange of a network connection, three short messages in real bytes. This lesson is about the five calls a program makes so that the kernel will do that exchange for it, and what each call leaves behind.

Before you start. A process is one running program. The kernel is the core of the operating system, the one part allowed to touch the hardware. A program reaches the outside world through numbered doors the kernel hands it. Each door is a file descriptor, a small whole number the program passes to read and write (Everything is a file descriptor). A network connection opens with three short messages that the kernel exchanges for you, called the handshake (TCP vs UDP, and the 3-way handshake), and a program that has nothing to do goes to sleep instead of checking over and over (Waiting without spinning).

Lesson 28 of 41 in How Computers Work

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1986: one program waits at every door
  • socket: an empty unit, and a number for its key
  • bind: put the street address over the door
  • listen: unlock the door and put a bench behind it
  • accept: call the next caller into a private booth
  • connect: the only call the caller makes

Terms it explains: socket, backlog.

Lab

The pipe is 100 Mbps and the file is 1 MB. Why does the round-trip time decide how long it takes?

Drag How far away the server is out to the satellite, then press Play next flight and watch The clock.

Open The TCP handshake

Related paper

Review How Computers Work