跳转至

2.0 Physical Layer

The Physical Layer is the lowest layer in the OSI model responsible for transmitting a raw bit stream over the physical communication medium. It handles the electrical and mechanical interfaces between data and the physical medium, distinct from higher layers which interact through defined interfaces.

Transmission Media

Various transmission media carry data signals physically, each with distinct characteristics affecting network performance.

Medium TypeCostSpeed RangeDistance LimitEMI ResistanceInstallation
UTP CableLow10 Mbps - 10 Gbps100mPoorSimple
STP CableMediumHigher than UTP>100mGoodMedium
CoaxialMedium10 Mbps - 1 Gbps500mFairMedium
Optical FiberHighGbps - Tbps>100 kmExcellentComplex
WirelessLow-MediumVariableVariablePoorSimple

Unshielded Twisted Pair (UTP) Cable

Low-cost network cable with insulated conductors twisted together and covered with a plastic jacket. Widely used in Local Area Networks (LANs). Susceptible to electromagnetic interference. Has limits on cable length (e.g., 100m for 10Base-T) and number of taps due to signal decay.

Shielded Twisted Pair (STP) Cable

Similar to UTP but includes an extra foil wrapping or copper braid jacket for electromagnetic interference shielding. STP cables are costlier than UTP but can support higher transmission rates over longer distances.

Coaxial Cable

Used for television connections and original Ethernet. Includes baseband (digital signaling, used by original Ethernet) and broadband (analog signaling) types.

Optical Fibre

Transmits data using light signals based on total internal reflection. Offers very high speed and long distances without needing repeaters (e.g., over 100 km for single-mode fiber). Single-mode fiber is expensive but can handle gigabits per second data rates. Requires conversion of bits into light signals.

Radio/Wireless (Microwave, Satellite, Cellular)

Uses air or space as the medium. Offers mobility but is susceptible to interference (signal interference, rain, atmospheric conditions, objects in the path), reflections, diffractions, and multi-path fading. Wireless networks are often slower and have less transfer rate compared to wired networks due to these factors. Different frequency bands are used, some licensed (like cellular networks) and some license-free (like the ISM band used by Wi-Fi and Bluetooth).

Basic Network Measurements

Understanding network performance is crucial for system design and troubleshooting.

MetricDefinitionUnitsTypical ValuesAffects
LatencyTime for first bit to travelmsLAN: <1ms, WAN: 10-100msResponse time
BandwidthTheoretical maximum ratebps10M-100GCapacity
ThroughputActual achieved ratebps60-80% of bandwidthReal performance
RTTRound-trip timems2x latency + processingProtocol timers

Latency

The amount of time it takes for the first bit of data to reach the destination. Also referred to as propagation delay.

Bandwidth

The data transfer rate, indicating the number of bits that can be passed through a network connection. Conceptually related to the width of a pipe for water flow. Historically related to the frequency range within the medium (higher frequency potentially allowing for higher data transfer rate). Note the distinction between advertised bandwidth (what is sold) and actual throughput (what is achieved).

Throughput

The actual achieved transfer rate of data. Often less than the theoretical bandwidth due to various factors.

Round Trip Time (RTT)

The time it takes for a signal or packet to go from source to destination and back. Influences network performance and protocol design (e.g., timeout intervals for retransmission).

Encoding

Encoding in the Physical Layer refers to how binary bits (0s and 1s) are represented as signals for transmission over the physical medium (e.g., electrical signals, light pulses). The choice of encoding scheme can affect performance, help break problematic signal sequences, and aid in error detection.

Encoding TypeSignal LevelsDC ComponentClock RecoveryBandwidth EfficiencyCommon Issues
NRZ-L2 (0V, +V)YesPoorGoodLong runs
AMI3 (-V, 0, +V)NoFairGoodLong zeros
Manchester2 (-V, +V)NoExcellentPoor (2x bandwidth)None
Diff. Manchester2 (-V, +V)NoExcellentPoor (2x bandwidth)Complex

NRZ-L (Non-Return-to-Zero Level)

A basic digital encoding scheme where the signal level corresponds directly to the bit value (e.g., high voltage for 1, low voltage for 0). Can suffer from problems with long sequences of the same bit (no transitions, making clock recovery difficult) and potential DC component issues.

AMI (Alternate Mark Inversion)

A bipolar encoding scheme where 'mark' (typically a 1 bit) is represented by alternating positive and negative pulses, while 0 is represented by zero voltage. Helps eliminate the DC component but still has issues with long sequences of 0s.

Manchester Encoding

A phase encoding scheme used in Ethernet (IEEE 802.3). A transition occurs in the middle of each bit period. The direction of the transition represents the bit value (e.g., low-to-high for 1, high-to-low for 0). Provides a clocking mechanism within the data stream (self-clocking).

Differential Manchester Encoding

Similar to Manchester but uses the presence or absence of a transition at the beginning of the bit period to represent 0 or 1, respectively. A transition always occurs in the middle for clocking.

Scrambling Techniques (B8ZS, HDB3)

Used to address the problem of long sequences of 0s in AMI or other unipolar/bipolar schemes. These techniques replace sequences of zeros with specific patterns that include intentional voltage violations (violations of the AMI alternation rule).

B8ZS (Bipolar 8-Zero Substitution)

Replaces sequences of eight consecutive zeros with a specific pattern of pulses, including voltage violations. The pattern depends on the polarity of the last non-zero pulse preceding the sequence.

HDB3 (High-Density Bipolar 3-Zero Code)

