
Why packets?
Sending a message in pieces
Teaching this? Open projector mode
Imagine you have to send a large photo to a friend. There are two basic ways a network could do it.
Circuit switching is how old telephone networks worked. When you call, the network reserves a whole line from you to the other person for the entire call. Nobody else can use that line, even in the pauses when nobody is talking.
Packet switching is how the Internet works. The message is cut into many small pieces called packets. Each packet is sent on its own, and the network shares its links between everybody's packets. Packets from many different conversations take turns on the same wire.
Why is cutting a message up a good idea?
- Sharing is efficient. A link is never idle waiting for one slow conversation, because it can carry the next packet from someone else.
- Failures hurt less. If one packet is lost, only that small piece has to be sent again, not the whole photo.
- Many paths are possible. Each packet can be routed separately, so if one link breaks, later packets can go another way.
- Nobody hogs the line. A huge download cannot block a tiny message, because the tiny message just slips in between packets.
The idea was developed in the 1960s by Paul Baran in the United States, who was thinking about networks that keep working when parts of them fail, and independently by Donald Davies in the United Kingdom, who came up with the word packet.
How many packets does a message need? Divide the size of the message by the amount of data one packet carries (its payload), then round up, because the last packet may be only partly full:
packets = ⌈ message bytes ÷ payload bytes ⌉
Worked examples:
- A message of 10,000 bytes with 1,000 bytes of payload per packet: 10,000 ÷ 1,000 = 10, so 10 packets.
- A message of 2,500 bytes with 1,000 bytes of payload per packet: 2,500 ÷ 1,000 = 2.5, which rounds up to 3 packets (the last one is half full).
- A 4,000,000-byte photo with 1,460 bytes per packet: 4,000,000 ÷ 1,460 is about 2,739.7, so 2,740 packets.
Why 1,460? You will meet that number in the next lesson. The numbers in this lesson are round values chosen for teaching. Real delays depend on the exact route, the equipment and how busy the network is.
A message of 10,000 bytes is sent with 1,000 bytes of payload in each packet. How many packets?
A message of 2,500 bytes is sent with 1,000 bytes in each packet. How many packets are needed?
What is one advantage of packet switching over reserving a whole line?
One packet of a message is lost. What has to be sent again?