magicskoolbus.com

Field trips for curious grown-ups.

The Magic Skool Bus

Pick a destination, climb aboard, and the bus drives you through how it works, one short stop at a time.

Choose a trip โ†“

Where to today?

Field trip

Inside a CPU

Shrink down and ride one instruction through a processor core.

Stop 1 of 5Fetch: grab the next instruction

A program is a long list of tiny instructions sitting in memory. The program counter is a register that holds the address of the next one, and the fetch stage reads the bytes at that address, almost always from the core's small, fast instruction cache rather than from main memory.

Waiting to find out where a branch goes would leave the pipeline idle, so the core guesses. A branch predictor learns the patterns of past jumps and the front end keeps fetching down the predicted path. A wrong guess means throwing that work away and starting again from the right address.

Stop 2 of 5Decode: work out what it means

The fetched bytes are just a bit pattern. The decoder splits it into fields: which operation (add, load, compare, jump), which registers it reads and writes, and any constant baked into the instruction. Out come the control signals that steer the rest of the core.

How hard this is depends on the instruction set. 64-bit Arm instructions are all 4 bytes long, so finding where each starts is easy. x86 instructions range from 1 to 15 bytes, and x86 cores usually translate them into simpler internal micro-operations before execution.

Stop 3 of 5Execute: do the actual work

Execution units do the arithmetic: integer ALUs add, shift and compare; floating-point and vector units handle decimals and do many numbers at once; load and store units move data between registers and memory.

The work is pipelined like a laundry line: while one instruction executes, the next is decoding and another is being fetched. Fast cores also execute out of order, starting any instruction whose inputs are ready, then retiring the results strictly in program order so the program never notices the shuffle.

Stop 4 of 5Cache: keep the good stuff close

Main memory is far away in CPU terms: a trip to DRAM takes on the order of 100 nanoseconds, which is hundreds of clock cycles. So cores keep recently used data in a ladder of caches. L1 is tiny and answers in a handful of cycles, L2 is bigger and slower, and a large L3 is often shared by all the cores.

Memory moves in fixed-size chunks called cache lines. Touch one byte and its neighbours come along too, which is why walking an array in order is fast and hopping around memory at random is slow.

Stop 5 of 5Clock: the heartbeat

Everything above moves in step with a clock signal. A quartz crystal provides a steady reference, and a phase-locked loop multiplies it up to billions of ticks per second. On each tick, results latch into registers and the pipeline shuffles one stage forward.

Clock speed is not fixed: the chip boosts when it has power and cooling to spare and slows down when it is hot or idle. And speed is not only gigahertz. How many instructions a core finishes per tick matters just as much.

Field trip

A packet's trip across the internet

Type an address, press Enter, and follow what happens next.

Stop 1 of 5DNS: look up the address

Computers route by number, not by name, so first the name has to become an IP address. The browser and the operating system check their own caches, then ask a recursive resolver, usually run by your network provider or a public DNS service.

If the resolver doesn't already know, it asks a root server which servers handle the top-level domain (such as .com), asks those which servers are authoritative for the domain, and asks those for the A (IPv4) or AAAA (IPv6) record. Every answer carries a time-to-live, so it can be cached and reused.

Stop 2 of 5TCP handshake: say hello three times

Before any page data moves, the two machines set up a TCP connection. Your computer sends SYN, the server answers SYN-ACK, and your computer replies ACK. Each side picks a starting sequence number during this exchange.

Those sequence numbers are how TCP turns a messy network into a reliable stream: the receiver puts segments back in order, acknowledges what arrived, and the sender retransmits anything that went missing. It costs one full round trip before the first byte of the request can go.

Stop 3 of 5Routers and BGP: hop, hop, hop

Every packet carries a destination IP address. Each router it meets looks that address up in its forwarding table, picks the most specific matching route, and sends the packet out of the right interface towards the next router. No router knows the whole path, only the next hop.

The internet is tens of thousands of separately run networks called autonomous systems. They use BGP, the Border Gateway Protocol, to announce which address blocks they can reach. Routes are chosen by each network's policies and business relationships, not just by distance.

