Circuit switching and packet switching
When data crosses a network made of many interconnected links and nodes, something must decide how it gets from one end to the other. There are two fundamentally different answers. Circuit switching reserves a dedicated path for the whole conversation before anything is sent. Packet switching splits the data into packets and sends each one independently, letting routers choose the route hop by hop. Paper 3 asks you to describe both, to give their benefits and drawbacks, to say where each is applicable, and to explain how packet switching and routers carry a message across the internet.
Circuit switching
In circuit switching, a dedicated communication path (circuit) is established between the sender and the receiver before any data is sent. The full bandwidth of the circuit is reserved for that communication for its whole duration, all data follows the same path, and the circuit is released when the communication ends.
There are three phases:
- Circuit establishment: the path is set up through the switches between the two ends. In the traditional telephone network, dialling a number caused each exchange to connect a line through to the next.
- Data transfer: data flows along the reserved path, in order, with no further routing decisions.
- Circuit disconnection: when the call ends, the links are released for other users.
Benefits of circuit switching
- The bandwidth is dedicated: no other traffic competes, so the data rate is guaranteed.
- Data arrives in order with a constant, small delay (no queuing at nodes), ideal for real-time communication.
- No reordering is needed and each piece of data does not need a full destination address.
Drawbacks of circuit switching
- The circuit's bandwidth is wasted when no data is being sent (for example during silences in a call); nobody else can use it.
- There is a delay to set up the circuit before any data can be sent.
- If any link in the circuit fails, the communication fails and the circuit must be set up again.
- Capacity is limited: when all circuits are in use, new calls are refused.
- It is expensive per user because resources are reserved, not shared.
Where it is applicable: traditional (landline) telephone calls, and any communication that needs a guaranteed, constant data rate and very low, steady delay, such as some real-time control systems and dedicated leased lines between sites.
Packet switching
In packet switching, a message is split into small units called packets. Each packet is sent independently across the network and may take a different route; routers forward each packet towards its destination, and the packets are reassembled in the correct order at the destination. Network links are shared by packets from many different communications.
What a packet contains
Each packet has a header (control information) and a payload (part of the data). On the internet the header fields include:
| Field | Purpose |
|---|---|
| Source IP address | Where the packet came from, so replies and error messages can be returned |
| Destination IP address | Where the packet is going; routers use it to choose the next hop |
| Sequence number (in the TCP header) | The packet's position in the message, so the receiver can reassemble packets in order and spot missing ones |
| Total number of packets / length | Lets the receiver know when it has everything |
| Time to live (hop limit) | Decremented by each router; the packet is discarded when it reaches 0, so lost packets do not circulate for ever |
| Checksum | Lets the receiver (and routers) detect corruption |
| Protocol | Which transport protocol (TCP or UDP) the payload belongs to |
How a message is passed across a network
- The sending host splits the message into packets of a maximum size, and gives each a header containing the source and destination addresses and a sequence number.
- Each packet is sent to the first router (the default gateway).
- Each router that receives a packet reads its destination IP address, consults its routing table and forwards the packet to the next hop on the best available route. Different packets may be sent different ways, depending on traffic and link failures at that moment.
- Each router decrements the packet's time to live; a packet whose hop count reaches zero is discarded.
- Packets arrive at the destination host, possibly out of order. They are checked for errors.
- The receiving host uses the sequence numbers to reorder the packets and reassemble the message. Missing or corrupted packets are detected and the sender is asked to retransmit them (TCP).
- When all packets have arrived, the complete message is passed to the application.
The function of a router
A router is a device that connects two or more networks and forwards packets between them, choosing the next hop for each packet based on its destination IP address.
In packet switching, a router:
- receives packets on one of its network interfaces
- reads the destination IP address in the header
- looks up the destination in its routing table, which maps destination networks to the next router (next hop) and the interface to use, often with a cost or metric for each route
- forwards the packet out of the chosen interface towards the next hop, choosing the most efficient available route, and can route around congestion or failed links
- decrements the time-to-live and discards packets that have expired
- updates its routing table by exchanging information with other routers (using routing protocols), so that it adapts as the network changes
- may queue (buffer) packets when an outgoing link is busy, and drop packets when its buffer is full
A router works at the internet layer: it needs the IP header but never looks inside the payload.
Benefits of packet switching
- Links are shared, so bandwidth is used efficiently: idle time in one conversation is filled by others' packets.
- No set-up delay: packets can be sent immediately.
- Resilient: if a link fails or is congested, packets are routed around it, and only lost packets need resending.
- Errors affect only individual packets, which can be retransmitted, rather than the whole message.
- Many users can communicate at once; it scales to networks the size of the internet.
- Cheaper, since no resources are reserved per user.
Drawbacks of packet switching
- Packets can arrive out of order and must be reassembled, which takes processing time.
- Delay is variable (packets queue at busy routers, take different routes), causing jitter; poor for real-time traffic unless it is managed.
- Packets can be lost or corrupted and need retransmission, causing further delay.
- Every packet carries a header, an overhead that reduces the share of bandwidth used for data.
- Performance falls when the network is heavily loaded, since bandwidth is not guaranteed.
Where it is applicable: the internet and almost all modern data networks; email, web pages, file transfer, streaming, and (with buffering and quality-of-service techniques) internet voice and video calls. It suits "bursty" data that is sent in irregular bursts.
Side by side
| Circuit switching | Packet switching | |
|---|---|---|
| Path | dedicated path set up before transfer | no fixed path; each packet routed independently |
| Route of data | all data takes the same route | packets may take different routes |
| Order of arrival | always in order | may arrive out of order; reassembled using sequence numbers |
| Bandwidth | reserved for one communication, wasted when idle | shared between many communications |
| Set-up time | needed before data can flow | none |
| Delay | constant and low once set up | variable; depends on traffic |
| Link failure | communication fails | packets rerouted |
| Addressing | only when the circuit is set up | every packet carries addresses |
| Typical use | traditional telephone network | the internet |
Worked examples
Describe how circuit switching is used to transmit data. [3]
Solution
- A dedicated circuit (path) is established between the sender and receiver before any data is sent.
- All data is transmitted along the same route, with the circuit's full bandwidth reserved for that transmission, and arrives in order.
- When the transmission is complete, the circuit is released so that it can be used by others.
Explain how packet switching is used to send an email message across the internet. [5]
Solution
- The message is split into packets, each with a header containing the source and destination IP addresses and a sequence number.
- Each packet is sent independently and may take a different route through the network.
- At each router, the destination address is read and the packet is forwarded to the next router on the best available route using the routing table.
- Packets may arrive out of order; at the destination they are reordered/reassembled using the sequence numbers.
- Missing or corrupted packets are detected (for example by checksum or a gap in the sequence numbers) and the receiver requests retransmission.
A hospital needs a link between two sites to carry a live video feed of surgery for remote consultants. A second link will carry patient records and email. Recommend circuit switching or packet switching for each, with reasons.
Solution
Live surgical video: circuit switching (a dedicated circuit). The video must arrive in real time with a constant, guaranteed data rate and no variable delay; any freezing caused by congestion or reordering would be unacceptable. A dedicated circuit guarantees the bandwidth, and the cost of wasted capacity is justified by the importance of the feed.
Records and email: packet switching. The data is sent in bursts, and a small, variable delay is acceptable; what matters is that every bit arrives correctly, which retransmission ensures. Sharing the link with other traffic is cheaper and more efficient, and routing around failures improves reliability.
A file of 12 000 bytes is sent by packet switching. Each packet can carry at most 1460 bytes of data and has a 40-byte header. Calculate the number of packets and the total number of bytes transmitted.
Solution
, so 8 full packets carry bytes and a ninth carries the remaining bytes: 9 packets.
Headers: bytes. Total transmitted: bytes.
The 360 bytes of headers are the overhead that circuit switching would not need for each piece of data; about 2.9% of the transmission here.
Explain the role of a router when packet switching is used. [4]
Solution
- A router receives a packet and reads the destination IP address from its header.
- It uses its routing table to determine the next hop (the next router or the destination network) on the best route.
- It forwards the packet towards its destination, and can send packets by different routes to avoid congestion or failed links.
- It decrements the hop count/time to live and discards packets that have exceeded it; it updates its routing table by exchanging information with other routers.
- In packet switching, it is the receiver that reassembles the packets, not the routers.
- A router does not send a packet "to its destination" directly; it sends it to the next hop.
- Do not say packet switching is "faster". It has no set-up delay and uses bandwidth efficiently, but individual packets can be delayed; circuit switching gives lower and more predictable delay once set up.
- Packet switching does not guarantee delivery by itself; reliability comes from TCP retransmission.
- Benefits and drawbacks questions want specific points: "bandwidth is dedicated so a constant data rate is guaranteed", not "it is more reliable".
- When asked "where is it applicable", tie the method to a property: real-time with guaranteed bandwidth (circuit); bursty data sent over shared, resilient networks (packet).
- Always mention the header contents (destination address and sequence number) in a description of packet switching.
- Circuit switching sets up a dedicated path before transfer; all data takes the same route in order; bandwidth is reserved; the circuit is released at the end.
- Circuit switching: guaranteed bandwidth, constant low delay, in-order delivery; but set-up time, wasted idle capacity and failure if a link breaks. Used for traditional telephone calls.
- Packet switching splits data into packets with headers (source and destination addresses, sequence number, TTL, checksum), sent independently by possibly different routes, reassembled at the destination.
- Packet switching: efficient shared bandwidth, no set-up, resilient to failure; but out-of-order arrival, variable delay, header overhead, possible loss. Used for the internet.
- A router reads the destination IP address, consults its routing table and forwards each packet to the next hop, adapting to congestion and failures.
Practice questions
- Give two benefits and two drawbacks of circuit switching.
- State three items of data in a packet header and the purpose of each.
- Explain why packets sent from the same source to the same destination may arrive in a different order from the order in which they were sent.
- Explain why packet switching makes better use of network bandwidth than circuit switching.
- Describe the function of a routing table.
- A message of 5000 bytes is sent in packets that carry a maximum of 576 bytes of data each, with a 24-byte header. Calculate the number of packets and the total number of bytes sent.
- A television company streams a live football match over the internet. Explain the problems that packet switching could cause and how the streaming software might reduce them.
- Compare circuit switching and packet switching for a video call between two countries. [6]
Answers
-
Benefits (any two): dedicated bandwidth so the data rate is guaranteed; data arrives in order; constant low delay suitable for real time; no reassembly needed. Drawbacks (any two): bandwidth wasted when idle; set-up delay before transmission; the whole communication fails if a link fails; limited number of simultaneous circuits; expensive.
-
Any three of: destination IP address (so routers can forward the packet towards the destination); source IP address (so the receiver can reply and request retransmission); sequence number (so the packets can be reassembled in order and missing packets identified); time to live/hop count (so packets that cannot be delivered are discarded rather than circulating for ever); checksum (to detect corruption); total number of packets (so the receiver knows when the message is complete).
-
Each packet is routed independently. Routers choose the next hop based on the current state of the network, so packets may take different routes of different lengths, or be delayed by different amounts in queues at congested routers. A later packet may therefore overtake an earlier one.
-
In circuit switching, the bandwidth of every link in the circuit is reserved for one communication even when nothing is being sent. In packet switching, links are shared: packets from many communications are interleaved, so whenever one sender is idle others can use the capacity. Little capacity is left unused.
-
A routing table, held by a router, lists destination networks (or address ranges) and, for each, the next hop (the next router or interface) to which packets for that destination should be forwarded, often with a metric or cost for each route. The router looks up each packet's destination IP address in the table to decide where to send it, and the table is updated as the router learns about changes in the network.
-
, so 8 full packets ( bytes) plus one with bytes: 9 packets. Headers: bytes. Total: bytes.
-
Problems: packets may arrive out of order or with varying delay (jitter), so playback could stutter; packets may be lost when routers are congested, causing glitches; bandwidth is not guaranteed, so quality may drop at busy times. Reductions: buffer several seconds of video before playing, so late packets can be reordered before they are needed; use UDP so lost packets are skipped rather than delaying the stream; use adaptive bit-rate streaming that lowers quality when bandwidth drops; use content-delivery servers close to viewers.
-
Circuit switching: a dedicated path would guarantee bandwidth and give a constant low delay with data arriving in order, so the call would be smooth; but setting up an international circuit takes time, the circuit's bandwidth is wasted during pauses, it is expensive, and if any link fails the call drops. Packet switching: the call can start immediately, uses shared links (cheaper), and survives link failures by rerouting; but packets may arrive out of order, be delayed variably or be lost, so the call may suffer jitter, lag or glitches, which are reduced using buffering and UDP. In practice, video calls use packet switching (the internet) because cost and availability outweigh the quality advantage of a dedicated circuit, but a circuit gives better guaranteed quality.