📑 Contents

Chapter 14.2: Circuit Switching & Packet Switching

9618 Computer Science - Communication and Internet Technologies

📚 Learning Objectives
📖 Prior Knowledge Required
🌟 Did You Know?

The internet is similar to a road network in that it has rules (protocols) that you need to follow and only a certain number of vehicles (data) can get through at a time (bandwidth). If too many vehicles try to go down the same road you get congestion (reduced bandwidth)!

1. Protocols and Handshaking

When two devices send messages to each other it is called handshaking. This is the process where:

📝 Handshaking Process
  1. The client requests access to the server
  2. The server grants access
  3. The protocols are agreed between both parties
  4. Once handshaking is complete, data transfer can begin

Protocols establish how two computers send and receive a message. Data packets travel between source and destination from one router to the next. The process of exchanging data packets is known as packet switching.

1.1 Key Terms

Term Definition
Circuit Switching Method of transmission in which a dedicated circuit/channel lasts throughout the duration of the communication
Packet Switching Method of transmission where a message is broken into packets which can be sent along paths independently from each other
Hop Number Number in the packet header used to stop packets which never reach their destination from 'clogging up' routes
Header Part of a data packet containing key data such as destination IP address, sequence number, and so on
Routing Table A data table that contains the information necessary to forward a packet along the shortest or best route to allow it to reach its destination
CLIENT SERVER 1. Request Access 2. Grant Access 3. Protocols Agreed → Data Transfer Begins

2. Circuit Switching

Circuit Switching uses a dedicated channel/circuit which lasts throughout the connection - the communication line is effectively 'tied up'. This is the method used in the traditional telephone system.

📖 Historical Context

When telephone lines were first invented, the lines had to be physically (and manually) routed between end points. These were done at central switchboards. Manual switch operators were gradually replaced by automatic electrical switches.

2.1 Three Stages of Circuit Switching

📝 Circuit Switching Process
  1. Sender provides identity of the intended receiver
  2. The system checks whether or not the receiver is ready to accept data
  3. A circuit/channel between sender and receiver must be established
  4. Data transfer takes place (can be analogue or digital); transmission is usually bidirectional
  5. After data transfer is complete, the connection is terminated

2.2 Circuit Switching Example

Example: The dedicated route from 'A' to 'B' is first established. The following connections are implemented: A-R2, R2-R5, R5-R8, R8-R7, R7-R10, and finally R10-B. All packets (frames) follow this single route and communication will take place, provided 'B' is not busy.
A B R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 ━━ Dedicated Path (All packets follow same route)

3. Circuit Switching: Advantages & Disadvantages

Advantages ✓ Disadvantages ✗
The circuit used is dedicated to the single transmission only It is not very flexible - it will send empty frames and has to use a single, dedicated line
The whole of the bandwidth is available Nobody else can use the circuit/channel even when it is idle
The data transfer rate is faster than with packet switching The circuit is always there whether or not it is used
The packets of data (frames) arrive at destination in the same order as they were sent If there is a failure/fault on the dedicated line, there is no alternative routing available
A packet of data cannot get lost since all packets follow in sequence along the same single route Dedicated channels require greater bandwidth
Works better than packet switching in real-time applications Prior to actual transmission, the time required to establish a link can be long
No waiting time at switches Resources are not utilized fully
Suitable for long continuous communication Circuit switching is more expensive as a dedicated path must be established
💡 Exam Tip

When discussing circuit switching, always mention that it creates a dedicated physical path that remains open throughout the communication. This is why it's ideal for voice calls but inefficient for bursty data traffic!

3.1 Main Uses of Circuit Switching

📖 Applications
Circuit Switching = Dedicated Highway Lane A B C DEDICATED LANE Only one conversation uses this lane - even when idle!

4. Packet Switching

TCP/IP uses packet switching to send data across a network. In packet switching, messages are broken up into very small pieces called packets. Each packet consists of two parts:

📖 Packet Structure

Header: Contains key data including:

Payload: The actual part of the message being sent (the data)

Packet switching is a connectionless network switching technique. The message is divided and grouped into units called packets that are individually routed from source to destination. There is no need to establish a dedicated circuit for communication.

4.1 Key Characteristics

📝 How Packet Switching Works
A Source B Destination R1 R2 R3 R4 R5 R6 R7 R8 1 1 2 2 3 3 4 4 Packets 1,2,3,4 take DIFFERENT routes and arrive in order: 2,1,4,3 (Reassembly required at destination!)

5. Packet Switching: Advantages & Disadvantages

