Title: Chapter 2 Physical
1Chapter 2Physical Data-Link Layers
- Professor Rick Han
- University of Colorado at Boulder
- rhan_at_cs.colorado.edu
2Announcements
- Textbooks Computer Networks, by Peterson and
Davie - CU book stores order has arrived
- Read Chapter 1, start Chapter 2, sections
2.1-2.8, skip Section 2.9 Network Adaptors - Larger classroom maybe
- Lectures will be online a few days after each
class - Follow the Lectures link on class Web site
- Homework 1 will be handed out next class
- Next, Chapter 2
3The Layered Network Stack
Internet Stack
Application Layer
Transport Layer (TCP/UDP)
Network Layer (IP)
Data Link Layer
Physical Layer
4Layer 1 The Physical Layer
- Host A encodes the bit into an analog signal.
Host B decodes the analog signal into a received
bit.
5Encoding Mapping Bits to Analog Waveforms
- 1 -gt 5 volts, 0 -gt -5 volts on copper wire
- light intensity on optical fiber
- Pulse Amplitude Modulation (PAM) encodes bits as
diff. levels. NRZ is special case. - Manchester encodes bits as diff. transitions
- FSK (Frequency Shift Key) encodes bits as diff.
frequencies. 1200 bps modems.
6Sending More Bits Per Second
- Can reduce the size of time slot
- Widely used
- Limitation smearing of the waveforms and noise
limit the maximum bit rate (Shannons capacity
theorem)
- Square wave is sum of many different frequency
components. analogy stereo signal - High frequencies get attenuated in wire, thereby
smearing the waveform - Reducing time slots causes more smear from
previous slot to interfere with current slot
InterSymbol Interference (ISI)
7Sending More Bits Per Second (2)
- Can send more bits per time slot using
multi-level D/A converter - 8 discrete levels
- 111 -gt 7 V, , 000 -gt -7 V
- 100110 -gt 1, 5,
Symbols
8Sending More Bits Per Second (3)
- Transmit a sequence of symbols S11, S25, S3,
- Baud rate Symbols/sec
- If baud rate is 1 symbol/sec, then bit rate 3
bits/sec - Tripled the bit rate!
- Limitations noise
- Datam(t)Sm(t)SqWv(t-mT)
- Where Sm(t) is the level of mth symbol, T
duration of each symbol, ttime, SqWv is square
wave
9Sending More Bits Per Second (4)
- Can send more bits over different frequencies,
analogy AM/FM - Modulate Sm(t) up to 3000 Hz, demodulate down
- Datam(t) Sm(t)cos(2p3000t) Sm(t)cos
(2p6000t) simplified sq wave not
shown - Can send more bits over the same frequency!
- Datam(t) Sm(t)cos(2p3000t) Sm(t)sin
(2p3000t) - This is called Quadrature Amplitude Modulation
(QAM). - If Sm(t), and Sm(t) both have 4 levels, then
this is called 16-QAM. 9600 bps modems use this.
Baud?
10Physical Layer Effects
- Goal maximize the Signal-to-Noise ratio (SNR) to
minimize the probability of bit error, then pass
the bit up to Data-Link Layer - Unreliability
- due toSmearing, Interference, (Wireless
shadowing, multi-path, doppler, ) - Apply advanced adaptive filtering and digital
signal processing (DSP) to improve SNR - Propagation Delay
- Speed of light c 3x108 m/s
- Over copper wires, propagation speed is 2/3 of c
- Satellite links have long prop. delays (120 ms
one-way) - Interactivity requires lt400 ms roundtrip
11Layer 2 The Data Link Layer
- Next Problem How do I send a message from Host A
to Host B?
- Data Link Layer, also called Layer 2, ensures
that host B can decode a digital message from a
stream of bits sent by host A - Examples PPP (Point-to-Point Protocol), HDLC,
LAPB, LAPD, Frame Relay,
12The Data Link Layer (cont.)
- A Data Link Layer Protocol implements
- Delimiting/framing of a message
- Fragmenting of a long message
- Retransmission of a lost message
1011000
Host A
Host B
13Defining a Protocol
- A protocol is an agreement between two parties or
endpoints as to how information is to be
transmitted - A protocol implements this agreement via
- A Header
- How each endpoint responds to control info in the
header ( external input)
Host A
Host B
14Framing
Receivers A/D
15Character/Byte Stuffing
- BiSync and PPP (common over modems)
- Data is divided into 8-bit bytes
- Byte boundaries synchronized btwn sender and
receiver - Define a special start-of-packet N-byte flag,
e.g. let flag be X (one byte flag) - Stuff X in data replace X with escape character
E (DLE in textbook) and X, i.e X -gt (E, X) - Stuff E in data replace E with (E, E)
- At rcvr, first X is start of packet (variants
exist)
16Bit Stuffing
01001000001111110000001110001001
- HDLC uses this
- Similar to byte stuffing, except bit stuffing is
not confined to byte boundaries - HDLC denotes beginning and end of a packet/frame
with 01111110 flag - Since 01111110 may occur anywhere (across byte
boundaries) in data, stuff it - At sender, after 5 consecutive ones, insert a 0
- At receiver, 0111110 gt stuffing, so destuff,
01111110 gt end of frame, 01111111 gt error
17Byte Counting
- Deduce End-of-Packet with a length field in the
header, rather than explicit sentinel flag - 010010000000000100000011100010010
- Start-of-Packet length data
- Length 2 bytes
- Limitation the length field could be corrupted
by a transmission bit error, due to noise, etc. - Bit corruption in header and start-of-packet
usually catastrophic - Bit corruption can also occur in data
- How do we handle errors caused by bit corruption?
18Error Detection
- Simple technique Send two copies of data in
addition to the data, and then do majority logic
decoding at the receiver
Original data 0100
Corrupt Bit
Send 0100 0100 0100
Receiver 0100 0110
0100 Decode 0100
- Inefficient
- Two errors in the same bit gt cannot detect
error, - 0100 0110 0110 -gt 0110 Error
- so each technique has some probability of error
19Error Detection (2)
- General technique Add redundancy to the data and
use this redundancy to detect bit errors - 01001000000000010011010100000011100010010
- Start-of-Packet length err. det.
data - The error detection field can be computed over
the data only, the header only (IP) or both (TCP) - Can be located in header or at end of packet
- The error detection field is also called a Cyclic
Redundancy Check (CRC) - Most link-layer protocols use CRCs for error
detection, e.g. HDLC, PPP - A checksum is a special case of a CRC where the
CRC is computed using binary addition
20Error Detection (3)
- The Internet checksum
- Divide your data into 16-bit segments
- Add each of the 16-bit segments, using ones
complement binary addition - Ones complement of the final sum is your 16-bit
IP checksum - Send IP checksum with the IP packet
- An alternative checksum XOR instead of ones
complement - Checksums are relatively weak compared to CRCs
but are easy to compute - A bit error twice in the same offset position
within the 16-bit segment will go undetected
21Probability of Packet Error
- Suppose N bits are sent, and the link is
independently corrupting each bit with some
probability of bit error pb. What is the
probability of packet error? - Probpacket error Probat least 1 bit is
corrupt - 1
Probevery bit is clean - 1-(1- pb)N
- If pb 10-6, and N10000 bits, then
- Probpacket error 9.9510-3 1
- Optical links have much lower probabilities of
bit error 1012 - Wireless links have much higher probabilities of
bit error 10-3 in fades send small packets
22Error Correction
- Forward Error Correction (FEC)
- Rather than just detect a bit error, correct a
bit error - Add K bits of redundancy to N bits, to form a
(NK)-bit long packet, or vector
- N dimensions -gt NK dimensions
- 2N patterns or vectors mapped into 2NK
possibilities - Spread out these vectors as far away from
neighbors as possible in (NK)-dimensional space - N2, K3, NK5
- Receive 01111 - closest
- to 11111, so decode 11
- and correct one bit error