40
The Link Layer and LANs: Overview, Error Detection & Correction, Multiple Access Protocols MAHESH MARINA [email protected] Slides copyright of Kurose and Ross, and thanks to Myungjin Lee UG3 Computer Communications & Networks (COMN)

The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

  • Upload
    others

  • View
    21

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

The Link Layer and LANs Overview Error Detection amp Correction

Multiple Access Protocols

MAHESH MARINAmaheshedacuk

Slides copyright of Kurose and Ross and thanks to Myungjin Lee

UG3 Computer Communications amp Networks (COMN)

Link layer introductionterminologysect hosts and routers nodessect communication channels that

connect adjacent nodes along communication path linksbull wired linksbull wireless linksbull Local Area Networks

(LANs)sect layer-2 packet (frame)

encapsulates datagramdata-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link

6-2Link Layer and LANs

Link layer context

sect datagram transferred by different link protocols over different linksbull eg Ethernet on first link

frame relay on intermediate links 80211 on last link

sect each link protocol provides different servicesbull eg may or may not

provide reliable data transfer over link

transportation analogysect trip from Princeton to Lausanne

bull limo Princeton to JFKbull plane JFK to Genevabull train Geneva to Lausanne

sect tourist = datagramsect transport segment =

communication linksect transportation mode = link

layer protocolsect travel agent = routing

algorithm

6-3Link Layer and LANs

Link layer servicessect framing link accessbull encapsulate datagram into frame adding header trailerbull multiple access if shared mediumbull MAC addresses used in frame headers to identify

source destination bull different from IP address

sect reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some twisted

pair)bull wireless links high error rates

bull Q why both link-level and end-end reliability

6-4Link Layer and LANs

sect flow controlbull pacing between adjacent sending and receiving nodes

sect error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors

bull signals sender for retransmission or drops frame

sect error correctionbull receiver identifies and corrects bit error(s) reducing the need for

retransmission

sect half-duplex and full-duplexbull with half duplex nodes at both ends of link can transmit but not

at same time

Link layer services (more)

6-5Link Layer and LANs

Where is the link layer implementedsect in each and every hostsect link layer implemented in adaptor (aka network interface card NIC) or on a chipbull Ethernet card 80211

card Ethernet chipsetbull implements link physical

layersect attaches into hostrsquos system

busessect combination of hardware

software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

applicationtransportnetworklink

linkphysical

6-6Link Layer and LANs

Adaptors communicating

sect sending sidebull encapsulates datagram in

framebull adds error checking bits

rdt flow control etc

sect receiving sidebull looks for errors rdt

flow control etcbull extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

6-7Link Layer and LANs

Error Detection amp Correction

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 2: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Link layer introductionterminologysect hosts and routers nodessect communication channels that

connect adjacent nodes along communication path linksbull wired linksbull wireless linksbull Local Area Networks

(LANs)sect layer-2 packet (frame)

encapsulates datagramdata-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link

6-2Link Layer and LANs

Link layer context

sect datagram transferred by different link protocols over different linksbull eg Ethernet on first link

frame relay on intermediate links 80211 on last link

sect each link protocol provides different servicesbull eg may or may not

provide reliable data transfer over link

transportation analogysect trip from Princeton to Lausanne

bull limo Princeton to JFKbull plane JFK to Genevabull train Geneva to Lausanne

sect tourist = datagramsect transport segment =

communication linksect transportation mode = link

layer protocolsect travel agent = routing

algorithm

6-3Link Layer and LANs

Link layer servicessect framing link accessbull encapsulate datagram into frame adding header trailerbull multiple access if shared mediumbull MAC addresses used in frame headers to identify

source destination bull different from IP address

sect reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some twisted

pair)bull wireless links high error rates

bull Q why both link-level and end-end reliability

6-4Link Layer and LANs

sect flow controlbull pacing between adjacent sending and receiving nodes

sect error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors

bull signals sender for retransmission or drops frame

sect error correctionbull receiver identifies and corrects bit error(s) reducing the need for

retransmission

sect half-duplex and full-duplexbull with half duplex nodes at both ends of link can transmit but not

at same time

Link layer services (more)

6-5Link Layer and LANs

Where is the link layer implementedsect in each and every hostsect link layer implemented in adaptor (aka network interface card NIC) or on a chipbull Ethernet card 80211

card Ethernet chipsetbull implements link physical

layersect attaches into hostrsquos system

busessect combination of hardware

software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

applicationtransportnetworklink

linkphysical

6-6Link Layer and LANs

Adaptors communicating

sect sending sidebull encapsulates datagram in

framebull adds error checking bits

rdt flow control etc

sect receiving sidebull looks for errors rdt

flow control etcbull extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

6-7Link Layer and LANs

Error Detection amp Correction

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 3: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Link layer context

