SlideShare a Scribd company logo
1 of 46
15-441 Computer Networking
Lecture 4 - Physical Layer, Link
Layer Basics, Switching
Lecture 4: 9-6-01 2
Links
• How to make computers talk across a wire
• How to share the wire
Lecture 4: 9-6-01 3
From Signals to Packets
Analog Signal
“Digital” Signal
Bit Stream 0 0 1 0 1 1 1 0 0 0 1
Packets
0100010101011100101010101011101110000001111010101110101010101101011010111001
Header/Body Header/Body Header/Body
Receiver
Sender
Packet
Transmission
Lecture 4: 9-6-01 4
Link Layer: Implementation
• Implemented in “adapter”
• E.g., PCMCIA card, Ethernet card
• Typically includes: RAM, DSP chips, host bus interface, and link
interface
application
transport
network
link
physical
network
link
physical
M
M
M
M
Ht
Ht
Hn
Ht
Hn
Hl M
Ht
Hn
Hl
frame
phys. link
data link
protocol
adapter card
Lecture 4: 9-6-01 5
Outline
• Physical media is analog
• Modulation – signals to bits
• Bit stream vs. packets
• Framing – how to make packets
• Corruption
• Error detection & recovery
• Sharing
• Media access
Lecture 4: 9-6-01 6
Modulation
• Sender changes the nature of the signal in a way
that the receiver can recognize.
• Similar to radio: AM or FM
• Digital transmission: encodes the values 0 or 1 in
the signal.
• It is also possible to encode multi-valued symbols
• Amplitude modulation: change the strength of the
signal, typically between on and off.
• Sender and receiver agree on a “rate”
• On means 1, Off means 0
• Similar: frequency or phase modulation.
• Can also combine method modulation types.
Lecture 4: 9-6-01 7
Amplitude and Frequency
Modulation
0 0 1 1 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 0 1 1 1 0
0 1 1 0 1 1 0 0 0 1
Lecture 4: 9-6-01 8
Modulation
• Non-Return to Zero (NRZ)
• Used by Synchronous Optical Network
(SONET)
• 1=high signal, 0=low signal
• Long sequence of same bit cause difficulty
• DC bias hard to detect – low and high detected by
difference from average voltage
• Clock recovery difficult
Lecture 4: 9-6-01 9
Clock Recovery
• When to sample voltage?
• Synchronized sender and receiver clocks
• Need easily detectible event at both ends
• Signal transitions help resync sender and
receiver
• Need frequent transitions to prevent clock skew
• SONET XOR’s bit sequence to ensure frequent
transitions
Lecture 4: 9-6-01 10
Modulation
• Non-Return to Zero Inverted (NRZI)
• 1=inversion of current value, 0=same value
• No problem with string of 1’s
• NRZ-like problem with string of 0’s
Lecture 4: 9-6-01 11
Modulation
• Manchester
• Used by Ethernet
• 0=low to high transition, 1=high to low transition
• Transition for every bit simplifies clock recovery
• Not very efficient
• Doubles the number of transitions
• Circuitry must run twice as fast
Lecture 4: 9-6-01 12
CORRECTION
• Sept 17: Please note the following correction to
Manchester encoding. While the book and state
that Ethernet uses 0 = first half low and second
half high signal, and 1 = first high then low, this is
incorrect. The 802.3 specs state that Ethernet
encodes 0 as first half clock cycle = high, second
half = low and that 1 is the opposite. The basic
concept/tradeoffs remain the same. We will accept
either on the homework.
Lecture 4: 9-6-01 13
Modulation
• 4b/5b
• Used by FDDI
• Uses 5bits to encode every 4bits
• Encoding ensures no more than 3 consecutive
0’s
• Uses NRZI to encode resulting sequence
• 16 data values, 3 “special” illegal values, 6
“extra” values, 7 illegal values
Lecture 4: 9-6-01 14
Outline
• Physical media is analog
• Modulation – signals to bits
• Bit stream vs. packets
• Framing – how to make packets
• Corruption
• Error detection & recovery
• Sharing
• Media access
Lecture 4: 9-6-01 15
Framing
• Length delimited
• Beginning of frame has length
• Single corrupt length can cause problems
• Must have start of frame character to resynchronize
• Resynchronization can fail if start of frame character
is inside packets as well
Lecture 4: 9-6-01 16
Framing
• Byte stuffing
• Special start of frame byte (e.g. 0xFF)
• Special escape byte value (e.g. 0xFE)
• Values actually in text are replaced (e.g. 0xFF
by 0xFEFF and 0xFE by 0xFEFE)
• Worst case – can double the size of frame
• Bit stuffing
• Special bit sequence (0x01111110)
• 0 bit stuffed after any 11111 sequence
Lecture 4: 9-6-01 17
Clock-Based Framing
• Used by SONET
• Fixed size frames (810 bytes)
• Look for start of frame marker that appears
every 810 bytes
• Will eventually sync up
Lecture 4: 9-6-01 18
Consistent Overhead Byte
Stuffing
• Run length encoding applied to byte stuffing
• Encoding
• Add implied 0 to end of frame
• Each 0 is replaced with (number of bytes to
next 0) + 1
• What if no 0 within 255 bytes? – 255 value
indicates 254 bytes followed by no zero
• Worst case – no 0’s in packet – 1/254 overhead
• Possible optimization to encode series of 0’s
Lecture 4: 9-6-01 19
Outline
• Physical media is analog
• Modulation – signals to bits
• Bit stream vs. packets
• Framing – how to make packets
• Corruption
• Error detection & recovery
• Sharing
• Media access
Lecture 4: 9-6-01 20
Error Detection
• EDC= Error Detection and Correction bits (redundancy)
• D = Data protected by error checking, may include header fields
• Error detection not 100% reliable!
• Protocol may miss some errors, but rarely
• Larger EDC field yields better detection and correction
Lecture 4: 9-6-01 21
Parity Checking
Single Bit Parity:
Detect single bit errors
Lecture 4: 9-6-01 22
Error Detection - Checksum
• Used by TCP, UDP, IP, etc..
• Ones complement sum of all
words/shorts/bytes in packet
• Simple to implement
• Relatively weak detection
• Easily tricked by typical loss patterns
Lecture 4: 9-6-01 23
Internet Checksum
Sender
• Treat segment contents
as sequence of 16-bit
integers
• Checksum: addition (1’s
complement sum) of
segment contents
• Sender puts checksum
value into checksum field
in header
Receiver
• Compute checksum of
received segment
• Check if computed
checksum equals
checksum field value:
• NO - error detected
• YES - no error
detected. But maybe
errors nonethless?
• Goal: detect “errors” (e.g., flipped bits) in transmitted
segment
Lecture 4: 9-6-01 24
Error Detection – Cyclic
Redundancy Check (CRC)
• Polynomial code
• Treat packet bits a coefficients of n-bit
polynomial
• Choose r+1 bit generator polynomial (well
known – chosen in advance)
• Add r bits to packet such that message is
divisible by generator polynomial
• Better loss detection properties than
checksums
Lecture 4: 9-6-01 25
Error Detection – CRC
• View data bits, D, as a binary number
• Choose r+1 bit pattern (generator), G
• Goal: choose r CRC bits, R, such that
• <D,R> exactly divisible by G (modulo 2)
• Receiver knows G, divides <D,R> by G. If non-zero remainder:
error detected!
• Can detect all burst errors less than r+1 bits
• Widely used in practice (ATM, HDCL)
Lecture 4: 9-6-01 26
CRC Example
Want:
D.2r XOR R = nG
equivalently:
D.2r = nG XOR R
equivalently:
if we divide D.2r by G,
want reminder Rb
R = remainder[ ]
D.2r
G
Lecture 4: 9-6-01 27
Error Recovery
• Two forms of error recovery
• Error Correcting Codes (ECC)
• Automatic Repeat Request (ARQ)
• ECC
• Send extra redundant data to help repair losses
• ARQ
• Receiver sends acknowledgement (ACK) when
it receives packet
• Sender uses ACKs to identify and resend data
that was lost
Lecture 4: 9-6-01 28
Error Recovery – Error
Correcting Codes (ECC)
Two Dimensional Bit Parity:
Detect and correct single bit errors
0 0
Lecture 4: 9-6-01 29
Stop and Wait
Time
Timeout
• Simplest ARQ
protocol
• Send a packet,
stop and wait until
acknowledgement
arrives
• Will examine ARQ
issues later in
semester
Sender Receiver
Lecture 4: 9-6-01 30
Recovering from Error
Timeout
Timeout
Time
Timeout
Packet lost
Timeout
Early timeout
Timeout
Timeout
ACK lost
Lecture 4: 9-6-01 31
Outline
• Physical media is analog
• Modulation – signals to bits
• Bit stream vs. packets
• Framing – how to make packets
• Corruption
• Error detection & recovery
• Sharing
• Media access
Lecture 4: 9-6-01 32
Multiple Access Protocols
• Single shared communication channel
• Two or more simultaneous transmissions  interference
• Only one node can send successfully at a time
• Multiple access protocol:
• Distributed algorithm that determines how stations share channel,
i.e., determine when station can transmit
• Communication about channel sharing must use channel itself!
• What to look for in multiple access protocols:
• Synchronous or asynchronous
• Information needed about other stations
• Robustness (e.g., to channel errors)
• Performance
Lecture 4: 9-6-01 33
MAC Protocols: A Taxonomy
Three broad classes:
• Channel partitioning
• Divide channel into smaller “pieces” (time slots,
frequency)
• Allocate piece to node for exclusive use
• Random access
• Allow collisions
• “Recover” from collisions
• “Taking turns”
• Tightly coordinate shared access to avoid collisions
Goal: efficient, fair, simple, decentralized
Lecture 4: 9-6-01 34
Channel Partitioning MAC
Protocols: TDMA
TDMA: time division multiple access
• Access to channel in "rounds"
• Each station gets fixed length slot (length = pkt trans
time) in each round
• Unused slots go idle
• Example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6
idle
Lecture 4: 9-6-01 35
Baseband vs Carrier Modulation
• Baseband modulation: send the “bare” signal.
• Carrier modulation: use the signal to modulate a
higher frequency signal (carrier).
• Can be viewed as the product of the two signals
• Corresponds to a shift in the frequency domain
• Some idea applies to frequency and phase
modulation.
• E.g. change frequency of the carrier instead of its
amplitude
Lecture 4: 9-6-01 36
Amplitude Carrier Modulation
Amplitude
Signal Carrier
Frequency
Amplitude
Modulated
Carrier
Lecture 4: 9-6-01 37
Frequency Division Multiplexing:
Multiple Channels
Amplitude
Different Carrier
Frequencies
Determines
Bandwidth
of Channel
Determines Bandwidth of Link
Lecture 4: 9-6-01 38
Channel Partitioning MAC
Protocols: FDMA
FDMA: frequency division multiple access
• Channel spectrum divided into frequency bands
• Each station assigned fixed frequency band
• Unused transmission time in frequency bands go idle
• Example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle
frequency
bands
Lecture 4: 9-6-01 39
Channel Partitioning (CDMA)
CDMA (Code Division Multiple Access)
• Unique “code” assigned to each user; i.e., code set
partitioning
• Used mostly in wireless broadcast channels (cellular,
satellite,etc)
• All users share same frequency, but each user has own
“chipping” sequence (i.e., code) to encode data
• Encoded signal = (original data) X (chipping sequence)
• Decoding: inner-product of encoded signal and chipping
sequence
• Allows multiple users to “coexist” and transmit
simultaneously with minimal interference (if codes are
“orthogonal”)
Lecture 4: 9-6-01 40
CDMA Encode/Decode
Lecture 4: 9-6-01 41
CDMA: Two-sender Interference
Lecture 4: 9-6-01 42
Random Access Protocols
• When node has packet to send
• Transmit at full channel data rate R.
• No a priori coordination among nodes
• Two or more transmitting nodes  “collision”,
• Random access MAC protocol specifies:
• How to detect collisions
• How to recover from collisions (e.g., via delayed
retransmissions)
• Examples of random access MAC protocols:
• Slotted ALOHA
• ALOHA
• CSMA and CSMA/CD
Lecture 4: 9-6-01 43
Slotted Aloha
• Time is divided into equal size slots (= pkt trans.
time)
• Node with new arriving pkt: transmit at
beginning of next slot
• If collision: retransmit pkt in future slots with
probability p, until successful.
Success (S), Collision (C), Empty (E) slots
Lecture 4: 9-6-01 44
Pure (unslotted) ALOHA
• Unslotted Aloha: simpler, no synchronization
• Packet needs transmission:
• Send without awaiting for beginning of slot
• Collision probability increases:
• Packet sent at t0 collide with other pkts sent in [t0-
1, t0+1]
Lecture 4: 9-6-01 45
“Taking Turns” MAC protocols
• Channel partitioning MAC protocols:
• Share channel efficiently at high load
• Inefficient at low load: delay in channel access, 1/N
bandwidth allocated even if only 1 active node!
• Random access MAC protocols
• Efficient at low load: single node can fully utilize
channel
• High load: collision overhead
• “Taking turns” protocols
• Look for best of both worlds!
Lecture 4: 9-6-01 46
“Taking Turns” MAC Protocols
Polling
• Master node “invites”
slave nodes to transmit
in turn
• Request to Send, Clear
to Send msgs
• Concerns:
• Polling overhead
• Latency
• Single point of failure
(master)
Token passing
• Control token passed
from one node to next
sequentially
• Concerns:
• Token overhead
• Latency
• Single point of failure
(token)

