CACS303 Computer Networking

Computer NetworkingUnit 1314 min read

Multiplexing Types & Bit Stuffing in Data Transmission

Unit 13 of Computer Networking covers how multiple signals share a single communication channel (multiplexing) and how bit stuffing prevents false flags in protocols like HDLC. Learn FDM, TDM, WDM, and STDM with real-world examples, plus bit/byte stuffing mechanics with worked traces.

TAKEAWAYS:

  • Multiplexing combines multiple signals into one channel to improve efficiency and reduce costs.
  • Frequency Division Multiplexing (FDM) divides bandwidth into non-overlapping frequency slots.
  • Time Division Multiplexing (TDM) allocates fixed time slots to each signal in a round-robin fashion.
  • Statistical Time Division Multiplexing (STDM) dynamically allocates slots only when data is present.
  • Bit stuffing inserts extra bits to prevent false flag sequences in protocols like HDLC.
  • Byte stuffing escapes control characters in protocols like PPP to ensure data integrity.

What is Multiplexing?

Multiplexing is the technique of combining multiple signals (data streams) into a single shared communication channel. It is widely used in telecommunication systems to efficiently utilize bandwidth and reduce costs. The key idea is to allow multiple users or devices to transmit data simultaneously over the same physical medium.

Why Multiplexing?

  • Efficiency: Maximizes the use of available bandwidth.
  • Cost-Effective: Reduces the need for multiple physical channels.
  • Scalability: Supports multiple users/devices without increasing infrastructure.

Types of Multiplexing

1. Frequency Division Multiplexing (FDM)

FDM divides the total bandwidth of a communication channel into smaller non-overlapping frequency bands, each allocated to a different signal. This is commonly used in radio broadcasting, cable TV, and mobile networks.

How FDM Works:

  • The total bandwidth is split into frequency slots.
  • Each signal is modulated onto a different carrier frequency.
  • Signals are transmitted simultaneously without interference.

Example:

In FM radio, different stations broadcast on distinct frequencies (e.g., 98.5 MHz, 101.2 MHz). Your radio tuner selects the desired frequency band to listen to a specific station.

Slot 1Ncell Call ASlot 2Ncell Call BSlot 3Daraz Data Packet1Slot 4Daraz Data Packet2
Time Division Multiplexing Example (Ncell/Daraz)
Frequency 1Frequency 2Frequency 3Frequency 4FDM ChannelRadio Station 1Radio Station 2TV Channel 1TV Channel 2
Frequency Division Multiplexing Example (Radio/TV)

Real-World Application:

Example in Nepal:

  • Nepal Television (NTV): Uses FDM to broadcast multiple TV channels over a single cable. Each channel occupies a specific frequency band (e.g., 5 MHz to 8 MHz for one channel, 8 MHz to 11 MHz for another).

2. Time Division Multiplexing (TDM)

TDM divides the time domain into fixed time slots, each allocated to a different signal in a cyclic manner. This allows multiple signals to share the same channel by taking turns.

How TDM Works:

  • Time is divided into frames.
  • Each frame is divided into fixed-length time slots.
  • Each signal gets a dedicated slot in every frame.

Example:

Imagine four friends (A, B, C, D) sharing a single microphone in a round-robin fashion. Each gets 1 second to speak in every 4-second cycle.

Real-World Application:

Example in Nepal:

  • Ncell and NTC: Use TDM in their digital telephony networks to handle multiple voice calls simultaneously over the same physical line. Each call is assigned a time slot in a repeating cycle.

3. Statistical Time Division Multiplexing (STDM)

STDM is an advanced form of TDM where time slots are dynamically allocated only when data is present. This improves efficiency by avoiding idle slots.

How STDM Works:

  • Time slots are assigned on-demand.
  • Only active signals get slots, reducing wasted bandwidth.
  • Requires buffering to handle variable data rates.

Example:

If only two out of four friends are speaking at a time, STDM will only allocate slots to those two, leaving the other two slots free for other uses.

Real-World Application:

Example in Nepal:

  • eSewa and Khalti: Use STDM-like techniques to handle variable transaction loads. During peak hours (e.g., festival seasons), more slots are dynamically allocated to active users.

4. Wavelength Division Multiplexing (WDM)

WDM is a specialized form of FDM used in fiber-optic communication. It combines multiple optical signals onto a single fiber by using different wavelengths (colors) of light.

How WDM Works:

  • Each signal is transmitted at a distinct wavelength (e.g., 1550 nm, 1560 nm).
  • A multiplexer combines these signals into a single fiber.
  • A demultiplexer at the receiver separates them.

Example:

Think of a fiber-optic cable as a superhighway where each lane carries a different color of light (wavelength), allowing multiple signals to travel simultaneously.

Real-World Application:

Example Worldwide:

  • Google and YouTube: Use WDM in their global fiber-optic networks to transmit massive amounts of data (e.g., videos, searches) simultaneously. For example, a single fiber can carry hundreds of terabits per second using WDM.

Comparison of Multiplexing Techniques

Feature FDM TDM STDM WDM
Bandwidth Division Frequency bands Fixed time slots Dynamic time slots Wavelengths (light colors)
Simultaneity Yes (parallel) No (sequential) No (sequential, dynamic) Yes (parallel)
Efficiency Moderate (fixed allocation) Moderate (fixed slots) High (dynamic allocation) Very High (optical)
Use Case Radio, TV, mobile networks Digital telephony, ISDN Internet, data networks Fiber-optic backbones
Complexity Low Moderate High (buffering required) High (optical components)

Bit Stuffing and Byte Stuffing

Bit Stuffing

Bit stuffing is a technique used in protocols like HDLC (High-Level Data Link Control) to prevent the receiver from misinterpreting a sequence of bits as a flag (e.g., 01111110). The sender inserts extra bits (usually 0) into the data stream to ensure that the flag sequence does not appear accidentally.

How Bit Stuffing Works:

  1. The sender monitors the outgoing bit stream.
  2. Whenever five consecutive 1s are detected, a 0 is inserted after them.
  3. The receiver removes these stuffed 0s to recover the original data.

Example:

Original data: 10111110111111

  • After first 11111, insert 0: 10111110 0 111111
  • After second 11111, insert 0: 10111110 0 111110 0 1 Transmitted data: 10111110011111001

Real-World Application:

Example in Nepal:

  • NTC’s Data Networks: Uses HDLC-like protocols for point-to-point links between routers. Bit stuffing ensures that control flags (e.g., start/end of frame) are not mistaken for data.

Byte Stuffing

Byte stuffing is used in protocols like PPP (Point-to-Point Protocol) to escape control characters (e.g., 0x7E, the PPP flag). If the data contains the flag byte, the sender inserts an escape character (0x7D) followed by the XOR of the flag byte with 0x20.

How Byte Stuffing Works:

  1. If the data contains 0x7E, replace it with 0x7D 0x5E (since 0x7E ^ 0x20 = 0x5E).
  2. If the data contains 0x7D, replace it with 0x7D 0x5D (since 0x7D ^ 0x20 = 0x5D).

Example:

Original data: 0x7E 0x7D 0xAB

  • 0x7E → 0x7D 0x5E
  • 0x7D → 0x7D 0x5D Transmitted data: 0x7D 0x5E 0x7D 0x5D 0xAB

Real-World Application:

Example Worldwide:

  • WhatsApp and Pathao: Use PPP-like protocols for secure point-to-point communication between servers. Byte stuffing ensures that control characters (e.g., session start/end) are not misinterpreted as data.

Worked Example: Bit Stuffing in HDLC

Problem: Transmit the following bit stream using HDLC with bit stuffing: Original data: 10111110111111

Solution:

  1. Start with the original data: 1 0 1 1 1 1 1 0 1 1 1 1 1 1
  2. Scan for 11111:
    • After the 5th bit: 1 0 1 1 1 1 1 0 → No 11111 yet.
    • Next bits: 1 1 1 1 1 → Insert 0 after the 5th 1. Transmitted so far: 1 0 1 1 1 1 1 0 0
  3. Continue scanning:
    • Next bits: 1 1 1 1 1 → Insert 0 again. Final transmitted data: 1 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1

Transmitted bit stream: 1011111001111101

Receiver’s Task: The receiver sees 1011111001111101 and removes every 0 that follows five 1s:

  • After 111110, remove the 0 → 10111110111111
  • After 111110, remove the 0 → 10111110111111 (original data recovered).

Worked Example: Byte Stuffing in PPP

Problem: Transmit the following byte sequence using PPP with byte stuffing: Original data: 0x7E 0x7D 0xAB 0x7E 0x01

Solution:

  1. Replace 0x7E with 0x7D 0x5E (since 0x7E ^ 0x20 = 0x5E).
  2. Replace 0x7D with 0x7D 0x5D (since 0x7D ^ 0x20 = 0x5D).
  3. The second 0x7E is also replaced.

Step-by-step:

  • 0x7E → 0x7D 0x5E
  • 0x7D → 0x7D 0x5D
  • 0xAB remains.
  • 0x7E → 0x7D 0x5E
  • 0x01 remains.

Transmitted data: 0x7D 0x5E 0x7D 0x5D 0xAB 0x7D 0x5E 0x01

Receiver’s Task: The receiver scans for 0x7D:

  • 0x7D 0x5E → 0x5E ^ 0x20 = 0x7E (original flag).
  • 0x7D 0x5D → 0x5D ^ 0x20 = 0x7D (original escape).
  • 0x7D 0x5E → 0x5E ^ 0x20 = 0x7E (original flag).

