0% found this document useful (0 votes)
54 views13 pages

Data Link Layer! Multiple Access Problem!

1. The Data Link layer can be subdivided into the Logical Link Control (LLC) layer for error and flow control and the Media Access Control (MAC) layer for framing and media access. 2. The MAC layer determines how nodes on a shared medium access the channel to prevent collisions when multiple nodes attempt to transmit simultaneously. 3. Common MAC protocols include random access protocols like ALOHA and CSMA/CD, token passing protocols, and channel partitioning protocols like TDMA. Ethernet uses the CSMA/CD protocol.

Uploaded by

Simo Asanovic
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views13 pages

Data Link Layer! Multiple Access Problem!

1. The Data Link layer can be subdivided into the Logical Link Control (LLC) layer for error and flow control and the Media Access Control (MAC) layer for framing and media access. 2. The MAC layer determines how nodes on a shared medium access the channel to prevent collisions when multiple nodes attempt to transmit simultaneously. 3. Common MAC protocols include random access protocols like ALOHA and CSMA/CD, token passing protocols, and channel partitioning protocols like TDMA. Ethernet uses the CSMA/CD protocol.

Uploaded by

Simo Asanovic
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Data Link Layer! Multiple Access Problem!

The Data Link layer can be further subdivided into:! Broadcast channel of rate R bps, shared medium!
1.! Logical Link Control (LLC): error and flow control! •! if two users send at the same time, collision results in no packet
2.! Media Access Control (MAC): framing and media being received (interference)!
application
access! •! if no users send, channel goes idle!
different link protocols may provide different services, •! thus, want to have only one user send at a time!
e.g., Ethernet doesn’t provide reliable delivery (error transport
recovery)!
network Media Access Control: !
MAC topics:! •! determines who gets to send next!
LLC •! what to do if more than one hosts "
•! framing and MAC address assignment!
MAC send at the same time and there’s collision!
•! LAN forwarding!
•! IP to MAC address resolution! physical
•! IP to MAC: Address Resolution Protocol (ARP)!
Duplex mode:!
•! MAC to IP: Reverse ARP (RARP), BOOTstrap Protocol •! half duplex: only one end can send at a time!
(BOOTP), Dynamic Host Configuration Protocol (DHCP)! •! full duplex: both ends can send simultaneously!
•! media access control!

Ideal Multiple Access Protocol! Categorization of MAC Protocols!


•! when one node wants to transmit, it can send 1.! Random access:!
•! Slotted ALOHA!
at rate R •! ALOHA!
•! when M nodes want to transmit, each can send •! Carrier Sense Multiple Access "
at average rate R/M with Collision Detection (CSMA/CD)!
•! CSMA/CAvoidance!
•! fully decentralized:!
2.! Token passing!
•! no special node to coordinate transmissions!
3.! Channel partitioning: TDMA, FDMA, CDMA!
•! no synchronization of clocks, slots!
•! distributed algorithm that determines how nodes Standards: !
share channel, i.e., determine when node can transmit! •! 802.3 (CSMA/CD), 802.3a? (GigE)!
•! communication about channel sharing must use •! 802.4 (token bus)!
channel itself! ! •! 802.5 (token ring)!
•! no out-of-band channel for coordination! •! 802.11[bagn] (WiFi)!
Random Access MAC Protocol! Ethernet: CSMA/CD!
Characteristics:!
•! sender xmits bits on the wire at full channel rate R bps! Carrier Sensing:!
•! no prior coordination among nodes ! 1.! check for presence of electrical signal (carrier) on wire
•! bits are propagated along the entire network! before transmission!
•! destination recognizes that frame is for itself! 2.! presence of carrier means someone else is sending, wait!
•! destination grabs frame! 3.! start transmission if no carrier detected!
•! while one host is xmitting, all others must wait!
Problem: collision!
Random access means: !
•! relies on collision to control access!
•! how to detect collisions!
•! how to recover from collisions!

CSMA Collisions! Collision Detection!


