I Β· One Machine Β· Chapter 4

A Third Machine

Theo lives on the floor above Mira. He has seen the wire, he has heard that the two of you can send each other messages over it, and he would like to join in. The wire, as it happens, runs right past his window on its way to hers, so one afternoon he splices a tap into it and connects his own machine. Now there are three cards on one wire.

Nothing about the wire has changed. It still carries bits, in order, mostly right. Your card still frames them and checks them, and so does Mira’s, and so does Theo’s. That is the problem. You send Mira meet at 7, and your card frames it and puts it on the wire. The wire is one continuous conductor, and the voltage your card puts on it appears everywhere along it, at Mira’s tap and at Theo’s tap alike. Both cards see the start marker. Both read the length. Both collect the content. Both verify the check, which passes, because the frame is fine. Both hand meet at 7 up to their machines, and Theo turns up at seven.

There is nothing in the frame that says it was for Mira, and nothing in the frame that says it was from you. It is a frame, it is on the wire, and every card on the wire receives it. Until this afternoon that was fine, because there was only ever one other card. Now there are two, and your messages have become announcements. It is worse from Theo’s side. He receives every frame you and Mira exchange, and he has no way to tell which of them, if any, are for him. If he wants to reply to something, he does not know who sent it. The wire delivers frames. It does not deliver context.

The fix is one you have already used, in a way, when you imagined shouting across the courtyard in Chapter 2. You said her name first. So do that in the frame, and add a field to the header that says who the frame is for. Every card is given a name. Before a card hands a frame up to its machine, it looks at the destination field. If the name matches its own, it passes the frame up. If not, it drops it, and the machine never knows the frame existed.

While you are adding a field, add the source as well, the name of the card that sent the frame. It costs a few bytes, and without it Theo cannot reply to a message unless he already knows who it came from. With it, any card can answer any frame, because the return address is in the header.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”
β”‚ start marker β”‚ destination β”‚ source      β”‚ length β”‚ content β”‚ check β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
loading…

The header grows. Two names, then the length. Everything the card needs to decide whether this frame is its business.

This filtering happens in the card. Theo’s machine, meaning the operating system and his programs, never sees a frame that was not addressed to it. That is a deliberate courtesy, and an efficient one. The card is a small dedicated piece of hardware, and checking a name is cheap for it, whereas waking the whole machine to look at a frame and throw it away would be wasteful. It is, however, only a courtesy. A card can be told to stop filtering and pass everything up. Theo could do that, and he would see every message you and Mira ever sent, addressed to him or not, because the frames still arrive at his tap and his card has only been politely ignoring them. That fact will matter a great deal in Chapter 21.

You have agreed that frames carry names. You have not agreed what the names are, and this turns out to be the interesting part. The first attempt is the obvious one. The three of you sit down and agree that you are 1, Mira is 2, and Theo is 3. It works for as long as the three of you are the only machines on the wire. The following weekend Priya on the ground floor taps in. Nobody told her about the numbering. She looks at her card and, reasonably, picks 2. Now there are two cards that answer to 2. You send Mira a message; Priya’s card receives it and passes it up; Priya replies; Mira replies; and you have two answers to one question and no way to tell them apart. Hand-assigned names work until the first person who was not in the room, and there is always a person who was not in the room.

The second attempt is to make someone the keeper of names. Priya’s machine, when it joins, has to ask the keeper for a name before it does anything else. The keeper hands out numbers in order and never repeats one. But how does Priya’s machine ask? By sending a frame on the wire. What goes in the frame’s source field? Her name, which she does not have yet; that is why she is asking. You could leave the source blank, but then the keeper cannot address the reply to her, because she has no name to address it to. There is a chicken and an egg here, and it is not obvious how to break the circle. This same circularity, needing a name in order to ask for a name, is going to come back in Chapter 6, and the way it is resolved there depends on what you are about to decide here.

The third attempt gives up on coordination altogether. Make the space of possible names so enormous that everyone can pick one at random and collisions essentially never happen. Forty-eight bits gives you about 281 trillion names. If every machine on Earth picked one at random, the chance of any two colliding would be tiny. Tiny is not zero, though, and β€œessentially never” is an uncomfortable thing to build on. But you are close. The insight of the third attempt, to use a huge space, is right. The trouble is only that random picking gives you no guarantee.

What actually happened is a fourth thing. Assign the name once, at the factory, before the card is ever plugged in. Divide the 48-bit space among manufacturers: the first 24 bits identify the company that made the card, and the company assigns the remaining 24 bits, about sixteen million per company, one to each card it builds, never reusing one. Every card leaves the factory with a name that, by construction, no other card in the world has. There is no coordination on the wire, no keeper to ask, and no chance of collision. When Priya taps in, her card already has a name, given to it in a factory she has never heard of, and that name is guaranteed not to be Mira’s.

