Direct Link Networks: Building Blocks (2.1), Encoding (2.2), - - PowerPoint PPT Presentation
Direct Link Networks: Building Blocks (2.1), Encoding (2.2), - - PowerPoint PPT Presentation
Direct Link Networks: Building Blocks (2.1), Encoding (2.2), Framing (2.3) ECPE/CS 5516: Computer Networks Originally by Scott F. Midkiff (ECpE) Modified by Marc Abrams (CS) Virginia Tech courses.cs.vt.edu/~cs5516 Lecture Topics I Physical
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 2
Lecture Topics
I Physical layer
G Examples of direct links (2.1) G Data encoding (2.2)
I Point-to-point protocols
G Framing (2.3)
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 3
2.1: Hardware Building Blocks
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 4
Links at Physical Layer
I Physical media for links:
G Twisted pair G Coaxial cable G Optical fiber G Radio waves G Infrared
I Media + Electronics + Optics =
media properties
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 5
Physical Layer Properties
I Bit encoding:
How is information -- 1’s and 0’s -- encoded?
I Full-duplex versus half-duplex operation
G
Full-duplex: data in both directions simultaneously
G
Half-duplex: data in one direction at a time
I Data rate:
How much info can be sent in unit of time?
I Extent:
What’s max link length for reliable operation?
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 6
Link Examples
Category 5 twisted pair 50-ohm coax (Thinwire) 75-ohm coax (Thickwire) Multimode fiber Single-mode fiber Service 10-1000 Mbps 10-100 Mbps 10-100 Mbps Bandwidth 100 Mbps 100-2400 Mbps 100 m 200 m 500 m Distances 2 km 40 km
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 7
Examples of Leased Links
ISDN (B-channel) T1 (DS1) T3 (DS3) STS-3 (OC-3) STS-12 (OC-12) STS-24 (OC-24) STS-48 (OC-48) Service 64 Kbps 1.544 Mbps 44.736 Mbps 1.244160 Gbps 2.488320 Gbps Bandwidth 155.251 Mbps 622.080 Mbps
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 8
Links to Homes
POTS ISDN xDSL CATV Service 28.8-56 Kbps 64-128 Kbps 16Kbps-55Mbps Bandwidth 20-40 Mbps
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 9
2.2: Encoding
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 10
Encoding
I Encoding determines how information is
represented by electrical, optical, or electromagnetic signal
Node Adaptor Node Adaptor signal information
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 11
Example of Encoding
I The most intuitive… Non-return to Zero (NRZ)… I Encode “1” as high voltage level, “0” as low I Others:
G Non-return to zero inverted (NRZI) G Manchester G Block codes, e.g. 4B/5B
1 1 1 1
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 12
Physical Layer “Bit Pipe”
I Physical layer defines signal levels and timing
to deliver bit stream to Data Link layer
I Signal bandwidth determines data rate limit I Timing errors
G Noise or distortion can lead to errors in timing G Sender and receiver clocks may differ -- “drift”
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 12
Physical Layer “Bit Pipe”
I Physical layer defines signal levels and timing
to deliver bit stream to Data Link layer
I Signal bandwidth determines data rate limit I Timing errors
G Noise or distortion can lead to errors in timing G Sender and receiver clocks may differ -- “drift”
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 12
Physical Layer “Bit Pipe”
I Physical layer defines signal levels and timing
to deliver bit stream to Data Link layer
I Signal bandwidth determines data rate limit I Timing errors
G Noise or distortion can lead to errors in timing G Sender and receiver clocks may differ -- “drift”
10111010001
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 12
Physical Layer “Bit Pipe”
I Physical layer defines signal levels and timing
to deliver bit stream to Data Link layer
I Signal bandwidth determines data rate limit I Timing errors
G Noise or distortion can lead to errors in timing G Sender and receiver clocks may differ -- “drift”
10111010001 ??11???00?1
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 13
Asynchronous vs. Synchronous Transmission
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 14
Asynchronous Transmission (1)
I Each transmission is synchronized
G A start bit begins, stop bit ends transmission G Line stays in an idle state until next start bit
I Samples timed from beginning of start bit I Used in applications where performance can be reduced
to reduce costs
G Modems G PC serial ports
1 1 1 1 T/2 T start stop idle start NRZ encoding:
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 15
Asynchronous Transmission (2)
I Physical layer can provide characters (n-bit
units) to Data Link layer
n bits n bits n bits idle idle
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 16
Asynchronous Transmission (3)
I Advantages
G Simple timing mechanism G Inherent character framing G Adapts to different data rates (idle serves as fill)
I Disadvantages
G Timing errors can occur if line is noisy
(e.g., missed start bit)
G Overhead for stop and start bits
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 17
Synchronous Transmission (1)
I Used for high data rates, including T1 and or
interoffice digital transmission lines
I Information is sent continuously
G Receiver & repeater maintain synchronization
between incoming signaling rate and local sample clock
G Idle or fill characters inserted if line is idle
I Signal transitions (high-to-low or
positive-to-negative) enable clock recovery, or synchronization
G Some minimum occurrence of signal transitions are
needed to maintain synchronization (Why?)
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 18
Why Frequent Signal Transitions Needed
I Long strings of 0’s or 1’s cause problems.
G Receiver synchronizes clock on 0-1 transitions.
No transitions = no synchronization
G Receiver averages signal it receives to determine hi
- vs. low signal.
No transitions = incorrect average.
G NRZ encoding is bad.
I Solutions…
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 19
Solutions: Ensuring Signal Transitions
I Manchester encoding:
G Sender XOrs local clock w/ NRZ encoded data,
producing hi/low transitions for every bit
G But doubles rate at which signal is transmitted
I Dedicated timing bits
G Use some bit transmissions just for timing G Example: Dataphone Digital Service
N Use every one bit out of eight to guarantee a
signal transition
G Example: Synchronous modems
N Periodically insert a SYNC character
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 20
Ensuring Signal Transitions (2)
I Bit insertion
G Use bit transmissions for timing only when needed
by inserting timing bits into data bit stream
G HDLC “bit stuffing”
N 01111110 indicates end of a data block (for
framing)
N Six consecutive 1’s must not be sent as data (may
be mistaken as end of a data block)
N Sender inserts a 0 after every string of five
consecutive 1’s; receiver must strip a 0 after five consecutive 1’s
G Disadvantage: extra bits = extra delay
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 21
Ensuring Signal Transitions (3)
I Data scrambling
G Similar to encryption/decryption G Prevents transmission of repetitive patterns G With high probability, prevents long strings of 0’s (or
1’s) that would not have signal transitions
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 22
Module at Node A Module at Node B “Link”
Point-to-Point Protocols and Links (1)
I Point-to-point protocols involve exactly two
peer entities or modules that are connected by some “link”
I Modules must interact to ensure proper transfer
- f information using link
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 23
Point-to-Point Protocols and Links (2)
I For example, link may be:
G Physical link (e.g. RS-232 is a point-to-point
protocol)
G Virtual bit pipe (e.g. at data link layer) G A connection or virtual connection (e.g. at transport
- r session layer)
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 24
Data Link Control -- DLC (1)
I For each point-to-point link in a network re are
two data link control (DLC) peer modules, one at each end
I DLC modules use a distributed algorithm to
transfer packets
G Received from and delivered network layer
I Usual objective is to deliver packets in order of
arrival (from network layer) without errors or repeated packets
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 25
Network DLC Physical Network DLC Physical
Data Link Control -- DLC (2)
I DLC modules must use unreliable “virtual bit
pipe” provided by physical layer
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 26
Data Link Control -- DLC (3)
I DLC must:
G Detect errors (using redundancy bits) G Request retransmission if data is lost (using
automatic repeat request -- ARQ)
G Perform framing (detect packet start and end) G Support initialization and disconnection operations
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 27
service data unit header trailer frame
Data Link Control -- DLC (4)
I These functions require that extra bits be added
to packet to be transmitted
G Header bits are added to front of each each packet G Trailer bits are added to rear of each packet G
header, packet from upper layer (service data unit), and trailer form a frame
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 28
2.3 Framing
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 29
service data unit header trailer frame
Frame Format
I Packet from upper layer is Service data unit
(SDU)
I Frame (header, network layer packet, and
trailer) is protocol data unit (PDU)
I Note that DLC does not care what is in network
layer packet and physical layer does not care what is in frame generated by data link layer
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 30
Framing (1)
I We have assumed that DLC knows where a
frame begins and ends
I This is not automatic due to …
G Continuous transmission of one frame after another G Idle fill characters in synchronous bit pipes G No transmission in asynchronous bit pipes
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 31
Framing (2)
I Framing is process of deciding start and end of
successive frames
G Byte-oriented or character-based framing G Bit-oriented framing -- flags G Length fields G Clock based framing
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 32
Character-Based Framing (1)
I Special characters are used to indicate idle fill
(ASCII SYN), start of text (STX), and end of text (ETX)
G SYN = 0001 0110
(16H)
G STX = 0000 0010
(02H)
I Data Link layer extracts frame boundaries
SYN SYN STX header packet ETX CRC SYN frame 00010110 00010110 00000010 ...
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 33
Character-Based Framing (2)
I If packet data is arbitrary it may contain control
characters, so transparent mode must be used based on DLE (data link escape) character
G DLE STX is start of transparent mode G DLE ETX ends text G DLE DLE needed if DLE is in packet data
I Problems:
G Excessive framing overhead G Error may cause premature ETX detection G Error may alter ETX so that end of frame is missed
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 34
Bit-Oriented Framing -- Flags (1)
I Character-based framing:
G Use full characters as “flags” G DLE STX and DLE ETX
I Bit-oriented framing:
G Use bit patterns as flags to reduce overhead of
character-based framing
G 01111110 = 0160 is usual flag –
six consecutive 1’s indicates end of frame to receiving DLC
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 35
Problem with 01111110 Flag
I So if we use 01111110 as flag… I … and the actual data contains 01111110…
What do we do?
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 36
Bit-Oriented Framing -- Flags (2)
I Sender uses bit stuffing to eliminate any string
- f six 1’s in data.
I Receiver strips off stuffed bits
G Sender inserts 0 after five consecutive 1’s in data G Example (one 0 is inserted):
N Original frame: 00111001111111011 N Transmitted:
001110011111011011
G Receiver strips off one 0 after five consecutive 1’s
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 37
Framing with Length Fields (1)
I There are two aspects to framing:
G Detecting end of idle fill -- can be done by
transmitting a special character (e.g. SYN) or a constant bit stream (e.g. all 1’s) that is interrupted when frame begins
G Detecting end of frame -- can be done by sending
length information (e.g. number of bytes in frame) in header SYN SYN length packet CRC SYN frame header
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 38
Framing with Length Fields (2)
I Brute force:
Need log2 Kmax bits for frame size Kmax
I More efficient encodings:
G If only certain frame sizes possible, fewer bits needed
N Ex: just 2 bits if all packets are of length a, b, c, or d
G If some lengths more likely than others, assign most likely
lengths shorter codes
I But brute force = faster, simpler implementations
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 39
Framing with Length Fields (3)
I Errors can corrupt length field, causing receiver
to look for CRC in wrong place!
G Frame accepted with probability 2-L
(L is length of CRC)
G If length field's corrupted,
how do you find start of next frame?
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 40
Framing with Length Fields (3)
I Possible (partial) solutions:
G Use extra CRC over a fixed length header, but
synchronization is still needed
G Embed length field in trailer of previous frame G Use a longer CRC to reduce probability of
acceptance
G Use fixed-length frames and pass job off to
a higher layer
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 41
Some Choices…
I Should frames be
G Large or small? G Fixed size or variable size?
I What are the pros/cons?
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 42
Maximum Frame Size (1)
I Large maximum frame size is good…
G Reduces transmission overhead for framing and
header information (not critical for high data rates)
G Reduces frame processing load (important for high
data rates)
I Short maximum frame size is good…
G Can reduce delay variance and packetization delay
(Think of trucks vs. cars on I81)
G Allows pipelining over multiple links to reduce
delay…
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 43
Maximum Frame Size (2)
D (short frames) D (long frames) Link 1 Link 3 Link 2 Pipelining over multiple links
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 44
Fixed Frame Lengths
I Could require all frames to be same length I Don't need bits for length field or framing flags.
G Do need padding if a packet doesn't completely fill
frame.
I Small fixed length frames…
G Reduces need for padding G Reduce latency for stream data, e.g. packetized voice
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 45
Example of Fixed Frame Lengths
I Asynchronous Transfer Mode (ATM)
G Frames (called cells) are fixed at 53 bytes
N 48-byte data field plus 5-byte header
G Simplifies high-speed switching G Supports voice and video that demand low latency G Reduces variance in delay
CS/ECPE 5516 (1/31/00) Direct Link Networks: 2.1, 2.2, 2.3 - 46