Advantages ✓ Disadvantages ✗
No need to tie up a communication line The protocols for packet switching can be more complex than those for circuit switching
It is possible to overcome failed or faulty lines by simply re-routing packets If a packet is lost, the sender must re-send the packet (which wastes time)
It is easy to expand the traffic usage Does not work well with real-time data streams (like VoIP)
High data transmission is possible with packet switching There is a delay at the destination while packets are reassembled
Packet switching always uses digital networks - digital data transmitted directly Network problems may introduce errors, delays, or loss of packets
Charges users only for the duration of connectivity, not distance Requires large amounts of RAM to handle large amounts of data
Delay in delivery of packets is less since packets are sent as soon as available High installation costs
Data delivery can continue even if parts of network fail - packets routed via other paths Unsuitable for applications that cannot afford delays (high quality voice calls)
💡 Exam Tip

Try to avoid talking about the speed of data transmission in an answer to a question on packet or circuit switching. This will not get you a mark in the exam! It is better to talk about higher bit rates or bandwidth (the number of bits sent per second) or the efficiency of the transmission.

Packet Switching = Shared Highway (Efficient!) A1 B2 C1 A2 D1 B3 C2 A3 D2 B4 Multiple conversations share the same bandwidth - efficient use!

6. Circuit Switching vs Packet Switching

Feature Circuit Switching Packet Switching
Connection Type Connection-oriented Connectionless
OSI Layer Implemented at Physical Layer Implemented at Network Layer
Route Setup Actual route needs to be set up before transmission can begin ✓ No route setup required ✗
Dedicated Path Dedicated transmission path is required ✓ No dedicated path ✗
Packet Route Each packet uses the same route ✓ Each packet may take different routes ✗
Arrival Order Packets arrive at destination in correct order ✓ Packets may arrive out of order - need reassembly ✗
Bandwidth All bandwidth reserved (even if not needed) ✓ Bandwidth only used if required
Bandwidth Wasted? Yes - resources remain reserved even when idle ✓ No - efficient use of bandwidth ✗
Designed For Voice calls Data transmission (also carries VoIP data)
Reliability Less robust - if path fails, call dropped Robust - packets can be rerouted if failure occurs
Scalability Less scalable - more users require more physical paths Highly scalable - handles large volumes
Cost Higher - reserved bandwidth and infrastructure Lower - shared infrastructure
🧠 Memory Trick

Circuit Switching = "C" = Connected, Continuous, Certain order

Packet Switching = "P" = Pieces, Parallel paths, Potential reordering

Think: Circuit is like a phone call (one continuous connection), Packet is like sending multiple letters (each takes its own route)!

7. Packet Header Structure (TCP/IP)

Each packet contains a header with essential information for routing and reassembly. Here is the structure of a TCP/IP packet header:

TCP/IP Packet Header Structure Version (4 bits) Header Length (4b) Priority (8 bits) Packet Length (16 bits) Fragment ID (16 bits) Flags + Offset (16 bits) Hop Number (8 bits) Total Packets (16 bits) Sequence Num (16 bits) Protocol (8 bits) Checksum (16 bits) Source IP Address (32 bits) - Who sent the packet Destination IP Address (32 bits) - Where it's going PAYLOAD (Data) The actual message content being transmitted

7.1 Header Fields Explained

📝 Key Header Fields

8. Hopping and Error Detection

8.1 The Problem: Lost Packets

⚠️ Why Hopping is Needed

Sometimes packets can get lost and keep 'bouncing' around from router to router and never actually reach their destination. Eventually, the network could grind to a halt as the number of 'lost' packets mounts up and clogs up the system!

8.2 The Solution: Hop Numbers

📝 How Hopping Works
  1. A hop number is added to the header of each packet
  2. Each packet is only allowed to hop a finite number of times (determined by network protocol and routing table)
  3. Each time a packet passes through a router, the hop number is decreased by 1
  4. If the packet has not reached its destination and the hop number = 0, then it will be deleted when it reaches the next router
SRC R1 Hop=15 R2 Hop=14 R3 Hop=13 R4 Hop=... DST Hop number decreases by 1 at each router. If Hop=0, packet deleted!

8.3 Error Detection: Checksum

📖 Checksum Process
❌ Common Mistake

Don't confuse hop number (prevents packets looping forever) with sequence number (used to reassemble packets in correct order). They serve different purposes!

9. Routing Tables

Routing tables contain the information necessary to forward a packet along the shortest/best route to allow it to reach its destination.

9.1 How Routing Tables Work