Stop 4 of 5TLS: lock the doors

For an https address, a TLS handshake comes next. The browser offers the versions and ciphers it supports plus a key share; the server answers with its own key share, its certificate and a signature proving it holds the certificate's private key.

The browser checks that the certificate chains up to a certificate authority it trusts and that it names the site it asked for. Both sides then derive the same secret keys from the key exchange, and from here on everything is encrypted and tamper-evident.

Stop 5 of 5Arrival: the server answers

At the server, the network card receives the packets and the operating system's TCP stack reassembles the bytes in order and hands them to the web server through a socket. The server reads the HTTP request and works out the response.

The response makes the whole journey in reverse, split into packets again. The browser then reads the HTML, discovers the stylesheets, scripts and images it references, and sets off on more trips to fetch them.

Field trip

Inside a camera

Follow the light from the front of the lens to a finished photo.

Stop 1 of 6Lens: bend the light

Glass slows light down, so a curved surface bends it. A lens uses that to gather light from each point of the scene and bring it back together at a single point on the sensor: that is focus. Focusing moves elements so the sharp image lands exactly on the sensor plane.

Focal length sets how much of the scene fits on the sensor. A longer focal length gives a narrower view and more magnification. Real lenses stack many elements to cancel out flaws such as colour fringing.

Stop 2 of 6Aperture: the adjustable hole

Inside the lens, a ring of overlapping blades forms an opening that can widen or narrow. The f-number is the focal length divided by the diameter of that opening as seen from the front, so f/2 is a wide opening and f/16 a small one.

A wider aperture lets in more light and gives a shallower depth of field: a sharp subject against a soft, blurry background. Close it down and more of the scene, front to back, is in focus.

Stop 3 of 6Shutter: how long to look

The shutter decides how long light reaches the sensor. Doubling the time doubles the light. A short exposure freezes motion; a long one turns moving water into silk and moving hands into blur.

A mechanical focal-plane shutter uses two curtains: one opens, the other follows it. At fast speeds the second curtain starts before the first has finished, so a narrow slit sweeps across the sensor. An electronic shutter instead reads the sensor row by row.

Stop 4 of 6Sensor: catch the photons

The sensor is a grid of millions of photosites. Light striking silicon frees electrons, and each photosite collects them during the exposure. Afterwards the charge is turned into a voltage and an analogue-to-digital converter turns that into a number.

A photosite measures only how much light arrived, not its colour. So a mosaic of tiny colour filters sits on top, most often in a Bayer pattern: in each 2ร—2 block, two green, one red and one blue. The missing colours at each pixel are filled in later.

Stop 5 of 6ISO: turn up the volume

ISO does not make the sensor catch more light. It sets how much the signal is amplified (and how the camera maps it to brightness) after the light has been collected. Doubling ISO brightens the result by one stop, like doubling the exposure time.

High-ISO photos look noisy mostly because they were taken in low light: with few photons, the random variation in how many arrive becomes a big share of the signal. Amplifying makes a dim exposure visible, noise and all.

Stop 6 of 6Image processor: develop the picture

The raw numbers don't yet look like a photo. The image processor subtracts the sensor's black level, fills in the missing colours (demosaicing), sets white balance, converts to a standard colour space, applies a tone curve, reduces noise, sharpens and corrects lens flaws.

A RAW file saves the sensor data before most of these decisions, so you can make them yourself later. A JPEG bakes them in and compresses the result. Phones go further and often merge several quick frames into one to cut noise.

Field trip

Into a 3D printer

From a 3D model to a solid object, one thin layer of plastic at a time.

Stop 1 of 5Slicer: cut the model into layers

It starts on a computer. A 3D model, usually a mesh of triangles in a file such as STL or 3MF, goes into a slicer, which cuts it into horizontal layers, often 0.2 millimetres thick.

For each layer the slicer plans the outer walls (perimeters), the solid top and bottom skins, a lighter infill pattern for the inside, and supports under any parts that would otherwise print in mid-air. It also estimates the time and plastic the print will take.

