5 min read
On this page

Physical Layer

The physical layer transmits raw bits over a communication channel. It deals with signals, encoding, modulation, and transmission media.

Signals

Analog vs Digital

Analog: Continuous signal varying over time (e.g., sound waves, voltage waveforms).

Digital: Discrete signal with a finite set of levels (e.g., 0V and 5V representing 0 and 1).

Digital transmission is preferred in computer networks: noise-tolerant, exact reproduction, easy multiplexing.

Encoding Schemes

Encoding maps digital data (bits) to physical signals.

Line Coding

NRZ (Non-Return to Zero): 0 = low voltage, 1 = high voltage. Simple but has clock recovery issues (long runs of same bit lose synchronization).

NRZI (NRZ-Inverted): Transition on 1, no transition on 0. Solves long-run-of-1 problem but not long-run-of-0.

Manchester: Transition in the middle of every bit period. Low→High = 1, High→Low = 0 (IEEE convention). Self-clocking. Used in 10 Mbps Ethernet.

Disadvantage: Requires twice the bandwidth of NRZ (transition every bit).

4B/5B: Map every 4 data bits to 5-bit code. The 5-bit codes are chosen to avoid long runs of zeros. Combined with NRZI. Used in 100 Mbps Ethernet (100BASE-TX).

8B/10B: Map 8 data bits to 10-bit code. DC balance (equal number of 0s and 1s over time). Maintains clock recovery. Used in Gigabit Ethernet, USB 3.0, SATA.

64B/66B: Map 64 data bits to 66-bit code (2-bit header). Lower overhead (3.1% vs 20% for 8B/10B). Used in 10 Gigabit Ethernet+.

PAM-4 (Pulse Amplitude Modulation): 4 voltage levels → 2 bits per symbol. Used in 400G Ethernet and PCIe 6.0. Higher data rate but more sensitive to noise.

Modulation

Encoding digital data onto an analog carrier wave (for wireless and long-distance transmission).

Basic Modulation Schemes

AM (Amplitude Modulation): Vary the carrier's amplitude. Simple but noise-sensitive.

FM (Frequency Modulation): Vary the carrier's frequency. More noise-resistant.

PM (Phase Modulation): Vary the carrier's phase. Basis for modern digital modulation.

Digital Modulation

ASK (Amplitude Shift Keying): Different amplitudes for 0 and 1.

FSK (Frequency Shift Keying): Different frequencies for 0 and 1.

PSK (Phase Shift Keying): Different phases for 0 and 1.

  • BPSK: 2 phases → 1 bit/symbol
  • QPSK: 4 phases → 2 bits/symbol

QAM (Quadrature Amplitude Modulation): Combine AM and PM. Multiple amplitude/phase combinations.

  • 16-QAM: 16 points → 4 bits/symbol
  • 64-QAM: 64 points → 6 bits/symbol
  • 256-QAM: 256 points → 8 bits/symbol (Wi-Fi 5/6)
  • 1024-QAM: 10 bits/symbol (Wi-Fi 6)
  • 4096-QAM: 12 bits/symbol (Wi-Fi 7)

Higher QAM orders carry more data per symbol but require better signal-to-noise ratio (SNR).

Multiplexing

Sharing a single channel among multiple users.

FDM (Frequency Division): Each user gets a different frequency band. Used in analog TV, radio, ADSL.

TDM (Time Division): Each user gets a time slot. Used in digital telephony (T1/E1), GSM.

WDM (Wavelength Division): Each signal uses a different wavelength of light in fiber. DWDM (Dense WDM): 80+ wavelengths per fiber. Powers long-haul fiber networks.

CDM (Code Division): Each user uses a unique code (spreading code). All users transmit simultaneously on the same frequency. Used in 3G cellular (CDMA). Based on orthogonal codes.

OFDM (Orthogonal FDM): Divide the channel into many narrow, orthogonal subcarriers. Each subcarrier carries data at low rate. Combined: high total rate. Efficient spectrum use. Used in Wi-Fi (802.11a/g/n/ac/ax), 4G LTE, 5G NR.

