Packet Switching

The modern method of breaking data into packets for independent routing (e.g., Internet).

What is Packet Switching? The Postal Service Analogy

Packet switching is the dominant method for data transmission in modern networks like the Internet. The core idea is to break a large message into smaller, manageable chunks called packets.

Imagine you want to send a 100-page book to a friend. Instead of trying to find a massive, single envelope, you tear out each page, put each one in a standard-sized envelope, and mail them individually. Each envelope is like a packet. This analogy highlights the key features of packet switching:

  • Addressing: Each envelope (packet) is individually addressed with the sender's and recipient's address.
  • Independent Routing: The postal service can send each envelope via a different route to optimize delivery. One might fly through a major hub, another might travel by ground transport.
  • Reassembly: Your friend receives the envelopes, potentially out of order, and uses the page numbers to reassemble the book in the correct sequence.

Contrast with Circuit Switching

This is fundamentally different from , the technology of the old telephone network. A phone call established a dedicated, physical connection between you and the other person for the entire duration of the call. That line was yours alone and couldn't be used by anyone else, even during moments of silence. Packet switching shares the network resources much more efficiently.

Anatomy of a Packet

Each packet consists of two main parts, analogous to an envelope and the letter inside it.

  • Header (The Envelope): This is control information added to the front of the packet. It contains all the necessary instructions for the network to deliver the packet. Key header fields include:
    • Source and Destination Addresses: Where the packet came from and where it's going (e.g., IP addresses).
    • Sequence Number: Helps the destination device reorder the packets correctly.
    • Error-Checking Information: Data like a checksum or CRC that allows the receiver to verify if the packet was damaged in transit.
    • Other control data, like packet length or priority.
  • Payload (The Letter): This is the actual data (a small piece of the original message being sent). A packet's payload can range from a few bytes to several kilobytes.

The Packet's Journey: The Store-and-Forward Process

Packets travel across the network through intermediary devices called routers. Each router independently decides where to send each packet next based on its destination address. This is done using a mechanism called "store and forward".

  1. Store: A router receives a complete packet on one of its input ports and temporarily stores it in a memory buffer.
  2. Process: The router's processor reads the packet's header to determine its final destination. It consults its internal routing table to find the best next "hop" (the next router or device) on the path towards that destination.
  3. Forward: The router then sends the packet out on the appropriate output port towards the next hop.

This process is repeated at every router along the path until the packet finally reaches its destination.

Two Flavors of Packet Switching: Datagrams vs. Virtual Circuits

Packet-switched networks can operate in one of two modes:

Connectionless (Datagram)

In this mode, each packet (called a datagram) is treated as a completely independent entity. Routers make a new routing decision for every single packet. Packets from the same message can take different routes, arrive out of order, or even get lost. This requires a reliable protocol at the destination (like TCP) to reorder packets and handle retransmission.

Prime Example: The Internet Protocol (IP).

Connection-Oriented (Virtual Circuit)

In this mode, a logical path, called a , is established between the sender and receiver before any data is sent. All packets belonging to that connection follow the same predetermined path. Routing decisions are made only once during the setup phase. This guarantees in-order packet delivery.

Prime Example: ATM (Asynchronous Transfer Mode).

Key Advantages and Disadvantages

Advantages

  • Efficiency: It allows many users to share the same network links, making excellent use of available bandwidth. Links are only occupied when there is data to send.
  • Robustness: If a network link fails, routers can dynamically find alternative routes for packets, making the network resilient to failures.
  • Flexibility: It can support multiple services with varying bit rates on the same infrastructure, unlike circuit switching which reserves a fixed data rate.

Disadvantages

  • Variable Delay (Jitter): Because packets may have to wait in queues (buffers) at each router, the end-to-end delay is not constant. This can be problematic for real-time applications like voice and video calls.
  • Overhead: Each packet must carry a full header with addressing information, which consumes some of the available bandwidth.
  • Complexity: Requires complex protocols at the end devices to handle packet reordering and requests for retransmission of lost packets (e.g., TCP).
    Packet Switching | Teleinf Edu