spatial layout of nodes !
•! sender must continue to detect
•! collisions occurs because
collision after transmission!
propagation delay means two
nodes may not hear of each •! on collision, frames must be
other’s transmission when they collision!
retransmitted!
start transmitting (A at t0, D at t1)! •! problem: more collision!
t 2!
•! when collision occurs (at t2), entire
frame transmission time (t3-t0 or,
equivalently, t4-t1) is wasted! 4.! if adaptor detects collision
while transmitting, aborts
•! note the role distance &
propagation delay play in t 3!
and sends jam signal!
determining collision probability! t 4!
5.! after aborting, adaptor
•! a collision is detected if power enters exponential
received is larger than power backoff!
transmitted!
Jam Signal and Exponential Back-off! CSMA/CD Summary!
The algorithm:!
Jam signal: make sure all other transmitters are aware of collision; 48 bits! 1.! listen for carrier!
2.! if no carrier, send frame!
Exponential back-off: senders pick a uniformly distributed random delay
between [0,20d] before retransmission. Why random?! 3.! listen for collision or jamming signal!
4.! if collision detected, send jamming signal!
If collision occurs again, pick another random delay between [0,21d], 5.! if collision or jamming signal detected, retransmit after
[0,22d], [0,23d], . . . hence (binary) exponential back-off! exponential back-off!

Bit time: .1 µsec on a 10 Mbps Ethernet!


for 210d, wait time is about 50d msec! Historical Note:!
Collision detection and retransmission with back-off was first
used in the ALOHA MAC algorithm from the University of
Hawaii (1970) for access to satellite channels!

Collision Detection Time! Minimum Frame Size!


How long must a sender listen for collision?! When a sender detects collision how does it "
•! let ! be the propagation time from " know that the collision was caused by its packet?!
one end of the wire to the other! t

•! within ! time after the transmission " Answer: sender must hold carrier for 2! period, "
of a frame (t), all nodes on the segment " i.e., it must be transmitting for the whole 2! "
would have sensed carrier! t +! period each Ethernet frame must be at "
•! worst case scenario for collision: " least 2! *linkspeed long!
what if
a node at the other end of the wire " transmission
ends here?!
starts transmitting at time!t + ! " # t +! "# Example:!
•! the node closest to the collision sends " •! 10 Mbps Ethernet allows maximum of 5 segments, each 500 m long!
out a jamming signal to ensure collision " Comer!
•! speed of light 3x108m/s, but coax propagation 2x108m/s!
is detected by the other node! t + 2!
Peterson & Davie! •! round-trip propagation delay ( 2! ) on 2.5 km coax is 25 µsecs!
•! it takes another ! period for the collision to get back to the original •! allowing for 4 repeaters makes end-to-end delay 50 µsecs!
sender! •! 50 µsecs means 62.5 bytes!
Hence the original sender must listen for 2! period! •! 802.3 standard requires stations to hold carrier for "
64 bytes/10 Mbps = 51.2 µsecs!
CSMA/CD Efficiency ( ! )! Repeaters and Bridges!
tprop = max propagation time between 2 nodes in the LAN! Each Ethernet segment is limited to 500 m long by signal
ttrans = time to transmit maximum-size frame! attenuation!
Repeaters: repeat and strengthen signal (physical layer)!
ttrans 1 Ethernet only allows 4 repeaters: max 2.5 km. Why?!
!= =
ttrans + 5t prop 1 + 5t prop / ttrans
Bridges: equivalence of routers at the data link layer!
! " 1 as t prop " 0 or as ttrans " # •! forward frames between segments!
•! unlike routers, only know whether a node is in a segment!
•! does not propagate interference and collisions (must buffer)!
•! increase effective/aggregate bandwidth of a LAN by taking
min frame size
Tanenbaum! advantage of spatial locality!
•! can connect segments with different MAC protocols"

Hubs! Interconnecting with Hubs!


Hubs are essentially physical-layer repeaters:! •! backbone hub interconnects LAN segments!
•! bits coming from one link go out all other links! •! extends max distance between nodes!
•! at the same rate! •! but individual segment collision domains
become one large collision domain!
•! no frame buffering!
•! can’t interconnect 10BaseT & 100BaseT!
•! no CSMA/CD at hub: collision detection left to host
adaptors!
hub!

twisted pair!

hub! hub! hub!


hub!
Switches! Transparent Bridges/Switches
Link layer router-equivalent:! and Backward Learning!
•! stores and forwards Ethernet frames!
•! examines frame header and selectively forwards frame based on How does a bridge know which segment a node is located at?!
MAC destination address!
•! when frame is to be forwarded on a segment, uses CSMA/CD to
access segment!
Each switch has a switch table, entry in switch table: !
•! <MAC Address, interface, timestamp>!
•! transparent: hosts are unaware of presence of switches!
•! stale entries in table dropped (TTL can be 60 min) !
•! plug-and-play: self-learning, switches do not need to be configured!
•! How does a switch determine"
onto which LAN segment to " switch! switch learns which hosts can be reached through which
1!
forward frame?! 2! 3! interfaces!
•! Looks like a routing problem…! •! when a frame is received, switch “learns” location of sender: incoming
interface connects to the LAN segment through which a sender may be
hub! hub! hub! reached!
•! records sender/interface pair in switch table!
•! called “backward learning”!