More Related Content

Similar to lecture04.ppt

New framing-protocols
New framing-protocolsNew framing-protocols
New framing-protocols
Nitesh Singh
 
Ethernet Data link layer Local area network
Ethernet Data link layer Local area networkEthernet Data link layer Local area network
Ethernet Data link layer Local area network
RiteshKumar630578
 

Similar to lecture04.ppt (20)

CAN Bus
CAN BusCAN Bus
CAN Bus
 
Dc ch07 : error control and data link control
Dc ch07 : error control and data link controlDc ch07 : error control and data link control
Dc ch07 : error control and data link control
 
New framing-protocols
New framing-protocolsNew framing-protocols
New framing-protocols
 
Ethernet Data link layer Local area network
Ethernet Data link layer Local area networkEthernet Data link layer Local area network
Ethernet Data link layer Local area network
 
Networking concepts
Networking conceptsNetworking concepts
Networking concepts
 
unit2-210710110327.pptx
unit2-210710110327.pptxunit2-210710110327.pptx
unit2-210710110327.pptx
 
CS553_ST7_Ch06-DigitalDataComm.ppt
CS553_ST7_Ch06-DigitalDataComm.pptCS553_ST7_Ch06-DigitalDataComm.ppt
CS553_ST7_Ch06-DigitalDataComm.ppt
 
