Search
Course outline
  1. 01How a computer works
    1. 1.1What is a computer?(completed)
    2. 1.2The CPU: the brain(completed)
    3. 1.3Memory: RAM vs storage(completed)
    4. 1.4How the CPU and memory work together(completed)
    5. 1.5What happens when you turn on a computer(completed)
  2. 02How the Internet works
    1. 2.1What is the Internet?(completed)
    2. 2.2Addresses and names: IP and DNS(completed)
    3. 2.3Packets: how information travels(completed)
    4. 2.4Client and server: opening a website(completed)
    5. 2.5Inside a busy server(completed)
    6. 2.6Why this matters for AI(completed)
  3. 03Introducing the GPU
    1. 3.1What is a GPU?(completed)
    2. 3.2CPU vs GPU(completed)
    3. 3.3The GPU's own memory: VRAM(completed)
    4. 3.4How the CPU and GPU work together(completed)
    5. 3.5Why GPUs suit AI(completed)
  4. 04Tensors and models
    1. 4.1What is a tensor?soon
    2. 4.2What is an AI model?soon
    3. 4.3Training vs inferencesoon
  5. 05Splitting work across GPUs
    1. 5.1Why split work across GPUs?soon
    2. 5.2Data parallelismsoon
    3. 5.3Tensor parallelismsoon
    4. 5.4Pipeline parallelismsoon
    5. 5.5Expert parallelismsoon
    6. 5.6Which to use whensoon
  6. 06Serving LLMs with vLLM
    1. 6.1What is LLM serving?soon
    2. 6.2Meet vLLMsoon
    3. 6.3Serving a model with vLLMsoon

Lesson 2.3

Packets: how information travels

Big messages are cut into small labelled pieces that travel separately and are put back together.

beginner 3 min readChecked

In one line

Information on the Internet travels as packets: small pieces, each with a label saying where it is going, that are put back together at the other end.

Real-life analogy

Imagine the restaurant needs to send a big order of 300 meals across town. One giant van would block the road, and if it broke down, everything would be lost.

So instead, the meals are packed into many small boxes. Each box gets a label: to this address, from this restaurant, box 17 of 30. The boxes go out on many bikes, maybe along different streets. At the other end, someone checks the numbers and puts the order back together. If box 17 never arrives, they ask for just box 17 again.

That is exactly how packets work.

Where the comparison stops working: real boxes travel at the speed of traffic. Packets travel extremely fast, and a router passes on huge numbers of them every second. Also, unlike a box, a lost packet does not leave a hungry customer: it is usually just sent again automatically.

Diagram

Your photo(one bigmessage)to · from · 1/3to · from · 2/3to · from · 3/3routerrouter3/31/32/3Photo, backin ordercut intolabelled packetsmay take differentroads, arrive inany orderarrivemixed up
A message is cut into numbered packets. They may travel different routes and arrive in any order, then are put back together.

Step by step

You send a photo to a friend. It feels like the photo just jumps from your phone to theirs. What really happens on the way?

Step 1: cut into pieces

Your phone does not send the photo as one big lump. It cuts it into many small chunks, called packets.

Step 2: label every piece

Each packet has two parts:

  • a header: the label. It says where the packet is going, where it came from, and which piece it is (for example, piece 2 of 3).
  • a payload: the actual piece of your photo.

Step 3: travel, maybe by different roads

The packets head out onto the Internet. At every router, the router reads the header and sends the packet one step closer to its destination.

Here is the surprising part: packets from the same photo might take different routes. If one road is busy, a router can send the next packet a different way.

Step 4: arrive, maybe out of order

Because they can take different roads, packets can arrive in any order: piece 3, then piece 1, then piece 2.

Step 5: put back together

Your friend’s phone uses the numbers in the headers to put the pieces back in the right order, rebuilding the photo exactly as it was.

What if a packet gets lost?

Sometimes a packet is lost or damaged on the way. The receiving computer notices a piece is missing (or broken) and asks for just that piece to be sent again. No need to resend the whole photo.

Why bother with packets?

  • Sharing: many people’s packets can share the same roads at the same time, so no one blocks the network.
  • Flexibility: if one route is busy or broken, packets can go around it.
  • Reliability: a lost piece can be resent on its own.

Key takeaways

  • Messages are cut into small pieces called packets.
  • Each packet has a header (the label: to, from, which piece) and a payload (the content).
  • Packets can take different routes and arrive in any order.
  • The receiver reassembles them and asks again for any piece that went missing.

Recap: one huge order becomes many small numbered boxes, sent on many bikes, checked and rebuilt at the other end.

Now you understand how information really travels across the Internet. Next, we will put everything together and follow what happens when you open a website.

Quick check

Pick an answer, then press Check answer. Nothing is recorded.

  1. Why is a big file cut into packets instead of being sent in one piece?
  2. What is in a packet's header?
  3. Packets arrive in the order 3, 1, 2. What happens?

Sources

This lesson was checked against these pages.

  1. Packet (glossary) · MDN Web Docs
  2. How the web works · MDN Web Docs