sect datagram transferred by different link protocols over different linksbull eg Ethernet on first link

frame relay on intermediate links 80211 on last link

sect each link protocol provides different servicesbull eg may or may not

provide reliable data transfer over link

transportation analogysect trip from Princeton to Lausanne

bull limo Princeton to JFKbull plane JFK to Genevabull train Geneva to Lausanne

sect tourist = datagramsect transport segment =

communication linksect transportation mode = link

layer protocolsect travel agent = routing

algorithm

6-3Link Layer and LANs

Link layer servicessect framing link accessbull encapsulate datagram into frame adding header trailerbull multiple access if shared mediumbull MAC addresses used in frame headers to identify

source destination bull different from IP address

sect reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some twisted

pair)bull wireless links high error rates

bull Q why both link-level and end-end reliability

6-4Link Layer and LANs

sect flow controlbull pacing between adjacent sending and receiving nodes

sect error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors

bull signals sender for retransmission or drops frame

sect error correctionbull receiver identifies and corrects bit error(s) reducing the need for

retransmission

sect half-duplex and full-duplexbull with half duplex nodes at both ends of link can transmit but not

at same time

Link layer services (more)

6-5Link Layer and LANs

Where is the link layer implementedsect in each and every hostsect link layer implemented in adaptor (aka network interface card NIC) or on a chipbull Ethernet card 80211

card Ethernet chipsetbull implements link physical

layersect attaches into hostrsquos system

busessect combination of hardware

software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

applicationtransportnetworklink

linkphysical

6-6Link Layer and LANs

Adaptors communicating

sect sending sidebull encapsulates datagram in

framebull adds error checking bits

rdt flow control etc

sect receiving sidebull looks for errors rdt

flow control etcbull extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

6-7Link Layer and LANs

Error Detection amp Correction

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 4: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Link layer servicessect framing link accessbull encapsulate datagram into frame adding header trailerbull multiple access if shared mediumbull MAC addresses used in frame headers to identify

source destination bull different from IP address

sect reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some twisted

pair)bull wireless links high error rates

bull Q why both link-level and end-end reliability

6-4Link Layer and LANs

sect flow controlbull pacing between adjacent sending and receiving nodes

sect error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors

bull signals sender for retransmission or drops frame

sect error correctionbull receiver identifies and corrects bit error(s) reducing the need for

retransmission

sect half-duplex and full-duplexbull with half duplex nodes at both ends of link can transmit but not

at same time

Link layer services (more)

6-5Link Layer and LANs

Where is the link layer implementedsect in each and every hostsect link layer implemented in adaptor (aka network interface card NIC) or on a chipbull Ethernet card 80211

card Ethernet chipsetbull implements link physical

layersect attaches into hostrsquos system

busessect combination of hardware

software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

applicationtransportnetworklink

linkphysical

6-6Link Layer and LANs

Adaptors communicating

sect sending sidebull encapsulates datagram in

framebull adds error checking bits

rdt flow control etc

sect receiving sidebull looks for errors rdt

flow control etcbull extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

6-7Link Layer and LANs

Error Detection amp Correction

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 5: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

sect flow controlbull pacing between adjacent sending and receiving nodes

sect error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors

bull signals sender for retransmission or drops frame

sect error correctionbull receiver identifies and corrects bit error(s) reducing the need for

retransmission

sect half-duplex and full-duplexbull with half duplex nodes at both ends of link can transmit but not

at same time

Link layer services (more)

6-5Link Layer and LANs

Where is the link layer implementedsect in each and every hostsect link layer implemented in adaptor (aka network interface card NIC) or on a chipbull Ethernet card 80211

card Ethernet chipsetbull implements link physical

layersect attaches into hostrsquos system

busessect combination of hardware

software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

applicationtransportnetworklink

linkphysical

6-6Link Layer and LANs

Adaptors communicating

sect sending sidebull encapsulates datagram in

framebull adds error checking bits

rdt flow control etc

sect receiving sidebull looks for errors rdt

flow control etcbull extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

6-7Link Layer and LANs

Error Detection amp Correction

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 6: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Where is the link layer implementedsect in each and every hostsect link layer implemented in adaptor (aka network interface card NIC) or on a chipbull Ethernet card 80211

card Ethernet chipsetbull implements link physical

layersect attaches into hostrsquos system

busessect combination of hardware

software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

applicationtransportnetworklink

linkphysical

6-6Link Layer and LANs

Adaptors communicating

sect sending sidebull encapsulates datagram in

framebull adds error checking bits

rdt flow control etc

sect receiving sidebull looks for errors rdt

flow control etcbull extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

6-7Link Layer and LANs

Error Detection amp Correction

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 7: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Adaptors communicating

sect sending sidebull encapsulates datagram in