Ntdd
NtddNtdd
Ntdd
 
Ntdd
NtddNtdd
Ntdd
 
Ieee 802 standard
Ieee 802 standardIeee 802 standard
Ieee 802 standard
 
ETHERNET IEEE802.pptx
ETHERNET IEEE802.pptxETHERNET IEEE802.pptx
ETHERNET IEEE802.pptx
 
Fddi
FddiFddi
Fddi
 
can bus theory solution
can bus theory solutioncan bus theory solution
can bus theory solution
 
Chapter-10.pptx
Chapter-10.pptxChapter-10.pptx
Chapter-10.pptx
 
Data Communication & Computer Networks : Serial and parellel transmission
Data Communication & Computer Networks : Serial and parellel transmissionData Communication & Computer Networks : Serial and parellel transmission
Data Communication & Computer Networks : Serial and parellel transmission
 
TCP-IP PROTOCOL
TCP-IP PROTOCOLTCP-IP PROTOCOL
TCP-IP PROTOCOL
 
Mediumaccesscontrol
MediumaccesscontrolMediumaccesscontrol
Mediumaccesscontrol
 
DS Unit-4-Communication .pdf
DS Unit-4-Communication .pdfDS Unit-4-Communication .pdf
DS Unit-4-Communication .pdf
 