📝 Routing Process
  1. As soon as a packet reaches a router, the packet header is examined
  2. The header is compared with the routing table
  3. The table supplies instructions to send the packet (hop) to the next available router
  4. A new MAC address is added to the packet header so the packet knows which router is next
  5. If no route can be found OR hop number = 0, the router deletes the data packet

9.2 Contents of Routing Tables

Field Description
Number of hops How many routers the packet must pass through
MAC address Address of the next router where the packet is to be forwarded (hopped)
Metrics A cost assigned to each available route so that the most efficient route/path is found
Network destination Network ID or pathway
Gateway Points to the gateway through which the target network can be reached
Netmask Used to generate network ID
Interface Indicates which locally available interface is responsible for reaching the gateway
PACKET with header ROUTER Routing Table Compare header → find next hop Route A Route B Delete DEST IP addr 1. Header examined 2. Best route selected 3. Forward to next hop

10. Exam-Style Questions

1. Describe what is meant by circuit switching. Give one example of where circuit switching is used. [4 marks]

Answer:

  • Circuit switching is a method of transmission where a dedicated channel/circuit is established between sender and receiver
  • The communication line is effectively 'tied up' for the duration of the connection
  • Three stages: circuit establishment → data transfer → connection termination
  • The dedicated path remains open whether or not data is being transmitted
  • Example: Public Switched Telephone Network (PSTN) for voice calls
  • Other examples: Private telephone networks, private data networks

Additional points for deeper understanding: Works well for real-time applications; ensures all data arrives in order; no packet loss since all data follows same route.

2. Compare circuit switching and packet switching in terms of how they handle data transmission. [6 marks]

Answer:

  • Circuit switching requires a dedicated path to be established before transmission; packet switching does not
  • In circuit switching, all packets follow the same route; in packet switching, each packet can take a different route
  • Circuit switching packets arrive in order; packet switching packets may arrive out of order and need reassembly
  • Circuit switching reserves full bandwidth even when idle; packet switching uses bandwidth only when needed
  • Circuit switching is connection-oriented; packet switching is connectionless
  • Circuit switching is better for real-time applications; packet switching is better for bursty data traffic
  • Packet switching can reroute around failures; circuit switching cannot
3. Explain the purpose of a hop number in a packet header and describe how it is used to prevent network problems. [4 marks]

Answer:

  • A hop number is added to the header of each packet to limit the number of routers it can pass through
  • Each time a packet passes through a router, the hop number is decreased by 1
  • If a packet has not reached its destination and hop number = 0, it is deleted by the next router
  • This prevents packets from 'bouncing' around indefinitely and clogging up the network
  • Without hop numbers, lost packets could accumulate and cause the network to grind to a halt
4. Describe the contents of a packet header when using TCP/IP protocol. [6 marks]

Answer:

  • Source IP address (32 bits) - identifies who sent the packet
  • Destination IP address (32 bits) - identifies where the packet is going
  • Sequence number (16 bits) - used to reassemble packets in correct order
  • Hop number (8 bits) - prevents infinite routing loops
  • Total number of packets (16 bits) - how many packets in the message
  • Checksum (16 bits) - for error detection
  • Packet length (16 bits) - size of the packet in bytes
  • Protocol version (4 bits) - e.g., IPv4, IPv6
5. A person is making a video call using VoIP software. Explain how packet switching could be used and describe any problems that might occur. [5 marks]

Answer:

  • The video/audio is broken into packets each with header containing destination IP
  • Packets are sent independently across the network via different routes
  • At destination, packets are reassembled in correct order using sequence numbers

Problems that might occur:

  • Picture and sound not in sync - packets arriving at different times
  • Video pauses/stutters - delay in reassembling packets
  • Degraded quality - competing traffic on communication lines
  • Packet loss - some packets taking different routes may get lost

10. Exam-Style Questions (Continued)

6. Explain how packet switching would be used to download a page from a website. [6 marks]

Answer:

  • The web page is divided into data packets
  • Each packet has a header which includes the IP address of the destination
  • The router checks the header against values stored in the routing table
  • The router determines which router the packet needs to be sent to next (hopped)
  • The MAC address of the next router is added to the packet header
  • The hop value is checked to see if it equals zero
  • Each packet may go by a different route
  • The destination computer reassembles the packets to build the final web page
7. Give three advantages and three disadvantages of packet switching compared to circuit switching. [6 marks]

Advantages:

  • No need to tie up a communication line - more efficient
  • Can overcome failed lines by re-routing packets around problems
  • Easy to expand traffic usage - scalable
  • Users charged only for duration of connectivity, not distance
  • Uses digital networks - direct transmission of digital data

