1 hardware building blocks five issues –encoding –framing –error detection –reliable...
Post on 21-Dec-2015
218 views
TRANSCRIPT
1
• Hardware Building Blocks• Five Issues
– Encoding– Framing– Error Detection– Reliable delivery– Access Mediation
Direct Link Networks
2
Building Blocks
• Nodes: PC, special-purpose hardware…– hosts– switches
• Links (Transmission Media): – Guided: twisted pair, coax cable, optical fiber
– Unguided: radio, microwaves, infrared, lasers
3
Radio Infrared UVMicrowave Gamma ray
f (Hz)
FM
Coax
Satellite
TV
AM Terrestrial microwave
Fiber optics
X ray
100
104 105 106 107 108 109 1010 1011 1012 1013 1014 1015 1016
102 106 108 1010 1012 1014 1016 1018 1020 1022 1024104
The Electromagnetic Spectrum
4
Properties of A Link• Frequency• Encoding
– Lower layers• modulation
– Upper layers• “high” signal• “low” signal
• Multiple-access links– How many bit streams can be encoded on it at a given time.
• Point-to-point links– Full-duplex– Half-duplex
• How can I get one?
5
Common types of cables and fibers available for local links
Cable Typical Bandwidths Distance
Category 5 twisted pair (Cat-5)
10 – 100 Mbps 100m
Thin-net Coax 10 – 100 Mbps 200m
Thick-net coax 10 – 100 Mbps 500m
Multimode fiber 100 Mbps 2km
Single-mode fiber 100-2400Mbps 40km
6
Common bandwidths available from the carriers
Services Bandwidth
DS1 1.544 Mbps
DS3 44.736 Mbps
STS-1 51.840 Mbps
STS-3 155.520Mbps
STS-N N * 51.840 Mbps
7
Common services available to connect your home
Services Bandwidth
POTS 28.8 – 56 Kbps
ISDN 64 – 128 Kbps
ADSL 16Kbps – 8.448 Mbps
VDSL 12.96 - 55.2 Mbps
CATV 20 – 40 Mbps
Last-Mile Links
8
Centraloffice
Subscriberpremises
1.554– 8.448 Mbps
16– 640 Kbps
Local loop
Centraloffice
Neighborhood opticalnetwork unit
STS-N
over fiber
Subscriberpremises
VDSL at 12.96– 55.2 Mbps
over 1000– 4500 feet of copper
ADSL (asymmetric digital subscriber line)
VDSL
9
ADSL versus Cable
• Bandwidth
• The number of subscriber
• Availability
• Security
• Reliability
10
Encoding
• Signals propagate over a physical medium– modulate electromagnetic waves
– e.g., vary voltage
• Encode binary data onto signals– e.g., 0 as low signal and 1 as high signal
– known as Non-Return to zero (NRZ)
Bits
NRZ
0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0
11
Problem: Consecutive 1s or 0s
• Long strings of 1s or 0s cause:– baseline wander
– Unable to recover clock (clock drift)
• Low signal (0) may be interpreted as no signal
12
Alternative Encodings
• Non-return to Zero Inverted (NRZI)– make a transition from current signal to encode a one;
stay at current signal to encode a zero– solves the problem of consecutive ones
• Manchester– 0 low-to-high transition– 1 high-to-low transition– transmit XOR of the NRZ encoded data and the clock– only 50% efficient (the bit rate = the half baud rate)
13
Encodings (cont)
• 4B/5B (FDDI)– every 4 bits of data encoded in a 5-bit code– 5-bit codes selected to have no more than one leading 0
and no more than two trailing 0s – thus, never get more than three consecutive 0s– resulting 5-bit codes are transmitted using NRZI – achieves 80% efficiency
14
Encodings (cont)
Bits
NRZ
Clock
Manchester
NRZI
0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0
15
Framing
• Break sequence of bits into a frame• Typically implemented by network adaptor
– Determining where the frame begins and ends
Frames
BitsAdaptor Adaptor Node BNode A
16
Sentinel Based Approach
• Byte-Oriented Protocols– e.g. BISYNC, PPP
– problem: special character appears in the data portion
– solution: character stuffing• Preceding the ETX with a DLE (data-link-escape) character
SY
N
Header Body
8 8 8 8 168
SY
N
SO
H
ST
X
ET
X
CRC
17
• Bit-Oriented Protocols – delineate frame with special pattern: 01111110– e.g., HDLC, SDLC
– problem: special pattern appears in the payload– solution: bit stuffing
• sender: insert 0 after five consecutive 1s• receiver: delete 0 that follows five consecutive 1s
Header Body
8 16 16 8
CRCBeginningsequence
Endingsequence
18
Counter-based Approaches
• Counter-based– include payload length in header– e.g., DDCMP
– problem: count field corrupted– solution: catch when CRC fails
SY
N
Header Body
8 8 4214 168
SY
N
Cla
ss CRCCount
19
Clock-based Approaches
• SONET– e.g., SONET: Synchronous Optical Network– each frame is 125-s long– STS-n (STS-1 = 51.84 Mbps)
Overhead Payload
90 columns
9 rows
STS-1Hdr STS-1Hdr STS-1Hdr
STS-3cHdr
20
•Encoding in SONET– NRZ– sender: XOR of the data by the use of a well- known bit pattern (127 bits long).–Receiver: ???
21
Error Detection
• Two-Dimensional Parity• Cyclic-Redundancy Check• Internet Checksum Algorithm
22
1011110 1
1101001 0
0101001 1
1011111 0
0110100 1
0001110 1
1111011 0
Paritybits
Paritybyte
Data
Two-Dimensional Parity
23
Cyclic Redundancy Check
• Add k bits of redundant data to an n-bit message– want k << n
– e.g., k = 32 and n = 12,000 (1500 bytes)
• Represent n-bit message as n-1 degree polynomial– e.g., MSG=10011010 as M(x) = x7 + x4 + x3 + x1
• Let k be the degree of some divisor polynomial– e.g., C(x) = x3 + x2 + 1
24
CRC (cont)
• Transmit polynomial P(x) that is evenly divisible by C(x) – shift left k bits, i.e., M(x)xk
– subtract remainder of M(x)xk / C(x) from M(x)xk
• Receiver polynomial P(x) + E(x)– E(x) = 0 implies no errors
• Divide (P(x) + E(x)) by C(x); remainder zero if:– E(x) was zero (no error), or– E(x) is exactly divisible by C(x)
25
Selecting C(x)
• All single-bit errors, as long as the xk and x0 terms have non-zero coefficients.
• All double-bit errors, as long as C(x) contains a factor with at least three terms
• Any odd number of errors, as long as C(x) contains the factor (x + 1)
• Any ‘burst’ error (i.e., sequence of consecutive error bits) for which the length of the burst is less than k bits.
• Most burst errors of larger than k bits can also be detected
• See Table 2.6 on page 102 for common C(x)
26
Internet Checksum Algorithm
• View message as a sequence of 16-bit integers; sum using 16-bit ones-complement arithmetic; take ones-complement of the result.
u_shortcksum(u_short *buf, int count){ register u_long sum = 0; while (count--) { sum += *buf++; if (sum & 0xFFFF0000) { /* carry occurred, so wrap around */ sum &= 0xFFFF; sum++; } } return ~(sum & 0xFFFF);}
27
Acknowledgements & TimeoutsSender Receiver
Frame
ACK
Tim
eout
Tim
e
Sender Receiver
Frame
ACK
Tim
eout
Frame
ACKTim
eout
Sender Receiver
Frame
ACKTim
eout
Frame
ACKTim
eout
Sender Receiver
Frame
Tim
eout
Frame
ACKTim
eout
(a) (c)
(b) (d)
28
Stop-and-Wait
• Problem: keeping the pipe full• Example
– 1.5Mbps link x 45ms RTT = 67.5Kb (8KB)
– 1KB frames implies 1/8th link utilization
Sender Receiver
29
Sliding Window• Allow multiple outstanding (un-ACKed) frames• Upper bound on un-ACKed frames, called window
Sender Receiver
Tim
e
……
30
SW: Sender• Assign sequence number to each frame (SeqNum)• Maintain three state variables:
– send window size (SWS)– last acknowledgment received (LAR)– last frame sent (LFS)
• Maintain invariant: LFS - LAR <= SWS
• Advance LAR when ACK arrives • Buffer up to SWS frames
SWS
LAR LFS
… …
31
SW: Receiver• Maintain three state variables
– receive window size (RWS)– largest acceptable frame (LAF)– last frame received (LFR)
• Maintain invariant: LAF - LFR <= RWS
• Frame SeqNum arrives:– if LFR < SeqNum < = LAF accept– if SeqNum < = LFR or SeqNum > LAF discarded
• Send cumulative ACKs
RWS
LFR LAF
… …
32
Sequence Number Space• SeqNum field is finite; sequence numbers wrap around• Sequence number space must be larger then number of
outstanding frames• SWS <= MaxSeqNum-1 is not sufficient
– suppose 3-bit SeqNum field (0..7)– SWS=RWS=7– sender transmit frames 0..6– arrive successfully, but ACKs lost– sender retransmits 0..6– receiver expecting 7, 0..5, but receives second incarnation of 0..5
• SWS < (MaxSeqNum+1)/2 is correct rule• Intuitively, SeqNum “slides” between two halves of sequence
number space
33
Concurrent Logical Channels• Multiplex 8 logical channels over a single link• Run stop-and-wait on each logical channel• Maintain three state bits per channel
– channel busy– current sequence number out– next sequence number in
• Header: 3-bit channel num, 1-bit sequence num– 4-bits total– same as sliding window protocol
• Separates reliability from order