CIE AS & A Level Computer Science, section 14.2 (Circuit switching and packet switching)
How it works
In packet switching, the message is broken into packets. Each packet is sent independently and may take a different route. They are reassembled in order at the destination.
A packet
| Part | Contents |
|---|---|
| Header | destination and source IP addresses, the packet number (for reordering), the number of hops allowed, and often a protocol |
| Payload | the data being carried |
| Trailer | a checksum or similar, to detect errors |
Routing
A router reads each packet's destination address, uses its routing table to choose the best next link, and passes it on. Each step from one router to the next is a hop. A packet has a hop limit, and is discarded if it passes that many routers (to stop it circulating forever).
At the destination
- Packets can arrive out of order, so they are put in order using the packet numbers.
- Any missing or damaged packets are requested again.
- The message is reassembled.
Benefits
- The network can share its links between many users, so it is efficient.
- If a route fails, packets can use another route.
- No set up delay, so suited to bursts of data.
Drawbacks
- Packets arrive out of order or late, so there can be delay (a problem for live calls).
- Packets can be lost.
- Extra work to reorder and reassemble.
Common mistake: saying all packets take the same route. Each packet is routed independently, so they may take different routes. Also, the header holds addressing and sequence information, while the payload is the data.
Exam tip: describe the sequence: split into packets, route each separately via routers, reorder and reassemble. Mention the packet header contents if asked.
Check yourself
Why do packets contain a packet number?
So that the packets can be put back in the correct order at the destination.
What does a router do with a packet?
It reads the destination address and uses its routing table to forward the packet along the best route.
Give one benefit of packet switching over circuit switching.
Network links are shared between many users, so capacity is used efficiently, and packets can avoid a failed link.