framebull adds error checking bits

rdt flow control etc

sect receiving sidebull looks for errors rdt

flow control etcbull extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

6-7Link Layer and LANs

Error Detection amp Correction

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 8: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Error Detection amp Correction

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 9: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Error detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

6-9Link Layer and LANs

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 10: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Parity checking

single bit paritysect detect single bit

errors

two-dimensional bit paritysect detect and correct single bit errors

0 0

6-10Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 11: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Internet checksum (review)

sendersect treat segment contents

as sequence of 16-bit integers

sect checksum addition (1rsquos complement sum) of segment contents

sect sender puts checksum value into UDP checksum field

receiversect compute checksum of

received segmentsect check if computed

checksum equals checksum field valuebull NO - error detectedbull YES - no error detected

But maybe errors nonetheless

goal detect errors (eg flipped bits) in transmitted packet (note used at transport and network layers)

6-11Link Layer and LANs

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 12: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Cyclic redundancy checksect more powerful error-detection codingsect view data bits D as a binary numbersect choose r+1 bit pattern (generator) Gsect goal choose r CRC bits R such that

bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remainder

error detectedbull can detect all burst errors less than r+1 bits

sect widely used in practice (Ethernet 80211 WiFi ATM)

6-12Link Layer and LANs

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 13: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Cyclic redundancy check

sect All CRC calculations are done in modulo-2 arithmetic without carries in addition or borrows in subtraction

sect Multiplication and division are the same as in base-2 arithmetic except that any required addition or subtraction is done without carries and borrows

1011 XOR 0101 = 1110 1011 ndash 0101 = 1110equivalent to

1011 + 0101 = 1110equivalent to

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 14: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

CRC example

wantD2r XOR R = nG

equivalentlyD2r = nG XOR R

equivalentlyif we divide D2r by G want remainder R to satisfy

R = remainder[ ]D2r

G

6-14Link Layer and LANs

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 15: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Multiple Access Protocols

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 16: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Multiple access links protocolstwo types of linkssect point-to-point

bull PPP for dial-up accessbull point-to-point link between Ethernet switch host

sect broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFCbull 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

6-16Link Layer and LANs

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 17: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Multiple access protocolssect single shared broadcast channel sect two or more simultaneous transmissions by nodes

interference bull collision if node receives two or more signals at the same

time

multiple access protocolsect distributed algorithm that determines how nodes share

channel ie determine when node can transmitsect communication about channel sharing must use channel itself

bull no out-of-band channel for coordination

6-17Link Layer and LANs

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 18: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

An ideal multiple access protocol

given broadcast channel of rate R bpsdesiderata

1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RM3 fully decentralized

bull no special node to coordinate transmissionsbull no synchronization of clocks slots

4 simple

6-18Link Layer and LANs

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 19: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

MAC protocols taxonomy

three broad classessect channel partitioning

bull divide channel into smaller pieces (time slots frequency code)bull allocate piece to node for exclusive use

sect random accessbull channel not divided allow collisionsbull recover from collisions

sect taking turnsrdquobull nodes take turns but nodes with more to send can take longer

turns

6-19Link Layer and LANs

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 20: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Channel partitioning MAC protocols TDMA

TDMA time division multiple accesssect access to channel in rounds sect each station gets fixed length slot (length = packet

transmission time) in each round sect unused slots go idle sect example 6-station LAN 134 have packets to

send slots 256 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

6-20Link Layer and LANs

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 21: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

FDMA frequency division multiple access sect channel spectrum divided into frequency bandssect each station assigned fixed frequency bandsect unused transmission time in frequency bands go idle sect example 6-station LAN 134 have packet to send frequency

bands 256 idle

frequ

ency

ban

ds

time

FDM cable

Channel partitioning MAC protocols FDMA

6-21Link Layer and LANs

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 22: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Random access protocolssect when node has packet to sendbull transmit at full channel data rate Rbull no a priori coordination among nodes

sect two or more transmitting nodes collisionsect random access MAC protocol specifies bull how to detect collisionsbull how to recover from collisions (eg via delayed

retransmissions)sect examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA

6-22Link Layer and LANs

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 23: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Slotted ALOHA

assumptionssect all frames same sizesect time divided into equal size

slots (time to transmit 1 frame)

sect nodes start to transmit only slot beginning

sect nodes are synchronizedsect if 2 or more nodes transmit

in slot all nodes detect collision

operationsect when node obtains fresh

frame transmits in next slotbull if no collision node can send

new frame in next slotbull if collision node retransmits

frame in each subsequent slot with prob p until success

6-23Link Layer and LANs

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 24: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Prossect single active node can

continuously transmit at full rate of channel

sect highly decentralized only slots in nodes need to be in sync

sect simple