Disadvantages:

  • More complex protocols required compared to circuit switching
  • If packet lost, sender must re-send - wastes time
  • Does not work well with real-time data streams
  • Delay at destination while packets are reassembled
  • Requires large amounts of RAM to handle data
8. Describe the role of a routing table in packet switching and explain what information it contains. [5 marks]

Role:

  • Routing tables contain information to forward a packet along the shortest/best route to its destination
  • When a packet arrives, the router examines the header and compares with the routing table
  • The table supplies instructions to send the packet to the next available router

Contents:

  • Number of hops - how many routers to pass through
  • MAC address of next router
  • Metrics - cost assigned to each route for efficiency
  • Network destination/gateway - target network ID
  • Netmask - used to generate network ID
  • Interface - which interface reaches the gateway
9. Why is circuit switching considered inefficient for data transmission? Explain your answer with reference to bandwidth usage. [4 marks]

Answer:

  • In circuit switching, all bandwidth is reserved for the connection whether or not data is being sent
  • The circuit is always there whether or not it is used
  • Nobody else can use the circuit/channel even when it is idle
  • This wastes bandwidth because data transmission is often 'bursty' - not continuous
  • Dedicated channels require greater bandwidth overall
  • Resources are not utilized fully - inefficient use of network capacity
10. Explain how checksums are used for error detection in packet switching. [4 marks]

Answer:

  • A checksum value is calculated for each packet before transmission
  • This value is added to the packet header
  • At the destination, the checksum is recalculated for the received packet
  • If the calculated checksum differs from the header value, an error has occurred
  • A request is made to re-send the packet if errors are detected
  • This ensures data integrity throughout transmission

11. Glossary

📖 Key Terms

Bandwidth → The maximum rate of data transfer across a network path, measured in bits per second.

Checksum → A value calculated from packet data used to detect errors during transmission.

Circuit Switching → A method of transmission where a dedicated communication channel is established and maintained throughout the connection.

Connectionless → A type of network communication where data is sent without establishing a dedicated connection first.

Connection-oriented → A type of network communication where a dedicated path must be established before data transfer begins.

Datagram → A self-contained, independent packet of data that carries enough information to be routed to its destination.

Gateway → A network node that connects two different networks, acting as an entry/exit point.

Handshaking → The process where two devices establish communication protocols before data transfer.

Header (Data Packet) → The part of a packet containing control information such as source/destination addresses and sequence numbers.

Hop → One portion of the path between source and destination; each router a packet passes through counts as one hop.

Hop Number → A value in the packet header that limits the number of routers a packet can pass through.

MAC Address → A unique hardware identifier assigned to network interfaces for communication at the data link layer.

Metrics → Values assigned to routes in a routing table to determine the most efficient path.

Netmask → A 32-bit number that divides an IP address into network and host portions.

Packet → A small unit of data formatted for transmission over a network, containing header and payload.

Packet Switching → A method of transmission where messages are broken into packets that can be sent independently via different routes.

Payload → The actual data content of a packet, as opposed to the header information.

Protocol → A set of rules that govern how data is transmitted over a network.

PSTN → Public Switched Telephone Network - the traditional circuit-switched telephone system.

Router → A networking device that forwards data packets between computer networks.

Routing Table → A data table stored in a router that contains information for forwarding packets to their destinations.

Sequence Number → A number in a packet header used to reorder packets at the destination.

TCP/IP → Transmission Control Protocol/Internet Protocol - the fundamental protocol suite for internet communication.

VoIP → Voice over Internet Protocol - technology for delivering voice communications over IP networks.

12. Exam Success Tips (Part 1)

💡 Key Differences to Remember
💡 What to Avoid in Exam Answers
🧠 Memory Trick: The "C" and "P" Method
💡 Header Fields to Remember
💡 Answering "Compare" Questions

12. Exam Success Tips (Part 2)

❌ Common Mistakes to Avoid
💡 When to Use Which Switching Method
🌟 Quick Reference Table
Topic Key Point
Packet Header Source/Dest IP, Sequence #, Hop #, Checksum
Hop Number Decreases by 1 at each router; if 0, packet deleted
Routing Table Hops, MAC address, Metrics, Gateway, Interface
Checksum Calculated at source, verified at destination
Real-time apps Use circuit switching (guaranteed bandwidth)
📝 How to Structure Your Answers

13. Key Takeaways

📌 Summary Points

Circuit Switching

Packet Switching

Packet Structure & Routing

Key Exam Points

CIRCUIT SWITCHING Dedicated Path Real-time Apps Bandwidth Reserved PACKET SWITCHING Independent Routes Bursty Data Efficient Bandwidth VS