Replaces sequences of four consecutive zeros with a specific pattern, also including voltage violations. The pattern depends on the polarity of the last non-zero pulse and the parity of the number of non-zero pulses since the last substitution. These violations help the receiver maintain synchronization.

Error Detection and Correction

Errors can occur during transmission due to noise or other channel impairments. Error detection allows the receiver to determine if an error has occurred. Error correction allows the receiver to not only detect but also fix certain errors without retransmission.

MethodTypeOverheadError DetectionError CorrectionComplexity
ChecksumDetectionLowSingle-bit, some multi-bitNoneLow
CRCDetectionMediumExcellent burst detectionNoneMedium
Hamming CodeDetection + CorrectionHigh2-bit detection1-bit correctionHigh

Need for Error Handling

The receiver simply receives a stream of bits. Without error detection, the receiver cannot know if the received bits are the same as what was sent, especially in noisy channels.

Error Detection Methods

Checksum

A mathematical method used for error detection. A sum is calculated over the data (or header) bits at the sender and appended to the message. The receiver performs the same calculation and compares it to the received checksum. Often used specifically for IP header integrity (Header Checksum). The UDP protocol also includes an optional checksum over the UDP header and data. The basic addition-based checksum can detect single-bit errors but not all two-bit errors.

Cyclic Redundancy Check (CRC)

A more powerful error detection method based on polynomial division. A CRC value is calculated over the data bits at the sender using a predefined polynomial and appended as a trailer. The receiver performs the same calculation over the received data and trailer; if the result is zero (or matches an expected value), it indicates no error. CRCs are generally more effective at detecting burst errors than simple checksums.

Error Detection and Correction Methods

Hamming Code

A technique capable of detecting and correcting single-bit errors, and detecting (but not correcting) certain multi-bit errors.

Principle

Adds redundant bits (called parity or control bits) to the original data bits. These parity bits are calculated based on specific groups of data bits.

Number of Redundant Bits

For a message of m data bits, the minimum number of redundant bits p required can be found using the formula: 2^p ≥ p + m + 1. For example, with m=11 data bits, you need p=4 redundant bits (2^4=16 ≥ 4+11+1=16).

Location of Redundant Bits

The parity bits are placed at positions that are powers of 2 (positions 1, 2, 4, 8, 16, ...) within the complete codeword (data + parity bits). The remaining positions are for the original data bits.

Calculation (Even/Odd Parity)

For even parity (common method), each parity bit is calculated so that the total number of 1s in its corresponding group of bits (including the parity bit itself) is even. The groups of bits checked by each parity bit are determined by their binary position; for example, parity bit at position 1 (0001) checks all positions where the least significant bit is 1 (1, 3, 5, 7, 9, 11, ...), parity bit at position 2 (0010) checks positions where the second bit is 1 (2, 3, 6, 7, 10, 11, ...), and so on.

Checking and Correcting Errors

At the receiver, the parity bits are recalculated based on the received data using the same grouping logic. If all recalculated parity bits match the received parity bits, there is likely no single-bit error. If they don't match, the positions of the incorrect parity bits form a binary number that indicates the exact position of the corrupted bit in the received codeword, allowing it to be flipped (corrected). For example, if parity check 1 (position 1) and parity check 4 (position 4) fail, and check 2 (position 2) succeeds, the error is at position 1+4=5.

Comparative Analysis and Examples

Key Relationships Between Physical Layer Concepts

Concept CategoryPrimary GoalTrade-offsReal-world Impact
Transmission MediaSignal transportCost vs Performance vs DistanceInfrastructure decisions
Network MeasurementsPerformance quantificationAccuracy vs OverheadQoS requirements
Encoding SchemesBit representationEfficiency vs ReliabilityProtocol compatibility
Error HandlingData integrityOverhead vs ProtectionApplication reliability

Example Calculation: Propagation Delay

Problem: Calculate one-way propagation delay for a 100 km fiber optic link where signal travels at 2×10^8 m/s.

Solution Steps:

Given:
- Distance (d) = 100 km = 100,000 m
- Signal speed (v) = 2×10^8 m/s

Formula: Propagation Delay = Distance / Speed

Calculation:
Propagation Delay = 100,000 m / (2×10^8 m/s)
                  = 100,000 / 200,000,000
                  = 0.0005 s
                  = 0.5 ms
ParameterValueUnit
Distance100km
Signal Speed2×10^8m/s
Propagation Delay0.5ms

Example Calculation: Hamming Code Redundant Bits

Problem: Determine minimum number of parity bits needed for 11 data bits using Hamming code.

Solution Steps:

Formula: 2^p ≥ p + m + 1
Where: p = parity bits, m = data bits = 11

Testing values:
p (parity bits)2^pp + m + 12^p ≥ (p + m + 1)?Result
121 + 11 + 1 = 132 ≥ 13?No
242 + 11 + 1 = 144 ≥ 14?No
383 + 11 + 1 = 158 ≥ 15?No
4164 + 11 + 1 = 1616 ≥ 16?Yes

Answer: Minimum 4 parity bits required for 11 data bits.

Encoding Scheme Comparison Visualization

Data Sequence Example: 1011

Bit Period:     |  1  |  0  |  1  |  1  |

NRZ-L:         ____      ________
               |   |    |
               |   |____|
               +V  0V   

AMI:           ____           ____
               |   |         |   
               |   |_________|   
               +V  0V        -V  

Manchester:    __    __    __    __
               | |  | |   | |  | |
               | |__| |___| |__| |
               (↑=1, ↓=0 transitions)

These concepts form the core foundation of Physical Layer understanding for network communications, emphasizing the relationships between medium characteristics, performance metrics, signal encoding, and error management strategies.