Transport Layer In Computer Network
Transport Layer In Computer NetworkTransport Layer In Computer Network
Transport Layer In Computer Network
 
link-medium-access-control.pptx
link-medium-access-control.pptxlink-medium-access-control.pptx
link-medium-access-control.pptx
 

More from AmanuelZewdie4 (10)

Chapter 7 - Wireless Network Security.pptx
Chapter 7 - Wireless Network Security.pptxChapter 7 - Wireless Network Security.pptx
Chapter 7 - Wireless Network Security.pptx
 
Chapter-7.pptx
Chapter-7.pptxChapter-7.pptx
Chapter-7.pptx
 
Chapter 3- Intrusion Detection.pdf
Chapter 3- Intrusion Detection.pdfChapter 3- Intrusion Detection.pdf
Chapter 3- Intrusion Detection.pdf
 
Chapter 7 Other Emerging Technologies.pptx
Chapter 7  Other Emerging Technologies.pptxChapter 7  Other Emerging Technologies.pptx
Chapter 7 Other Emerging Technologies.pptx
 
Chapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptChapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.ppt
 
Chapter 3 Telecom Sys.pptx
Chapter 3  Telecom Sys.pptxChapter 3  Telecom Sys.pptx
Chapter 3 Telecom Sys.pptx
 
