Learning Objectives
By the end of this lesson, you will be able to:
- Show understanding of circuit switching, its benefits, drawbacks and where it is applicable
- Show understanding of packet switching, its benefits, drawbacks and where it is applicable
- Show understanding of the function of a router in packet switching
- Explain how packet switching is used to pass messages across a network, including the internet
- Compare and contrast circuit switching with packet switching
- Understand error detection methods and routing tables in packet switching
Circuit Switching
Circuit Switching uses a dedicated channel/circuit which lasts throughout the connection: the communication line is effectively 'tied up'. Circuit switching is the method used in the traditional telephone system, private telephone networks and private data networks.
Circuit Switching Simulation
Observation: In circuit switching, all data packets follow the same dedicated path from source to destination. The circuit is established before transmission (A → R1 → R2 → R7 → R8 → B) and remains active for the entire session. All packets follow this single route in sequence.
How Circuit Switching Works
To send data across a network using circuit switching, there are three stages:
- Sender provides identity of the intended receiver.
- The system checks whether or not the receiver is ready to accept data.
- A circuit/channel between sender and receiver must be established.
- Data transfer then takes place (which can be analogue or digital); transmission is usually bidirectional.
- After the data transfer is complete, the connection is terminated.
Pros and Cons of Circuit Switching
| Pros of Circuit Switching | Cons of Circuit Switching |
|---|---|
| Circuit used is dedicated to the single transmission only. | Nobody else can use the circuit/channel even when it is idle. |
| Whole of the bandwidth is available. | Circuit is always there whether or not it is used. |
| Data transfer rate is faster than with packet switching. | If there is a failure/fault on dedicated line, there is no alternative routing available. |
| Packets of data (frames) arrive at destination in the same order as they were sent. | Dedicated channels require a greater bandwidth. |
| Packet of data cannot get lost since all packets follow on in sequence along the same single route. | Prior to actual transmission, time required to establish a link can be long. |
| It works better than packet switching in real time applications. | It is not very flexible (it will send empty frames and it has to use a single, dedicated line). |
Packet Switching
Packet Switching is a method of transmission in which a message is broken up into a number of packets that can be sent independently to each other from start point to end point. A packet consists of a header which contains instructions for delivery plus the data body. This method allows data transmission without a circuit being established. Data packets will need to be reassembled into their correct order at the destination.
Packet Structure Visualization
The packet header contains routing and control information (source, destination, sequence number, hop counter, error check). The data section contains the actual message being transmitted.
Packet Switching Simulation
Observation: In packet switching, different packets from the same message can take different routes through the network. Each packet follows its own path based on routing table decisions and current network conditions. Packets may arrive out of order and must be reassembled at the destination.
How Packet Switching Works
- Each packet follows its own path
- Routing selection depends on the number of datagram packets waiting to be processed at each node (router)
- The shortest path available is selected
- Packets can reach the destination in a different order to that in which they are sent
- Packets must be reassembled at the destination
Packet Header Details
Pros and Cons of Packet Switching
| Pros of Packet Switching | Cons of Packet Switching |
|---|---|
| No need to tie up a communication line | 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 packages | 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 |
| High data transmission is possible with packet switching | There is a delay at the destination while packets are reassembled |
| More efficient use of bandwidth | Packets can arrive out of order |
| Supports multiple simultaneous communications | Requires more processing at routers |
Packet Hopping (TTL)
Sometimes packets can get lost and keep 'bouncing' around from router to router without reaching their destination. This can cause network congestion.
To overcome this, a method called Time To Live (TTL) is used. A hop counter is added to the header of each packet. Each packet is only allowed to hop a finite number of times. Each time a packet passes through a router, the TTL is decreased by 1. If the packet hasn't reached its destination and TTL = 0, it will be deleted at the next router.
Error Detection Methods
Each packet contains an error checking technique such as a checksum or Cyclic Redundancy Check (CRC).
- Checksum/CRC value is calculated for each packet and added to the header
- This value is recalculated at the destination to ensure no errors have occurred
- If checksum values are different, a request is made to re-send the packet
- This ensures data integrity during transmission
Routing Tables
Routing tables contain information necessary to forward a package along the shortest/best route to allow it to reach its destination. As soon as a packet reaches a router, the packet header is examined and compared with the routing table. The table supplies the router with instructions to send the packet (hop) to the next available router.
Routing Table Includes:
- Number of hops - Count of routers to pass through
- MAC address of next router where the packet is to be forwarded to (hopped)
- Metrics - A cost is assigned to each available route so that most efficient route/path is found
- Network destination (network ID) or pathway
- Gateway - The same information as the next hop; it points to the gateway through which target network can be reached
- Netmask - Used to generate network ID
- Interface - Indicates which locally available interface is responsible for reaching gateway
Key Takeaways
- Circuit switching establishes a dedicated path for the entire communication duration, like a private road reserved just for you
- Packet switching breaks data into independent packets that travel different routes and get reassembled at the destination
- Circuit switching excels in real-time applications (voice calls, video conferencing) due to guaranteed bandwidth and in-order delivery
- Packet switching is superior for data transmission (web browsing, file downloads) as it efficiently shares bandwidth and routes around failures
- Routers are intelligent traffic directors that use routing tables to determine the best path for forwarding packets
- Hop counters prevent network congestion by limiting how many routers a packet can pass through before being discarded
- Error detection (checksums) ensures data integrity by verifying packets haven't been corrupted during transmission
- The internet primarily uses packet switching, while traditional telephone networks use circuit switching
- Circuit switching wastes bandwidth during idle periods but provides consistent performance
- Packet switching can cause out-of-order delivery and reassembly delays but maximizes network efficiency
- Choosing between methods depends on application requirements: real-time vs efficiency, guaranteed quality vs flexibility
Question Bank
1. What are the three stages of sending data across a network using circuit switching? [3 marks]
Marking Scheme & Answer
- [1 mark] Sender provides identity of the intended receiver
- [1 mark] The system checks whether or not the receiver is ready to accept data
- [1 mark] A circuit/channel between sender and receiver must be established
- [Additional] Data transfer then takes place (after establishment)
- [Additional] After data transfer is complete, the connection is terminated
2. Explain why circuit switching works better than packet switching for real-time applications. [4 marks]
Marking Scheme & Answer
- [1 mark] Dedicated circuit ensures guaranteed bandwidth availability
- [1 mark] All packets arrive in the same order they were sent (no reassembly delay)
- [1 mark] No packet loss since all follow the same single route
- [1 mark] Consistent latency without variable delays from different routes
- [Additional] No time wasted on routing decisions during transmission
3. How does packet switching overcome failed or faulty lines in a network? [3 marks]
Marking Scheme & Answer
- [1 mark] Packets can be re-routed through alternative paths
- [1 mark] Routers dynamically update routing tables to avoid failed lines
- [1 mark] Each packet travels independently and can take different routes
- [Additional] The network can continue operating despite individual component failures
4. What is the purpose of the hop number in packet switching and how does it prevent network congestion? [4 marks]
Marking Scheme & Answer
- [2 marks] Purpose:
- Added to header of each packet to limit how many routers it can pass through
- Each router decreases hop number by 1 when packet passes through
- [2 marks] Prevents congestion:
- If hop number reaches 0, packet is deleted at next router
- Prevents packets from bouncing indefinitely between routers
- Stops lost packets from consuming network resources
- Prevents infinite loops in routing
5. Describe how error detection using checksums works in packet switching. [4 marks]
Marking Scheme & Answer
- [1 mark] Checksum value is calculated for each packet based on its data
- [1 mark] This value is added to the packet header before transmission
- [1 mark] At destination, checksum is recalculated from received packet data
- [1 mark] If calculated checksum matches header checksum, packet is intact; if not, error has occurred
- [Additional] If checksums differ, destination requests retransmission of that packet
6. What information is contained in a router's routing table and how is it used? [5 marks]
Marking Scheme & Answer
- [1 mark each] Routing table contains:
- Number of hops to destination
- MAC address of next router (next hop)
- Metrics/cost assigned to each available route
- Network destination (network ID)
- Gateway information
- Netmask for network ID generation
- Interface for reaching gateway
- [1 mark] How used: Router examines packet header, compares with routing table to determine best next hop
7. Why does packet switching not work well with real-time data streams? [3 marks]
Marking Scheme & Answer
- [1 mark] Packets can take different routes causing variable delays
- [1 mark] Packets may arrive out of order requiring reassembly delay
- [1 mark] No guaranteed bandwidth - competing traffic can cause congestion and delays
- [Additional] Packet loss requires retransmission causing further delays
8. Compare the bandwidth usage in circuit switching versus packet switching. [4 marks]
Marking Scheme & Answer
- [2 marks] Circuit switching:
- Whole bandwidth dedicated to single connection
- Bandwidth reserved even when idle (wasteful)
- Guaranteed full bandwidth availability
- [2 marks] Packet switching:
- Bandwidth shared dynamically among multiple connections
- More efficient use - only uses bandwidth when sending packets
- No bandwidth reservation, can lead to congestion
9. How would packet switching be used to download a page from a website? [6 marks]
Marking Scheme & Answer
- [1 mark] Web page is divided up into data packets
- [1 mark] Each packet has a header including destination IP address
- [1 mark] Router checks header against routing table to determine next router
- [1 mark] MAC address of next router added to packet header
- [1 mark] Hop value checked - if 0, packet discarded
- [1 mark] Each packet may take different route based on network conditions
- [Additional] Destination computer reassembles packets into final web page
10. What are the main advantages and disadvantages of circuit switching compared to packet switching? [6 marks]
Marking Scheme & Answer
Circuit Switching Advantages:
- Guaranteed bandwidth
- Packets arrive in order
- Faster data transfer rate
- No packet loss
- Better for real-time applications
Circuit Switching Disadvantages:
- Wastes bandwidth when idle
- No alternative routing if line fails
- Long setup time before transmission
- Less flexible
- Greater bandwidth requirement
Packet Switching Advantages:
- Efficient bandwidth use
- Can reroute around failures
- Easy to expand traffic
- High data transmission possible
- No need to tie up communication line
Packet Switching Disadvantages:
- Complex protocols
- Packets can be lost
- Poor for real-time data
- Reassembly delay at destination
- Packets can arrive out of order