Conssect collisions wasting slotssect idle slotssect nodes may be able to

detect collision in less than time to transmit packet

sect clock synchronization

Slotted ALOHA1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

6-24Link Layer and LANs

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 25: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

sect suppose N nodes with many frames to send each transmits in slot with probability p

sect prob that given node has success in a slot = p(1-p)N-1

sect prob that any node has a success = Np(1-p)N-1

sect max efficiency find p that maximizes Np(1-p)N-1

sect for many nodes take limit of Np(1-p)N-1 as N goes to infinity givesmax efficiency = 1e = 37

efficiency long-run fraction of successful slots (many nodes all with many frames to send)

at best channelused for useful transmissions 37of time

Slotted ALOHA efficiency

6-25Link Layer and LANs

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 26: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Pure (unslotted) ALOHA

sect unslotted Aloha simpler no synchronizationsect when frame first arrivesbull transmit immediately

sect collision probability increasesbull frame sent at t0 collides with other frames sent in [t0-

1t0+1]

6-26Link Layer and LANs

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 27: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Pure ALOHA efficiencyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18

even worse than slotted Aloha

6-27Link Layer and LANs

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 28: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire framesect if channel sensed busy defer

transmission

sect human analogy donrsquot interrupt others

6-28Link Layer and LANs

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 29: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

CSMA collisions

sect collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission

sect collision entire packet transmission time wastedbull distance amp

propagation delay play role in in determining collision probability

spatial layout of nodes

6-29Link Layer and LANs

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 30: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMAbull collisions detected within short timebull colliding transmissions aborted reducing channel wastage

sect collision detectionbull easy in wired LANs measure signal strengths compare

transmitted received signalsbull difficult in wireless LANs received signal strength

overwhelmed by local transmission strength also collision may happen at receiver side

sect human analogy the polite conversationalist

6-30Link Layer and LANs

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 31: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

CSMACD (collision detection)

spatial layout of nodes

6-31Link Layer and LANs

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 32: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters binary (exponential) backoff bull after mth collision NIC

chooses K at random from 012 hellip 2m-1 NIC waits K512 bit times returns to Step 2

bull longer backoff interval with more collisions

6-32Link Layer and LANs

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 33: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Ethernet CSMACD algorithm

33

Create a frame with a datagram from Network layer

Start to transmit the frame

Channel idle

Collision

Abort transmission

Binary (exponential) backoff

After mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K time units (one time unit = 512 bit times)

Yes

No

No

Yes

Longer backoff interval with more collisions

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 34: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

CSMACD efficiency

sect Tprop = max prop delay between 2 nodes in LANsect ttrans = time to transmit max-size frame

sect efficiency goes to 1 bull as tprop goes to 0bull as ttrans goes to infinity

sect better performance than ALOHA and simple cheap decentralized

transprop ttefficiency

511

+=

6-34Link Layer and LANs

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 35: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Taking turns MAC protocols

channel partitioning MAC protocolssect share channel efficiently and fairly at high loadsect inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocols

sect efficient at low load single node can fully utilize channel

sect high load collision overhead and channel idle timetaking turns protocols

look for best of both worlds

6-35Link Layer and LANs

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 36: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

pollingsect master node invites

slave nodes to transmit in turn

sect typically used with dumb slave devices

sect concernsbull polling overhead bull latencybull single point of

failure (master)

master

slaves

poll

data

data

Taking turns MAC protocols

6-36Link Layer and LANs

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 37: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

token passingsect control token passed from

one node to next sequentially

sect token messagesect concerns

sect token overhead sect latencysect single point of failure

(token)

T

data

(nothingto send)

T

Taking turns MAC protocols

6-37Link Layer and LANs

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 38: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

cable headend

CMTS

ISP

cable modemtermination system

sect multiple 40Mbps downstream (broadcast) channelssect single CMTS transmits into channels

sect multiple 30 Mbps upstream channelssect multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network

cablemodemsplitter

hellip

hellip

Internet frames TV channels control transmitted downstream at different frequencies

upstream Internet frames TV control transmitted upstream at different frequencies in time slots

6-38Link Layer and LANs

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 39: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

DOCSIS data over cable service interface spec sect FDM over upstream downstream frequency channelssect TDM upstream some slots assigned some have contention

bull downstream MAP frame assigns upstream slotsbull request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1 t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Cable access network

6-39Link Layer and LANs

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs

Page 40: The Link Layer and LANs: Overview, Error Detection ... · Link layer: context §datagram transferred by different link protocols over different links: •e.g., Ethernet on first link,

Summary of MAC protocols

sect channel partitioning by time frequency or codebull Time Division Frequency Division

sect random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard

in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211

sect taking turnsbull polling from central site token passingbull Bluetooth FDDI token ring

6-40Link Layer and LANs