This is called a MAC address, and you will see it written as six bytes in hexadecimal, separated by colons.

a4:83:e7:2b:91:0c
β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”˜
manufacturer   serial

It is the card’s name for life. Your machine has one, or several, one per card. You have almost certainly never needed to know what it is, and that is the point. It was settled before you ever touched the machine.

There is a bonus that falls out of having names, and you will need it soon. Reserve one name, all ones, ff:ff:ff:ff:ff:ff, to mean everybody. A frame addressed to it is accepted by every card on the wire, whatever its own name. This is called a broadcast, and it costs nothing to add, since you are only agreeing that one particular value in the destination field is special. You do not need it today. You will in two chapters, when a machine needs to ask a question of a wire full of machines without knowing which one has the answer.

There is a second problem with sharing the wire, and it is physical rather than logical. Mira and Theo both decide to send something at the same moment. Both cards put voltages on the wire. The wire is one conductor and cannot carry two different voltages at once; what it carries is the sum of both signals, which corresponds to neither frame. Every card on the wire, including the two senders, receives a smear of bits that means nothing. Chapter 3’s check catches it, at least. The smeared frame fails its check and is dropped, and nobody acts on garbage. But two frames have been lost, and the wire was busy the whole time carrying nothing useful.

The first answer to this, historically, was etiquette. Before sending, a card listens, and if the wire is busy it waits. If two cards start at almost the same instant anyway, which happens, because the signal takes time to travel and each card may hear silence for a moment after the other has begun, both detect the collision, stop at once, wait a random amount of time, and try again. The randomness matters. If they both waited the same fixed time, they would collide again. The idea came from radio rather than wire. In 1971 Norman Abramson’s group at the University of Hawaii built a network that linked the islands’ campuses over a shared radio channel, and since any station could transmit whenever it liked, collisions were a fact of life to be recovered from rather than prevented. When Robert Metcalfe and David Boggs designed the shared wire at Xerox in 1973, they borrowed the approach and added the listening. It works, and for a couple of decades it was how most wires like yours were run.

But it degrades. Add more machines and the wire is busy more often; busier wires collide more; collisions waste time; wasted time makes the wire busier. A wire with three machines on it collides rarely. A wire with thirty spends a noticeable fraction of its life carrying smears.

The answer that won is simpler, and you can probably see it coming. Do not share the wire. Put a box in the middle of the courtyard and give it a socket for every machine. Run a private wire from each machine to the box. Nobody’s card is on anybody else’s wire; the only things on your wire are you and the box.

Now the box does the work. When a frame arrives from you on your wire, the box reads the destination name in the header and copies the frame onto one other wire, the one that leads to that name. It never puts the frame on Theo’s wire unless the frame is for Theo. How does it know which wire leads to which name? It watches. Every frame that comes in has a source name and arrived on a particular wire, and the box notes that this name lives on this socket. After a few frames it has learned where everyone is, and if it sees a name it does not know, it copies the frame to every socket and waits to see who answers.

loading…

On the left, four machines on one shared wire. Every frame lights every card, and two senders at once produce a smear. On the right, the same four machines, each on a private wire to a box. Frames go only where they are addressed, and two senders never collide.

Collisions vanish, because no two cards ever share a conductor. Theo’s card stops seeing your messages, not out of courtesy this time but because they were never on his wire. Two conversations can happen at once, you to Mira and Theo to Priya, with no interference, because they run on different wires through the box. And the wire that was straining at thirty machines now scales to hundreds, limited only by how many sockets you can put on the box.

This box is called a switch, and it is what every wired network you have ever plugged into has been built from for the last thirty years. Its little table of names and sockets is the first table in this book, and it will not be the last. A word is due on the courtesy from earlier. The switch makes casual eavesdropping harder, because your frames are not on Theo’s wire any more. But they are still on yours, and on the switch, and anyone with access to either can still read them. The courtesy has become a locked door rather than a politely averted gaze, but it is a door with keys in several pockets, and we come back to it in Chapter 21.

Before you leave this chapter, look again at the name your card was given.

a4:83:e7:2b:91:0c

What does it tell you about where the card is? Nothing. It tells you who manufactured it and roughly when. It does not say which building, which courtyard, or which wire. Two cards from the same factory batch, with names one apart, could be on opposite sides of the world. The switch got away with this because its table is small. Three machines, four, a few hundred: the box can remember every name it has ever seen and which socket it lives on. But the names have no structure. There is no way to look at one and say that it is in Mira’s building, and no way to group them. Every name is a separate fact that has to be separately learned and separately stored. For one courtyard that is fine. It stops being fine the moment there are two.

Coming up Β· IΒ·5 β€” The Second Network

A name that says nothing about location works while everyone shares one switch. In the next chapter Mira’s building gets a switch of its own, and a machine in between has to decide which way to forward, with names that give it no clue.

β†’