Upload
colin-booker
View
247
Download
2
Embed Size (px)
Citation preview
Advanced Computer Networks
Chapter 2: Direct Link Networks
Direct Link (Point-to-Point) Networks
• Simplest network possible, consisting of two hosts and one link
• Look into different function at the link level– Encoding– Framing– Error detection/correction– Reliable delivery– Media access control
Host A physical Link
2
Host B
2.1.1 Nodes
3
Figure 2.1: Example workstation architecture
Figure 2.1: Example workstation architecture
Figure 2.3: Memory bandwidth on a modern PC-class machine
2.1.2 Links• Cables• Leased Lines• Last-Mile Links• Wireless Links
4Figure 2.4: Electromagnetic Spectrum
Physical Medium• Signals travel through the medium and represent
bits.• Shannon’s Capacity Theorem
C = B log2(1+S/N)
• Defines the upper bound on the link capacity C in Hz.
• Can be used to evaluate the “error-free” bandwidth of a line
5
Shannon’s Theorem: Example• Voice-grade phone line: B =3,300 -300 Hz = 3 KHz• Typical SNR = 30 dB, where
dB = 10 x log10(S/N)
• For 30 dB S/N =1,000C = 3,000 x log2(1+1,000) ≈ 30 Kbps
• Higher bandwidth B (in Hz), higher capacity• Higher S/N, higher capacity• Can we have unlimited capacity?
6
Shannon’s Theorem: Example 2• Can the signal be weaker than the noise?• Assume capacity of 50 KHz (approx 50Kbps) over
1MHz• The required SNR would then be
C = B log2(1+S/N)
S/N = 2C/B - 1 = 0.035 or -14.5 dB • Think of spread spectrum communications• Transmit a weak signal over a large bandwidth
7
2.2 Encoding• Map binary bits into signals
8
Figure 2.8 Signals (electrical, electromagnetic) travel between signaling components; bit flow between adaptors
2.2 Encoding (Contd.)• Example: Low signal represents a 0, high signal
represents a 1• Non Return-to-Zero (NRZ)
• Problem: Long periods of silence (zero) or high signals are possible– Baseline wander (receiver loses track of reference sig)– Clock recovery (receiver loses clock synchronization)
9
Encoding: More Schemes• NRZ Inverted (NRZI): Switch from current state to
represent a 1• Manchester: XOR the bit stream with the clock
10
4B/5B Encoding Scheme• Encode 4-bit symbols into 5-bit Codes• 24 symbols must be mapped to 24 code-words out
of the possible 25. Table 2.4, Page 83. • Each codeword has no more than one starting
zero, and no more than two trailing zeros• No more than 3-consequtive zeros• Then use NRZI to solve the consecutive 1s
problem• 80% efficiency (1 bit is overhead)
11
2.3 Framing• The process of grouping bits into frames
(messages or packets)• Typically implemented by the network adaptor
12
Byte-Oriented Framing• In such protocols, frame is collection of bytes• Need to indicate the beginning and end of a frame
• Example: Point-to-Point (PPP) protocol, used by IP
– Start of Text: Flag: 01111110– Address and Control field usually carry default values– Protocol: IP or IPX Start of header– Payload: 1,500 bytes– Checksum: 2 or 4 bytes
13
Overhead: 8/1508 =0.5%
Byte-counting Framing• Include the # of bytes in the frame as a field in the
header• Digital Data Communications Protocol (DDCMP)
• Count: Specifies # of bytes in the body• CRC ensures that count field is not corrupted
14
Bit-oriented Framing• High-Level Data Link Control (HDLC)
• Beginning/end of frame, flag: 01111110• Instead of inserting bytes do bit stuffing to avoid
detection of flag in data.• Sender adds a 0 after five consecutive 1s• Receiver removes zero after five 1s
15
Example of Bit-stuffing• Sender
– 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0
• Receiver– 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 0
• Length of frame– Variable, depends on the data – We can calculate and optimize the overhead of bit stuffing
16
0 0 0 0
x x x x
2.3.3 Clock-Based Framing (SONET)• SONET: Synchronous Optical Network• Ninety rows of nine bytes each• First three bytes of each rare overhead• Data XORed with known sequence to ensure
synchronization
17Figure 2.16: A SONET Synchronous Transport Signal (STS)-1: Frame (51.84 Mbps)
2.4 Error Detection • Types of errors
– Isolated errors: Bit errors that do not affect other bits – Burst errors: A cluster of bits in which a number of
errors occur
• Burst errors increase with data rate– 1μs of impulse noise or fading effect will affect
• At most 2 bits when data rate is 1Mbps• At most 101 bits when data rate is 100Mbps
18
Dealing with Errors• Receiver must be aware that an error occurred in
a frame– Need to have an error detection mechanism
• Receiver must receive the correct frame• Two possible strategies
– Add information redundancy to correct errors (error correcting codes)
– Ask sender to re-send frame (retransmission strategies).
• In practice both are employed19
Error Detection Methods• Single parity checks
– Append a single parity bit at end of frame. Parity is 1 if # of ones is odd, and zero otherwise
– Example: 0 1 1 0 1 0 1 0 1 1 0 0 ← parity– Single parity check can detect any odd # of errors– Cannot tell where the error took place or how many
occurred– Not useful for burst errors
20
Two-dimensional Parity• Arrange bits of a frame into a two dimensional array
• Can detect all 1-, 2-, and 3-bit errors, and most 4-bit errors but not all
• Can also correct 1-bit errors, if it is known that a one-bit error occurred
21
1 0 0 1 0 1 0 1
0 1 1 1 0 1 0 0
1 1 1 0 0 0 1 0
1 0 0 0 1 1 1 0
0 0 1 1 0 0 1 1
1 0 1 1 1 1 1 0
Checksum • Treat data as 16-bit words• Add all words complement one and then append
the sum at the end of data• Complement one arithmetic
– Negative numbers are inverted positive ones – Carry from MSB is added to the result– Example : (-5) + (-3) = (-0101)+(-0011) = (1010) +(1100)
= 0110 + 1 = 0111 = ones complement of 8
• What type of errors can remain undedected?
22
Cyclic Redundancy Check (CRC)• Add k redundant bits on a n-bit message
– Design goal k<<n so that overhead is low– Example: 32-bit CRC adequate for 12,000 bits (1,500)
bytes
• Represent (n+1)-bit messages as n degree polynomials
• Example: 10011010 maps to x7 + x4 + x3 + x1
• The bits of the message to be transmitted become the coefficients of the polynomial
23
Polynomial Arithmetic• Facts:
– Any polynomial B(x) is divisible by a polynomial C(x) if deg(B) ≥ deg(C). C(x) is called the divisor
– If C(x) and B(x) are of the same degree, the remainder is obtained by subtracting C(x) from B(x)
– Modulo 2 arithmetic, subtraction is an XOR operation between coefficients
• Example B(x) = x3 + 1, C(x) = x3 + x2 + 1 • Remainder: R(x) = x2
• B(x) = 1001, C(x) =1101, R(x) = 0100 (XOR of B(x), C(x))
24
CRC Calculation• Goal: For message M(x), and divisor C(x),
construct polynomial P(x) that is divisible by C(x)• C(x) known to both sender and receiver• Process
– Step 1: multiply M(x) by xk (add k zeros at the end of message) and obtain T(x)
– Step 2: Divide T(x) by C(x)– Step 3: Subtract the remainder R(x) from T(x). – Step 4: Obtain P(x) = M(x)|R(x) divisible by C(x)
25
Example: CRC Calculation• M = 10011010, C(x) = x3 + x2 +1
• T(x) = 10011010 | 0000• R(x) = 101• P(x) = 10011010 | 101
26
Selection of C(x)• Bit errors can be seen as a polynomial E(x) added to P(x)• Error remains undetected if E(x) not divisible by C(x)• Single-bit errors: E(x) = xi, xk, x0 coefficients are nonzero,
all single-bit errors detected• Double-bit errors: C(x) has a factor with at least 3 terms• Odd number errors: C(x) contains the factor (x+1)• Any burst error of less than k bits and most burst errors
of larger than k bits
27
Commonly Used CRCsCRC C(x)
CRC-8 x8 + x2 + x + 1
CRC-10 x10 + x9 + x5 + x4 + x + 1
CRC-12 x12 + x11 + x3 + x2 + 1
CRC-16 x16 + x15 + x2 + 1
CRC-CCITT x16 + x12 + x5 + 1
CRC-32 x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x +1
28
Fundamentals of Coding• Coding: Map an k-bit word to an n-bit word.
– Notation: This code is usually referred to as (n,k)-code
• Weight of a word: The number of ones in the word.– Ex.: W(100011101)= 5
• Hamming distance between x, y: d(x,y) = W(xy)– Ex. x = 10011101, y = 11100110, d = 6
• # words at a hamming distance d: • # words at a distance up to d: • Minimum distance: the minimum Hamming distance out
of all distances in a code
29
d
n
d
i i
n
0
Detecting and Correcting Errors• An (n, k)-code can detect (n-k) / can detect up to
n-k-1 errors and correct up to n-k/2 errors• Example
– Hamming (7,4)-code, can detect any single or two bit errors, and correct any single bit error
• Well known codes– Hamming codes– Reed-Solomon codes: used in DSL, WiMax, CD, DVD,
Blue-Ray Discs
30