Frame Filtering/Forwarding! Switch Example!


When a switch receives a frame:" Suppose C sends a frame to D
switch! address! interface!
look for MAC destination address in switch table! 1! A 1!
if entry found for destination {! 2! 3! B 1!
!if destination on segment from which frame arrived {! E 2!
! !drop the frame! hub! hub! hub! G 3!
A
!} else {! I
! !forward the frame on interface indicated! D F
B C G H
E
!}!
} else {! Switch receives frame from C
!flood // forward on all but the interface on which the frame arrived! records in switch table that C is on interface 1!
}! because D is not in table, switch forwards frame to
interfaces 2 and 3!
frame received by D !
Switch Example! Switch: Traffic Isolation!
switch installation breaks subnet into LAN segments!
Suppose D now sends a frame to C
switch filters packets: !
switch! address! interface!
•! same-LAN-segment frames are not usually forwarded onto
1! A 1!
2! 3! other LAN segments!
B 1!
•! segments become separate collision domains!
E 2!
hub! hub! hub! G 3!
A
I C 1! switch!
D F D 2! collision "
B C G H
E domain!
Switch receives frame from D hub! hub! hub!
records in switch table that D is on interface 2!
because C is in table, switch forwards frame only to
interface 1!
frame received by C ! collision domain! collision domain!

Switches: Dedicated Access! A Example Enterprise Network "


Switch/Hub Installment!
Hosts have direct connection " F B
to switch! mail server!
to external!
No collisions; full duplex! switch! network!
router! web server!

Switching: A-to-D and B-to-E " switch!


C
simultaneously, no collisions! IP subnet!
E D
Cut-through switching: frame forwarded from input to output
port without storing! hub!
hub! hub!
•! slight reduction in latency!

switches can support combinations of shared/dedicated and


10/100/1000 Mbps interfaces!
Switches and Spanning Tree! Switches vs. Routers!
LANs may form cycles, causing broadcast storm!
Both store-and-forward devices!
Bridges/switches detect cycles by doing
Given bridges, why do we still need routers?!
distributed spanning tree computation:!
•! all bridges broadcast serial #, root ID, " •! routers are network layer devices (what does this mean?)!
cost to root! •! routers maintain routing tables, implement routing algorithms!
•! bridge with lowest serial # becomes "
•! switches are link layer devices!
root of tree!
•! all bridges determine root port (port to root)! •! switches maintain switch tables, implement filtering, backward
learning algorithms !
•! the spanning tree consists of bridges (nodes) "
and root port (links)!

Forwarding on the tree:!


Peterson & Davie!
•! each LAN determines a designated bridge by lowest cost
to root, break tie by serial #!
•! forward frames only on links that are part of the tree!
Switch!

Token Ring MAC Protocol! Token Ring MAC Protocol!


•! a token goes around a ring "
network! Token:!
•! to send data, a node must first " •! a special bit pattern!
grab the token! •! use bit-stuffing if data resembles token!
•! a frame sent from a source is " •! only one token on ring at a time (managed by a monitor)!
Comer!
passed from node to node around the ring!
•! destination recognizes own address and makes a copy of frame! IBM’s token ring link speed is 16 Mbps!
•! sender removes frame from ring!
•! each node can only transmit one frame at a time; must return
token to the ring after each frame transmission!
Token ring:!
•! advantage: no collision!
•! disadvantage: failure of a node or link disables the whole
Why let the sender, instead of the receiver, remove network!
frame from the ring?!
Token Ring Performance! CSMA/CD Efficiency ( ! )!
(64 bytes) (1500 bytes)

Halsall!

Other MAC Protocols! Data Link Layer!