Transmission Media

Guided (Wired)

Twisted Pair: Two insulated copper wires twisted together (reduces crosstalk).

  • Cat 5e: Up to 1 Gbps, 100m
  • Cat 6: Up to 10 Gbps (55m) or 1 Gbps (100m)
  • Cat 6a: 10 Gbps, 100m
  • Cat 7/8: Up to 25-40 Gbps

Coaxial Cable: Central conductor + insulation + shield. Better noise immunity than twisted pair. Used for cable TV, older Ethernet (10BASE2).

Fiber Optic: Light pulses through glass/plastic fiber.

  • Single-mode: Small core (~9μm). Long distance (100+ km). Laser source. Used in long-haul, metro.
  • Multi-mode: Larger core (~50/62.5μm). Short distance (<2km). LED or VCSEL. Used in data centers.
  • Advantages: Enormous bandwidth (Tbps). Immune to EMI. Low loss. Secure (hard to tap).

Unguided (Wireless)

Radio: Omnidirectional. Wi-Fi (2.4/5/6 GHz), cellular, Bluetooth, LoRa.

Microwave: Directional point-to-point. Used for backhaul, satellite uplinks.

Infrared: Very short range. TV remotes, IrDA (obsolete for data).

Channel Capacity

Nyquist Theorem (Noiseless Channel)

C = 2B × log₂(L) bits/sec

where B = bandwidth (Hz), L = number of signal levels.

Example: 3000 Hz bandwidth, 2 levels → C = 2 × 3000 × 1 = 6000 bps.

Shannon's Theorem (Noisy Channel)

C = B × log₂(1 + SNR) bits/sec

where B = bandwidth (Hz), SNR = signal-to-noise ratio (linear, not dB).

SNR in dB: SNR_dB = 10 × log₁₀(SNR_linear). E.g., 30 dB → SNR = 1000.

Example: B = 3000 Hz, SNR = 30 dB → C = 3000 × log₂(1001) ≈ 30,000 bps.

Significance: Shannon's limit is the absolute maximum — no encoding scheme can exceed it. It guides modem/codec design: approach the Shannon limit as closely as possible.

Bandwidth and Throughput

Bandwidth: Maximum rate the physical medium can support.

Throughput: Actual rate achieved (always less due to protocol overhead, errors, congestion).

Goodput: Application-level throughput (throughput minus protocol headers and retransmissions).

Goodput ≤ Throughput ≤ Bandwidth

Latency Components

Total latency = Propagation + Transmission + Queuing + Processing

Propagation = Distance / Speed
  Copper: ~2/3 × c ≈ 200,000 km/s
  Fiber:  ~2/3 × c ≈ 200,000 km/s
  Wireless: c ≈ 300,000 km/s

Transmission = Packet size / Bandwidth
  1500 bytes on 1 Gbps = 12 μs
  1500 bytes on 10 Gbps = 1.2 μs

Queuing = Time in router buffers (variable, depends on congestion)

Processing = Header inspection, routing lookup (~μs)

Round-Trip Time (RTT): Time for a packet to go from A to B and back. RTT ≈ 2 × one-way latency (plus processing at B).

Speed of light: Earth's circumference ≈ 40,000 km. Minimum RTT ≈ 40,000 / 200,000 × 2 = 400 ms (through fiber — actual is ~300 ms due to shorter routes). NYC ↔ London ≈ 70 ms.

Applications in CS

  • Network design: Choose appropriate media (copper vs fiber vs wireless), encoding (4B/5B, 8B/10B), and modulation (QAM) for bandwidth and distance requirements.
  • Data center networking: Fiber for inter-rack connections. 25/100/400 Gbps links.
  • Wireless systems: Understanding modulation and channel capacity helps design Wi-Fi and cellular systems.
  • Performance analysis: Shannon's theorem sets theoretical limits. Nyquist determines sampling rates. Latency analysis guides system design.
  • IoT: Low-power wireless (LoRa, Zigbee) trades bandwidth for range and battery life.