Stop 2 of 5G-code: the printer's to-do list

The slicer's output is G-code: plain text, one command per line. A line like G1 X10 Y20 E0.5 F1800 means move to X 10, Y 20 while pushing out 0.5 mm of filament, at 1800 mm per minute. Other commands heat the nozzle, heat the bed or send the axes home.

The printer's firmware reads these lines and turns them into precisely timed pulses for its stepper motors, each pulse turning a motor by a tiny fixed step.

Stop 3 of 5Hotend: melt and squeeze

Plastic filament, most often 1.75 mm across, is pushed by geared extruder wheels down into the hotend. A heater block melts it and a temperature sensor feeds a control loop that holds it steady: roughly 190 to 220 ยฐC for PLA, hotter for PETG.

A heat break and a fan-cooled heatsink keep the melting confined to a short zone just above the nozzle. If heat creeps further up, the filament softens too early and jams.

Stop 4 of 5Layers: build it up

The nozzle traces each layer's walls and infill, then the nozzle rises (or the bed drops) by one layer height and it does the next one. The first layer matters most: if it doesn't stick well to the bed, everything above it is at risk.

Each new layer fuses to the one below while it is still hot, but that bond is weaker than the plastic along a line. Parts break between layers far more easily, so designers orient prints so the force runs along the layers.

Stop 5 of 5Cooling: set it fast, but not too fast

A part-cooling fan blows on the freshly laid plastic so it hardens before the next layer lands on it. That is what makes crisp details, bridges between two points and overhangs possible.

Too much cooling can weaken the bond between layers, and plastic shrinks as it cools, which can pull corners up off the bed (warping). PLA likes plenty of airflow, while plastics like ABS do better warm, often in an enclosure.

Field trip

Freefall

The physics of a skydive, from the open door to boots on the grass.

Stop 1 of 5Exit: step into the wind

A typical sport jump leaves the aircraft at around 4,000 metres (about 13,000 feet). The plane is flying slowly for the jump, but you still leave with its forward speed, so at first the wind hits you from the front, not from below.

Gravity pulls you down at 9.8 metres per second, every second, while air resistance slows your forward speed. Over the first few seconds the wind swings round from horizontal to straight up beneath you.

Stop 2 of 5Terminal velocity: the speed limit

Air resistance grows with the square of speed. As you fall faster it climbs until it matches your weight, and then you stop accelerating: that steady speed is terminal velocity. Falling belly to earth it is roughly 190 to 200 km/h (about 120 mph); head down, much faster.

It takes around ten seconds to get there. After that there is no stomach-drop feeling at all. It feels like lying on a loud, firm cushion of air, and small changes of body shape steer you.

Stop 3 of 5Canopy: open the wing

Sport jumpers usually deploy around 900 to 1,200 metres. A small pilot chute catches the air and pulls the main canopy out of its container. A fabric square called the slider sits on the lines and slides down slowly, so the canopy spreads gently instead of all at once.

A modern canopy is a ram-air wing: cells along the front take in air and inflate into an aerofoil, so it flies forwards as well as down. In a few seconds you slow from freefall speed to a gentle descent.

Stop 4 of 5Flare: brakes on

You steer with two toggles that pull down the back edge of the wing on either side. Pull one to turn, both to slow down.

A few metres above the ground, the jumper pulls both toggles down smoothly. This tilts the wing to a higher angle and trades its forward speed for lift, briefly cutting the descent rate, much like an aeroplane's landing flare. Too early and the wing slows and drops you; too late and you land fast.

Stop 5 of 5Landing: feet first, then gather up

Jumpers land into the wind, so the wind's speed is taken off their speed over the ground. Feet and knees stay together, ready to roll if the touchdown is firm.

Then it's time to gather up the canopy and walk back to pack it. From exit to landing the whole trip takes only a few minutes, about a minute of it in freefall. This is a tour of the physics, not training: learning to skydive means proper instruction.