Chapter 3 Software.ppt
Chapter 3 Software.pptChapter 3 Software.ppt
Chapter 3 Software.ppt
 
chapter 6 Ethics and Professionalism of ET.pptx
chapter 6   Ethics and Professionalism of ET.pptxchapter 6   Ethics and Professionalism of ET.pptx
chapter 6 Ethics and Professionalism of ET.pptx
 
Chapter 5 - Augmented Reality.pptx
Chapter 5 - Augmented Reality.pptxChapter 5 - Augmented Reality.pptx
Chapter 5 - Augmented Reality.pptx
 
chapter 6 Satellite Systems.pptx
chapter 6 Satellite Systems.pptxchapter 6 Satellite Systems.pptx
chapter 6 Satellite Systems.pptx
 

Recently uploaded

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 

lecture04.ppt

  • 1. 15-441 Computer Networking Lecture 4 - Physical Layer, Link Layer Basics, Switching
  • 2. Lecture 4: 9-6-01 2 Links • How to make computers talk across a wire • How to share the wire
  • 3. Lecture 4: 9-6-01 3 From Signals to Packets Analog Signal “Digital” Signal Bit Stream 0 0 1 0 1 1 1 0 0 0 1 Packets 0100010101011100101010101011101110000001111010101110101010101101011010111001 Header/Body Header/Body Header/Body Receiver Sender Packet Transmission
  • 4. Lecture 4: 9-6-01 4 Link Layer: Implementation • Implemented in “adapter” • E.g., PCMCIA card, Ethernet card • Typically includes: RAM, DSP chips, host bus interface, and link interface application transport network link physical network link physical M M M M Ht Ht Hn Ht Hn Hl M Ht Hn Hl frame phys. link data link protocol adapter card
  • 5. Lecture 4: 9-6-01 5 Outline • Physical media is analog • Modulation – signals to bits • Bit stream vs. packets • Framing – how to make packets • Corruption • Error detection & recovery • Sharing • Media access
  • 6. Lecture 4: 9-6-01 6 Modulation • Sender changes the nature of the signal in a way that the receiver can recognize. • Similar to radio: AM or FM • Digital transmission: encodes the values 0 or 1 in the signal. • It is also possible to encode multi-valued symbols • Amplitude modulation: change the strength of the signal, typically between on and off. • Sender and receiver agree on a “rate” • On means 1, Off means 0 • Similar: frequency or phase modulation. • Can also combine method modulation types.
  • 7. Lecture 4: 9-6-01 7 Amplitude and Frequency Modulation 0 0 1 1 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 0 0 1
  • 8. Lecture 4: 9-6-01 8 Modulation • Non-Return to Zero (NRZ) • Used by Synchronous Optical Network (SONET) • 1=high signal, 0=low signal • Long sequence of same bit cause difficulty • DC bias hard to detect – low and high detected by difference from average voltage • Clock recovery difficult
  • 9. Lecture 4: 9-6-01 9 Clock Recovery • When to sample voltage? • Synchronized sender and receiver clocks • Need easily detectible event at both ends • Signal transitions help resync sender and receiver • Need frequent transitions to prevent clock skew • SONET XOR’s bit sequence to ensure frequent transitions
  • 10. Lecture 4: 9-6-01 10 Modulation • Non-Return to Zero Inverted (NRZI) • 1=inversion of current value, 0=same value • No problem with string of 1’s • NRZ-like problem with string of 0’s
  • 11. Lecture 4: 9-6-01 11 Modulation • Manchester • Used by Ethernet • 0=low to high transition, 1=high to low transition • Transition for every bit simplifies clock recovery • Not very efficient • Doubles the number of transitions • Circuitry must run twice as fast
  • 12. Lecture 4: 9-6-01 12 CORRECTION • Sept 17: Please note the following correction to Manchester encoding. While the book and state that Ethernet uses 0 = first half low and second half high signal, and 1 = first high then low, this is incorrect. The 802.3 specs state that Ethernet encodes 0 as first half clock cycle = high, second half = low and that 1 is the opposite. The basic concept/tradeoffs remain the same. We will accept either on the homework.
  • 13. Lecture 4: 9-6-01 13 Modulation • 4b/5b • Used by FDDI • Uses 5bits to encode every 4bits • Encoding ensures no more than 3 consecutive 0’s • Uses NRZI to encode resulting sequence • 16 data values, 3 “special” illegal values, 6 “extra” values, 7 illegal values
  • 14. Lecture 4: 9-6-01 14 Outline • Physical media is analog • Modulation – signals to bits • Bit stream vs. packets • Framing – how to make packets • Corruption • Error detection & recovery • Sharing • Media access
  • 15. Lecture 4: 9-6-01 15 Framing • Length delimited • Beginning of frame has length • Single corrupt length can cause problems • Must have start of frame character to resynchronize • Resynchronization can fail if start of frame character is inside packets as well
  • 16. Lecture 4: 9-6-01 16 Framing • Byte stuffing • Special start of frame byte (e.g. 0xFF) • Special escape byte value (e.g. 0xFE) • Values actually in text are replaced (e.g. 0xFF by 0xFEFF and 0xFE by 0xFEFE) • Worst case – can double the size of frame • Bit stuffing • Special bit sequence (0x01111110) • 0 bit stuffed after any 11111 sequence
  • 17. Lecture 4: 9-6-01 17 Clock-Based Framing • Used by SONET • Fixed size frames (810 bytes) • Look for start of frame marker that appears every 810 bytes • Will eventually sync up
  • 18. Lecture 4: 9-6-01 18 Consistent Overhead Byte Stuffing • Run length encoding applied to byte stuffing • Encoding • Add implied 0 to end of frame • Each 0 is replaced with (number of bytes to next 0) + 1 • What if no 0 within 255 bytes? – 255 value indicates 254 bytes followed by no zero • Worst case – no 0’s in packet – 1/254 overhead • Possible optimization to encode series of 0’s
  • 19. Lecture 4: 9-6-01 19 Outline • Physical media is analog • Modulation – signals to bits • Bit stream vs. packets • Framing – how to make packets • Corruption • Error detection & recovery • Sharing • Media access
  • 20. Lecture 4: 9-6-01 20 Error Detection • EDC= Error Detection and Correction bits (redundancy) • D = Data protected by error checking, may include header fields • Error detection not 100% reliable! • Protocol may miss some errors, but rarely • Larger EDC field yields better detection and correction
  • 21. Lecture 4: 9-6-01 21 Parity Checking Single Bit Parity: Detect single bit errors
  • 22. Lecture 4: 9-6-01 22 Error Detection - Checksum • Used by TCP, UDP, IP, etc.. • Ones complement sum of all words/shorts/bytes in packet • Simple to implement • Relatively weak detection • Easily tricked by typical loss patterns
  • 23. Lecture 4: 9-6-01 23 Internet Checksum Sender • Treat segment contents as sequence of 16-bit integers • Checksum: addition (1’s complement sum) of segment contents • Sender puts checksum value into checksum field in header Receiver • Compute checksum of received segment • Check if computed checksum equals checksum field value: • NO - error detected • YES - no error detected. But maybe errors nonethless? • Goal: detect “errors” (e.g., flipped bits) in transmitted segment
  • 24. Lecture 4: 9-6-01 24 Error Detection – Cyclic Redundancy Check (CRC) • Polynomial code • Treat packet bits a coefficients of n-bit polynomial • Choose r+1 bit generator polynomial (well known – chosen in advance) • Add r bits to packet such that message is divisible by generator polynomial • Better loss detection properties than checksums
  • 25. Lecture 4: 9-6-01 25 Error Detection – CRC • View data bits, D, as a binary number • Choose r+1 bit pattern (generator), G • Goal: choose r CRC bits, R, such that • <D,R> exactly divisible by G (modulo 2) • Receiver knows G, divides <D,R> by G. If non-zero remainder: error detected! • Can detect all burst errors less than r+1 bits • Widely used in practice (ATM, HDCL)
  • 26. Lecture 4: 9-6-01 26 CRC Example Want: D.2r XOR R = nG equivalently: D.2r = nG XOR R equivalently: if we divide D.2r by G, want reminder Rb R = remainder[ ] D.2r G
  • 27. Lecture 4: 9-6-01 27 Error Recovery • Two forms of error recovery • Error Correcting Codes (ECC) • Automatic Repeat Request (ARQ) • ECC • Send extra redundant data to help repair losses • ARQ • Receiver sends acknowledgement (ACK) when it receives packet • Sender uses ACKs to identify and resend data that was lost
  • 28. Lecture 4: 9-6-01 28 Error Recovery – Error Correcting Codes (ECC) Two Dimensional Bit Parity: Detect and correct single bit errors 0 0
  • 29. Lecture 4: 9-6-01 29 Stop and Wait Time Timeout • Simplest ARQ protocol • Send a packet, stop and wait until acknowledgement arrives • Will examine ARQ issues later in semester Sender Receiver
  • 30. Lecture 4: 9-6-01 30 Recovering from Error Timeout Timeout Time Timeout Packet lost Timeout Early timeout Timeout Timeout ACK lost
  • 31. Lecture 4: 9-6-01 31 Outline • Physical media is analog • Modulation – signals to bits • Bit stream vs. packets • Framing – how to make packets • Corruption • Error detection & recovery • Sharing • Media access
  • 32. Lecture 4: 9-6-01 32 Multiple Access Protocols • Single shared communication channel • Two or more simultaneous transmissions  interference • Only one node can send successfully at a time • Multiple access protocol: • Distributed algorithm that determines how stations share channel, i.e., determine when station can transmit • Communication about channel sharing must use channel itself! • What to look for in multiple access protocols: • Synchronous or asynchronous • Information needed about other stations • Robustness (e.g., to channel errors) • Performance
  • 33. Lecture 4: 9-6-01 33 MAC Protocols: A Taxonomy Three broad classes: • Channel partitioning • Divide channel into smaller “pieces” (time slots, frequency) • Allocate piece to node for exclusive use • Random access • Allow collisions • “Recover” from collisions • “Taking turns” • Tightly coordinate shared access to avoid collisions Goal: efficient, fair, simple, decentralized
  • 34. Lecture 4: 9-6-01 34 Channel Partitioning MAC Protocols: TDMA TDMA: time division multiple access • Access to channel in "rounds" • Each station gets fixed length slot (length = pkt trans time) in each round • Unused slots go idle • Example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle
  • 35. Lecture 4: 9-6-01 35 Baseband vs Carrier Modulation • Baseband modulation: send the “bare” signal. • Carrier modulation: use the signal to modulate a higher frequency signal (carrier). • Can be viewed as the product of the two signals • Corresponds to a shift in the frequency domain • Some idea applies to frequency and phase modulation. • E.g. change frequency of the carrier instead of its amplitude
  • 36. Lecture 4: 9-6-01 36 Amplitude Carrier Modulation Amplitude Signal Carrier Frequency Amplitude Modulated Carrier
  • 37. Lecture 4: 9-6-01 37 Frequency Division Multiplexing: Multiple Channels Amplitude Different Carrier Frequencies Determines Bandwidth of Channel Determines Bandwidth of Link
  • 38. Lecture 4: 9-6-01 38 Channel Partitioning MAC Protocols: FDMA FDMA: frequency division multiple access • Channel spectrum divided into frequency bands • Each station assigned fixed frequency band • Unused transmission time in frequency bands go idle • Example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle frequency bands
  • 39. Lecture 4: 9-6-01 39 Channel Partitioning (CDMA) CDMA (Code Division Multiple Access) • Unique “code” assigned to each user; i.e., code set partitioning • Used mostly in wireless broadcast channels (cellular, satellite,etc) • All users share same frequency, but each user has own “chipping” sequence (i.e., code) to encode data • Encoded signal = (original data) X (chipping sequence) • Decoding: inner-product of encoded signal and chipping sequence • Allows multiple users to “coexist” and transmit simultaneously with minimal interference (if codes are “orthogonal”)
  • 40. Lecture 4: 9-6-01 40 CDMA Encode/Decode
  • 41. Lecture 4: 9-6-01 41 CDMA: Two-sender Interference
  • 42. Lecture 4: 9-6-01 42 Random Access Protocols • When node has packet to send • Transmit at full channel data rate R. • No a priori coordination among nodes • Two or more transmitting nodes  “collision”, • Random access MAC protocol specifies: • How to detect collisions • How to recover from collisions (e.g., via delayed retransmissions) • Examples of random access MAC protocols: • Slotted ALOHA • ALOHA • CSMA and CSMA/CD
  • 43. Lecture 4: 9-6-01 43 Slotted Aloha • Time is divided into equal size slots (= pkt trans. time) • Node with new arriving pkt: transmit at beginning of next slot • If collision: retransmit pkt in future slots with probability p, until successful. Success (S), Collision (C), Empty (E) slots
  • 44. Lecture 4: 9-6-01 44 Pure (unslotted) ALOHA • Unslotted Aloha: simpler, no synchronization • Packet needs transmission: • Send without awaiting for beginning of slot • Collision probability increases: • Packet sent at t0 collide with other pkts sent in [t0- 1, t0+1]
  • 45. Lecture 4: 9-6-01 45 “Taking Turns” MAC protocols • Channel partitioning MAC protocols: • Share channel efficiently at high load • Inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! • Random access MAC protocols • Efficient at low load: single node can fully utilize channel • High load: collision overhead • “Taking turns” protocols • Look for best of both worlds!
  • 46. Lecture 4: 9-6-01 46 “Taking Turns” MAC Protocols Polling • Master node “invites” slave nodes to transmit in turn • Request to Send, Clear to Send msgs • Concerns: • Polling overhead • Latency • Single point of failure (master) Token passing • Control token passed from one node to next sequentially • Concerns: • Token overhead • Latency • Single point of failure (token)