Recovered data: 0x7E 0x7D 0xAB 0x7E 0x01.


In the Real World

Multiplexing and stuffing techniques are everywhere in modern communication systems. Here’s how they are used in real-world applications:

  1. eSewa and Khalti (Nepal):

    • STDM: During peak transaction times (e.g., Dashain or Tihar), eSewa dynamically allocates more time slots to handle the increased load of users making payments. This ensures smooth transactions without overloading the system.
    • Bit Stuffing: The underlying protocols (e.g., TCP/IP) use bit stuffing to ensure that control flags in packet headers are not misinterpreted as part of the transaction data.
  2. Ncell and NTC (Nepal):

    • TDM: Both companies use TDM in their 2G/3G networks to handle multiple voice calls over the same physical line. Each call is assigned a fixed time slot in a repeating cycle.
    • FDM: In 4G/LTE networks, FDM is used to allocate different frequency bands to multiple users simultaneously, improving data speeds.
  3. Daraz and Pathao (Nepal):

    • WDM: Daraz’s backend servers use WDM in their fiber-optic connections to handle massive data traffic (e.g., product listings, user orders). This allows them to transmit data at terabits per second.
    • Byte Stuffing: Pathao’s app uses PPP-like protocols for secure communication between its servers and rider/driver apps. Byte stuffing ensures that control characters (e.g., session start/end) are not corrupted during transmission.
  4. Google and YouTube (Worldwide):

    • WDM: Google’s global fiber network uses WDM to transmit data across continents. For example, a single fiber can carry thousands of terabits per second by combining multiple wavelengths.
    • Multiplexing in Data Centers: Google’s data centers use TDM and STDM to manage traffic between servers, ensuring efficient use of network resources.
  5. Nepal Electricity Authority (NEA) and NTC:

    • FDM: NTC uses FDM in its microwave links to transmit multiple signals (voice, data) over the same radio frequency band.
    • Bit Stuffing: NEA’s SCADA systems (used for monitoring power grids) use bit stuffing in serial communication to prevent false flags in control messages.

Exam Tip

This unit is often tested with short-answer questions, numerical examples, and comparisons. Here’s how to score full marks:

  1. Definitions:

    • Always define multiplexing as "combining multiple signals into a single channel."
    • For bit/byte stuffing, mention the purpose (preventing false flags/control characters) and the mechanism (inserting extra bits/bytes).
  2. Examples:

    • FDM: Radio stations, cable TV.
    • TDM: Digital telephony (Ncell/NTC).
    • STDM: Internet traffic (eSewa/Khalti).
    • WDM: Fiber-optic backbones (Google/YouTube).
    • Bit Stuffing: HDLC protocols (NTC data networks).
    • Byte Stuffing: PPP protocols (Pathao/WhatsApp).
  3. Worked Examples:

    • For bit stuffing, show the step-by-step insertion of 0s after five 1s.
    • For byte stuffing, demonstrate the escape sequence (e.g., 0x7D 0x5E for 0x7E).
  4. Comparisons:

    • Use a table to compare FDM, TDM, STDM, and WDM (as shown above). Highlight differences in bandwidth division, simultaneity, and efficiency.
  5. Diagrams:

    • Draw layered models for multiplexing (e.g., how FDM divides frequency bands).
    • For bit/byte stuffing, show the before-and-after bit/byte sequences.
  6. Real-World Links:

    • Connect multiplexing to Nepali examples (eSewa, Ncell, Daraz) and global examples (Google, YouTube). This shows practical understanding.

Divides by frequencyExample: FM radio stationsFrequency Division Multiplexing (FDM)Divides by time slotsExample: Ncell voice callsTime Division Multiplexing (TDM)Dynamic time slotsExample: Daraz data packetsStatistical TDM (STDM)Divides by wavelengthExample: Google fiber networksWavelength Division Multiplexing (WDM)Multiplexing
Types of Multiplexing with Nepali/Global Examples
sequenceDiagram
    participant Sender
    participant Channel
    participant Receiver
    Sender->>Channel: Transmit 10111110 (original)
    Channel-->>Receiver: 101111100 (with stuffed 0)
    Receiver->>Channel: Remove stuffed 0
    Channel-->>Sender: 10111110 (recovered)
    note right of Channel: Bit stuffing in HDLC
stateDiagram-v2
    [*] --> Idle
    Idle --> Transmit: Data ready
    Transmit --> CheckFiveOnes: Scan bits
    CheckFiveOnes --> StuffZero: Five 1s found?
    StuffZero --> Transmit: Yes
    CheckFiveOnes --> Transmit: No
    Transmit --> [*]: All bits sent

Based on the TU BCA syllabus for Computer Networking (CACS303), unit 13.

Discussion

Loading…