The Data Link layer can be further subdivided into:!
1.! Logical Link Control (LLC): error and flow control!
FDDI:! 2.! Media Access Control (MAC): framing and media
application
•! operates at 100 Mbps! access!
•! uses the token ring MAC protocol! different link protocols may provide different services,
Cormer!
e.g., Ethernet doesn’t provide reliable delivery (error transport
•! for robustness, uses two counter-rotating rings! recovery)!
•! if a link/node goes down, the dual-ring can be reconfigured to network
a single ring network (hence called self-healing network)! MAC topics:! LLC
•! framing and MAC address assignment!
MAC
•! LAN forwarding!
SLIP/PPP: serial line, point-to-point protocol, no need
•! IP to MAC address resolution! physical
for media access control, just framing! •! IP to MAC: Address Resolution Protocol (ARP)!
•! MAC to IP: Reverse ARP (RARP), BOOTstrap Protocol
(BOOTP), Dynamic Host Configuration Protocol (DHCP)!
ATM/Frame Relay/SONET: for backbone links . . . .! •! media access control!
Ethernet: Connectionless Service! Transmission Errors!
No handshaking between sending and receiving adaptor! Three kinds of transmission errors:!
1.! sent signal changed (received wrong data)!
Receiving adaptor doesn’t send ACKs or NACKs to 2.! sent signal destroyed (doesn’t receive data)!
sending adaptor! 3.! spurious signal created (received random data)!
•! stream of datagrams passed up to network layer can have gaps!
•! gaps will be filled if application uses reliable transport layer! Caused by noise on the channel: "
•! otherwise, application will see the gaps! interference, cosmic rays!

Other data link protocols may provide error


correction and flow control!

Error Control! Error Control!


Ways to detect errors, general idea:!
•! sender computes some info from data! Two types of error control:!
•! sender sends this info along with data! 1.! error detecting code!
•! receiver does the same computation and " 2.! error correcting code (ECC), "
compares it with the sent info! a.k.a. forward error correction/control (FEC)!

Not often used for largely reliable links, "


but useful for unreliable links such as wireless! Examples error detecting code:!
•! parity check!
Used at the transport layer also " •! checksum!
(the Internet is an unreliable “link”)! •! cyclic redundancy check (CRC)!

Field: Information Theory!


