CS

Circuit & Packet Switching

Understanding network communication methods and their applications

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:

  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 then takes place (which can be analogue or digital); transmission is usually bidirectional.
  5. 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

Packet Header (60%)
Source Address
Dest Address
Sequence #
Hop Count
Error Check
Data Payload (40%)
Control Information
Actual Message Data

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

Source Address: Identifies sender
Destination Address: Identifies receiver
Sequence Number: For reassembly
Hop Count (TTL): Prevents infinite loops
Error Check (CRC): Data integrity verification

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

Marking Scheme & Answer
  1. [1 mark] Sender provides identity of the intended receiver
  2. [1 mark] The system checks whether or not the receiver is ready to accept data
  3. [1 mark] A circuit/channel between sender and receiver must be established
  4. [Additional] Data transfer then takes place (after establishment)
  5. [Additional] After data transfer is complete, the connection is terminated
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
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
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
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
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
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
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
Marking Scheme & Answer
  1. [1 mark] Web page is divided up into data packets
  2. [1 mark] Each packet has a header including destination IP address
  3. [1 mark] Router checks header against routing table to determine next router
  4. [1 mark] MAC address of next router added to packet header
  5. [1 mark] Hop value checked - if 0, packet discarded
  6. [1 mark] Each packet may take different route based on network conditions
  7. [Additional] Destination computer reassembles packets into final web page
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