Error Control! Parity Check!
Trade-offs between alternate methods:! •! uses an extra bit (parity bit) for error checking!
•! complexity of info computation,! •! even parity: total # of 1 bits (incl. the parity bit) "
•! bandwidth transmission overhead, and! is an even number!
•! degree of protection (# of bit errors that can be detected)! •! odd parity: total # of 1 bits is odd!
•! single-bit parity examples:!
No error detection method is fool-proof!
0100101, even-parity bit =!
0101101, even-parity bit =!
•! what happens when an error is detected?!
•! discard data and if reliability is required, have sender
retransmit!
•! problem: can not detect even # of flipped bits!

2D Parity Check as ECC! Error Correction vs. Detection!


ECC generally requires more redundant bits
•! generates both a horizontal/row parity " than just detection!
and a vertical/column parity!
•! both parity info sent to receiver! It is generally cheaper to retransmit data
•! receiver can detect " only when error has been detected than to
and correct single-bit errors! transmit redundant data all the time!
•! problem: can not detect "
FEC is most useful when:!
even # of flipped bits!
1.! link is very noisy, e.g., wireless link!
2.! retransmission will take too long, e.g.,!
•! satellite communication!
•! deep space probe transmission!
•! real-time audio/video streaming!
Checksum! Checksum!
Disadvantage:!
Used also by TCP and UDP! •! with 16-bit checksum, 1 in 64K corrupted packet will not be detected
(probability of a random 16-bit number matching the checksum of a
Sender treats data as a sequence of integers and computes their corrupted packet is 1/ 216)!
(1’s complement) sum!

Example: 16-bit checksum!


•! the string “Hello world.” has an ASCII representation of [48 65 6C 6C 6F
20 77 6F 72 6C 64 2E]!
•! checksum: 4865 + 6C6C + 6f20 + 776F + 726C + 642E + carry = 71FC! ! under current Internet conditions (error rate etc.), 1 in every 300M
packet accepted corrupted!!
Advantages:!
•! ease of computation (only requires addition)! Mogul (1992) measured on a busy NFS" Layer! # checksum
errors caught!
~#pkts!

•! small amount of additional info to carry: one additional 16-bit or 32-bit server that has been up 40 days:! ethernet! (CRC) 446! 1.7x108!
integer! IP! 14! 1.7x108!
UDP! 5! 1.4x108!
TCP! 350! 3x107!

Cyclic Redundancy Check! Polynomial Arithmetic!


Goal of any error detection/correction code: maximize probability of The math says you can divide one such polynomial by another such
detecting error with minimal redundant info! polynomial of lower or equal degree by dividing the binary
representation of the polynomials, e.g., to divide x5+x3+x2+x
32-bit CRC protects against most bit errors in messages thousands of by x3+1, divide 101110 by 1001!
bytes long, also used in storage systems (CD, DVD)!
Polynomial arithmetic is done using modulo-2 arithmetic, with no
CRC is based on finite fields math! carry and borrow: 1+1 = 0+0 = 0 and 1+0 = 0+1 = 1, e.g.,!

Consider a binary message as a representation of an n-degree !10011011 !11110000 !01010101!


polynomial, with the coefficient of each term being 1 or 0 depending !11001010 + !10100110 - !10101111 -!
on the bit in the message, with the most significant (leftmost) bit !--------------- !--------------- !---------------!
representing the highest degree term! !01010001 !01010110 !11111010!

•! For example: 1011 represents 1x3 + 0x2 + 1x1 + 1x0 = x3 + x + 1


Note that both addition and subtraction are identical to XOR!
An m-bit message represents a polynomial of m-1 degree!
Constructing CRC! Constructing CRC!
Recall: multiplying a number by 2 is the same as shifting it left by 1 bit!
Let’s call the polynomial to be divided T and the divisor/
generator polynomial G
Let D be the message to be sent, e.g., D =101110!

Let t be the number of bits in T and r +1 be the number of


Construct T as D•2r, D shifted left by r bits, e.g., r =3, T =101110000!
bits in G, t ! r +1

Let G = 1001, compute R, the remainder of T/G,"


Let’s call the remainder of T/G, R; R is of r bits!
by doing the long-division, with modulo-2 arithmetic, "
e.g., R = 011!
Want: the polynomial represented by the message to be
exactly divisible by G, such that if the receiver divides the
Now M = (T-R) = (D•2r – R) =(D•2r XOR R), e.g., 101110011,
message by G and the remainder is not 0, it will know the
message has been corrupted! is exactly divisible by G!

M =(T-R) is exactly divisible by G!

How to Choose G?! CRC Hardware Implementation!


Let the string of bit errors introduced be represented as polynomial E CRC can be cheaply implemented in hardware by implementing the long-
division to compute R as a combination of linear feedback shift register
Error will not be detected only if T+E is exactly divisible by G (LFSR) and XOR gates!

Want G that makes this unlikely. What’s known:!


The shift registers and XOR gates represents the G:!
•! if xr and x0 terms have non-zero coefficients, "
•! the 0-th term of G occupies the leftmost bit of the shift registers!
G can detect all single-bit errors!
•! each XOR gate represents a modulo-2 addition in G
•! as long as G has a factor with at least 3 terms, "
•! the message is fed into the circuit most significant (leftmost) bit first!
it can detect all double-bit errors!
•! each bit of the message causes the current content of the shift registers to be
•! as long as G contains the factor (x+1), " shifted right by one bit!
it can detect any odd number of errors!
•! when the message is exhausted, the shift registers contain R
•! G can detect any burst (sequence of consecutive) errors of length < r bits! •! for example, computing CRC with G =x2+1 can be implemented as:!

Usually, you just look up a commonly used G, e.g., Ethernet uses CRC-32!

CRC-32: 100000100110000010001110110110111!
CRC-CCITT: 10001000000100001!
Peterson & Davie!
Link Layer Services! Link Layer Services!
Half-duplex and full-duplex!
•! with half duplex, nodes at both ends of link can transmit, but not
at same time! Error Correction: !
•! receiver identifies and corrects bit error(s) without resorting to
Framing, link access: ! retransmission!
•! encapsulate datagram into frame, adding header, trailer!
•! channel access if shared medium! Flow Control: !
•! “MAC” addresses used in frame headers to identify source, dest ! •! pacing between adjacent sending and receiving nodes!
•! different from IP address!!
Reliable delivery between adjacent nodes!
Error Detection: ! •! seldom used on low bit error link (fiber, some twisted pair)!
•! errors caused by signal attenuation, noise. ! •! wireless links: high error rates!
•! receiver detects presence of errors: ! •! Q: why both link-level and end-end reliability?!
•! signals sender for retransmission or drops frame!

Midterm Review: Mon, 2/16 in class!

Midterm Exam: Wed, 2/18, 6:40-8:40 pm


in 1670 CSE (next door)!

Spring Break: week of 2/23!

You might also like