SlideShare a Scribd company logo
1 of 37
Download to read offline
CSE 123: Computer Networks 
Stefan Savage 
Lecture 6: 
Media Access Control
Today: Media access 
 How to share a channel among different hosts? 
 Channel partitioning 
 FDMA (frequency division multiple access) 
 TDMA (time division multiple access) 
 CDMA (code division multiple access) 
 Random access 
 Contention-based 
» Aloha 
» CSMA, CSMA/CD, CSMA/CA 
» Ethernet, 802.11 
 Contention-free 
» Token-ring, FDDI
Channel Partitioning 
 Need to share media with multiple nodes (n) 
 Multiple simultaneous conversations 
 A simple solution 
 Divide the channel into multiple, separate channels 
 Channels are completely separate 
 Bitrate of the channel is split across channels 
 Nodes can only send/receive on their assigned channel 
 Several different ways to do it… 
3
 Divide bandwidth of f Hz into n channels each with 
bandwidth f/n Hz 
 Easy to implement, but unused subchannels go idle 
» Also need “guard bands” between channels to prevent interference 
 Used by traditional analog cell phone service, radio, TV 
Amplitude 
Frequency 
Amplitude 
Frequency 
4 
Frequency Division (FDMA)
 Divide channel into rounds of n time slots each 
 Assign different hosts to different time slots within a round 
 Unused time slots are idle 
 Used in GSM cell phones & digital cordless phones 
 Example with 1-second rounds 
 n=4 timeslots (250ms each) per round 
Host # 
1 2 3 1 2 3 4 2 4 
1 sec 1 sec 1 sec 
5 
Time Division (TDMA)
6 
Code Division (CDMA) 
 Do nothing to physically separate the channels 
 All stations transmit at same time in same frequency bands 
 One of so-called spread-spectrum techniques 
 Sender modulates their signal on top of unique code 
 Sort of like the way Manchester modulates on top of clock 
 The bit rate of resulting signal much lower than entire channel 
 Receiver applies code filter to extract desired sender 
 All other senders seem like noise with respect to signal 
 Used in some newer digital cellular technologies 
(Verizon/Sprint US Cellular)
Partitioning Visualization 
FDMA 
TDMA 
CDMA 
power 
power 
power 
Courtesy Takashi Inoue 
7
Problem w/Channel partitioning 
 Not terribly well suited for random access usage 
 Why? 
 Instead, design schemes for more common situations 
 Not all nodes want to send all the time 
 Don’t have a fixed number of nodes 
 Potentially higher throughput for transmissions 
 Active nodes get full channel bandwidth 
8
Aloha 
 Designed in 1970 to support wireless data connectivity 
 Between Hawaiian Islands—rough! 
 Goal: distributed access control (no central arbitrator) 
 Over a shared broadcast channel 
 Aloha protocol in a nutshell: 
 When you have data send it 
 If data doesn’t get through (receiver sends acknowledgement) 
then retransmit after a random delay 
 Why not a fixed delay? 
9
Collisions 
 Frame sent at t0 collides with frames sent in [t0-1, t0+1] 
 Assuming unit-length frames 
 Ignores propagation delay 
10
Slotted Aloha 
 Time is divided into equal size slots (frame size) 
 Host wanting to transmit starts at start of next slot 
 Retransmit like w/Aloha, but quantize to nearest next slot 
 Requires time synchronization between hosts 
Success (S), Collision (C), Empty (E) slots 
11
Q: What is max fraction slots successful? 
A: Suppose n stations have packets to send 
 Each transmits in slot with probability p 
 Prob[successful transmission], S, is: 
S = p (1-p)(n-1) 
 any of n nodes: 
S = Prob[one transmits] = np(1-p)(n-1) 
(optimal p as n->infinity = 1/n) 
= 1/e = .37 
At best: channel 
used for useful 
transmissions 37% 
of time! 
0.5 1.0 1.5 2.0 
offered load = n X p 
0.4 
0.3 
0.2 
0.1 
Slotted Aloha 
Pure Aloha 
Channel Efficiency 
12
 Aloha transmits even if another host is transmitting 
 Thus guaranteeing a collision 
 Instead, listen first to make sure channel is idle 
 Useful only if channel is frequently idle 
 Why? 
 Listen how long to be confident channel is idle? 
 Depends on maximum propagation delay 
 Small (<<1 frame length) for LANs 
 Large (>>1 frame length) for satellites 
13 
Carrier Sense (CSMA)
Retransmission Options 
 non-persistent CSMA 
 Give up, or send after some random delay 
 Problem: may incur larger delay when channel is idle 
 1-persistent CSMA 
 Send as soon as channel is idle 
 Problem: blocked senders all try to send at once 
 P-persistent CSMA 
 If idle, send packet with probability p; repeat 
 Make sure (p * n) < 1 
CSE 123 – Lecture 6: Media Access Control 14
 Even with CSMA there can still be collisions. Why? 
Time for B to detect A’s transmission 
X 
collision 
(wire) 
A B 
 If nodes can detect collisions, abort! (CSMA/CD) 
 Requires a minimum frame size (“acquiring the medium”) 
 B must continue sending (“jam”) until A detects collision 
 Requires a full duplex channel 
 Aside: wireless is typically half duplex; need an alternative for 
wireless channels (we’ll return to this) 
15 
Jamming
 How can A know that a collision has taken place? 
 Worst case: 
» Latency between nodes A & B is d 
» A sends a message at time t and B sends a message at t + d – epsilon 
(i.e., just before receiving A’s message) 
 B knows there is a collision, but not A… B must keep transmitting so A 
knows that its packet has collided 
 How long? 2 * d (keep talking until you know everyone has heard it) 
 IEEE 802.3 Ethernet specifies max value of 2d to be 51.2us 
 This relates to maximum distance of 2500m between hosts 
 At 10Mbps it takes 0.1us to transmit one bit so 512 bits take 51.2us to send 
 So, Ethernet frames must be at least 64B (512 bits) long 
» Padding is used if data is too small 
 Transmit jamming signal to insure all hosts see collision 
 48 bit times sufficient 
16 
Collision Detection
Ethernet 
 First local area network (LAN) 
 Developed in early ’70s by Metcalfe and Boggs at PARC 
 Originally 1Mbps, now supports 10Mbps, 100Mbps, 1Gbps 
and 10Gbps flavors (40/100G in development) 
 Currently the dominant LAN technology 
 Becoming the dominant WAN technology 
17
Classic Ethernet 
 IEEE 802.3 standard wired LAN 
(modified 1-persistent CSMA/CD) 
 Classic Ethernet: 10 Mbps over coaxial cable 
 All nodes share same physical wire 
 Max length 2.5km, max between stations 500m 
 Framing 
nodes 
(wire) 
 Preamble, 32-bit CRC, variable length data 
 Unique 48-bit address per host (bcast & multicast addrs too) 
Preamble (8) Source (6) Dest (6) Len (2) Payload (var) Pad (var) CRC (4) 
18
Ethernet improvements 
 Problems with random delay with fixed mean 
 Few senders = unnecessary delay 
 Many senders = unnecessary collisions 
 Binary exponential back-off balances delay w/load 
 First collision: wait 0 or 1 min frame times at random, retry 
 Second time: wait 0, 1, 2, or 3 times 
 Nth time (n<=10): wait 0, 1, …, 2n-1 times 
 Max wait 1023 frames; give up after 16 attempts 
19
Capture Effect 
 Randomized access scheme is not fair 
 Suppose stations A and B always have data to send 
 They will collide at some time 
 Both pick random number of “slots” (0, 1) to wait 
 Suppose A wins and sends 
 Next time the collide, B’s chance of winning is halved 
» B will select from 0,1,2,3 due to exponential back-off 
 A keeps winning: said to have captured the channel 
20
Ethernet Performance 
 Much better than Aloha or CSMA in practice 
 Source of protocol inefficiency: collisions 
 More efficient to send larger frames 
» Acquire the medium and send lots of data 
» Less time on arbitration (figuring out who gets to send) 
 Less efficient if 
» More hosts – more collisions needed to identify single sender 
» Smaller packet sizes – more frequent arbitration 
» Longer links – collisions take longer to observe, more wasted 
bandwidth 
21
Contention-free Protocols 
 Problem with channel partitioning 
 Inefficient at low load (idle subchannels) 
 Problem with contention-based protocols 
 Inefficient at high load (collisions) 
 Contention-free protocols 
 Try to do both by explicitly taking turns 
 Can potentially also offer guaranteed bandwidth, latency, etc.
Two contention-free approaches 
Polling 
 Master node “invites” slave 
nodes to transmit in turn 
 Request to Send (RTS), Clear 
to Send (CTS) messages 
 Problems: 
 Polling overhead 
 Latency 
 Single point of failure (master) 
Token Passing 
 Control token passed from one 
node to next sequentially. 
 Point-to-point links can be fast 
 Problems: 
 Token overhead 
 Latency 
 Single point of failure (token)
Token Ring (802.5) 
C B 
D 
A 
nodes 
Direction of 
transmission 
 Token rotates permission to send around ring of nodes 
 Sender injects packet into ring and removes later 
 Maximum token holding time (THT) bounds access time 
 Early or delayed token release 
 Round robin service, acknowledgments and priorities 
 Monitor nodes ensure health of ring (alerts on failures) 
SD 
(1) 
AC 
(1) 
FC 
(1) 
Destination 
Address (6) 
Source 
Address (6) Data Checksum 
(4) 
ED 
(1) 
FS 
(1)
FDDI 
(Fiber Distributed Data Interface) 
 Roughly a large, fast token ring 
 100 Mbps and 200km vs 4/16 Mbps and local 
 Dual counter-rotating rings for redundancy 
 Complex token holding policies for voice etc. traffic 
 Token ring advantages 
 No contention, bounded access delay 
 Support fair, reserved, priority access 
 Disadvantages 
 Complexity, reliability, scalability 
Break!
Why Did Ethernet Win? 
 Failure modes 
 Token rings – network unusable 
 Ethernet – single node detached 
 Good performance in common case 
 Completely distributed, easy to maintain/administer 
 Easy incremental deployment 
 Volume  lower cost  higher volume …. 
26
Wireless Media Access 
Wireless is more complicated than wired … 
 Cannot detect collisions 
 Transmitter swamps co-located receiver 
 Collision avoidance 
 Different transmitters have different coverage areas 
 Asymmetries lead to hidden/exposed terminal problems 
» Just because A is talking to B, doesn’t mean that C can’t talk to D 
» A is aware of B and B is aware of C, but A and C are unaware of 
each other (they are hidden nodes). Both will send to B and frames 
will collide at B without A or C realizing 
 Also can use contention-free protocols (RTS/CTS)
Hidden Terminals 
A B C 
transmit range 
 A and C can both send to B but can’t hear each other 
 A is a hidden terminal for C and vice versa 
 Packets will collide at B and create interference 
 CSMA will be ineffective – want to sense at receiver
Exposed Terminals 
A B C 
D 
transmit range 
 B, C can hear each other but can safely send to A, D 
 B and C won’t transmit, when they should
CSMA with Collision Avoidance 
(CSMA/CA) 
 Since we can’t detect collisions, we try to avoid them 
 When medium busy, choose random interval 
(contention window) 
 Wait for that many idle timeslots to pass before sending 
 Remember p-persistence … a refinement 
 When a collision is inferred, retransmit with binary 
exponential backoff (like Ethernet) 
 Use ACK from receiver to infer “no collision” 
 Again, exponential backoff helps us adapt “p” as needed 
 CSMA/CA vs. CSMA/CD 
 In CSMA/CA, backoff before collision 
 In CSMA/CD, backoff after collision
RTS / CTS Protocols (MACA) 
RTS 
CTS 
B C D 
A 
Overcome exposed/hidden terminal problems with 
contention-free protocol 
1. B stimulates C with Request To Send (RTS) packet 
2. A hears RTS and defers to allow the CTS 
3. C replies to B with Clear To Send (CTS) 
4. D hears CTS and defers to allow the data 
5. B sends to C
IEEE 802.11 Wireless LAN 
 802.11b 
 2.4-5 GHz unlicensed 
radio spectrum 
 up to 11 Mbps 
 direct sequence spread 
spectrum (DSSS) in 
physical layer 
» All hosts use same code 
 Widely deployed, using 
base stations 
 802.11a 
 5-6 GHz range 
 up to 54 Mbps 
 802.11g 
 2.4-5 GHz range 
 up to 54 Mbps 
 All use CSMA/CA for 
multiple access 
 Optional RTS/CTS 
 All have base-station and 
ad-hoc network versions
IEEE 802.11 Wireless LAN 
 Wireless host communicates with a base station 
 Base station = access point (AP) 
 Basic Service Set (BSS) (a.k.a. “cell”) contains: 
 Wireless hosts 
 Access point (AP): base station 
 BSS’s combined to form distribution system (DS)
802.11 Twists 
 How to support different speeds on same channel? 
 Physical layer header encoded at lowest bitrate and indicates 
bitrate of rest of packet 
 Network Allocation Vector (NAV) 
 Each frame contains field that indicates the amount of time 
that will be used for the communication (channel reservation) 
 All receivers defer transmit for that time 
 Allows for long or multi-frame exchange
Misc issue: 
Addressing Alternatives 
 On a broadcast channel all nodes receive all packets 
 Addressing determines which packets are kept and which 
packets are thrown away 
 Packets can be sent to: 
» Unicast – one destination 
» Multicast – group of nodes (e.g. “everyone playing WoW”) 
» Broadcast – everybody on wire 
 Dynamic addresses (e.g. Appletalk) 
 Pick an address at random 
 Broadcast “is anyone using address XX?” 
 If yes, repeat 
 Static address (e.g. Ethernet, 802.11, TokenRing, etc)
IEEE addressing (Ethernet, etc) 
 Addresses: 6 bytes (48 bits) 
 Each adapter is given a globally unique address at 
manufacturing time 
» Address space is allocated to manufacturers 
 24 bits identify manufacturer 
 E.g., 0:0:15:*  3com adapter 
» Frame is received by all adapters on a LAN and dropped if 
address does not match 
 Special addresses 
» Broadcast – FF:FF:FF:FF:FF:FF is “everybody” 
» Range of addresses allocated to multicast 
 Adapter maintains list of multicast groups node is interested in 
 Practical problems: non-unique addresses
Summary 
 Ways to share a channel 
 Subdivide the channel into subchannels 
 Contention-based protocols 
» Try and retry if it fails 
 Contention-free protocols 
» Explicit control over who gets to send at each time 
 Particular issues for wireless 
 Hidden/exposed terminal problems 
 Addressing 
 For next time: bridging/switching, read P&D 3-1-3.2, 
3.1

More Related Content

What's hot (20)

Time Division Multiplexing
Time Division MultiplexingTime Division Multiplexing
Time Division Multiplexing
 
Multiple Access in wireless communication
Multiple Access in wireless communicationMultiple Access in wireless communication
Multiple Access in wireless communication
 
Multiplexing, fdma,tdma,cdma
Multiplexing, fdma,tdma,cdmaMultiplexing, fdma,tdma,cdma
Multiplexing, fdma,tdma,cdma
 
Medium Access PROTOCOL b yENGR. FAWAD KHAN UET BANNU KP PAKISTAN
Medium Access PROTOCOL b yENGR.  FAWAD KHAN UET BANNU KP PAKISTANMedium Access PROTOCOL b yENGR.  FAWAD KHAN UET BANNU KP PAKISTAN
Medium Access PROTOCOL b yENGR. FAWAD KHAN UET BANNU KP PAKISTAN
 
Mac sub layer
Mac sub layerMac sub layer
Mac sub layer
 
Common protocols
Common protocolsCommon protocols
Common protocols
 
10 high speedla-ns
10 high speedla-ns10 high speedla-ns
10 high speedla-ns
 
Packet radio protocol
Packet radio protocolPacket radio protocol
Packet radio protocol
 
08 multiplexing
08 multiplexing08 multiplexing
08 multiplexing
 
03 time division-multiplexing
03 time division-multiplexing03 time division-multiplexing
03 time division-multiplexing
 
clas 8
clas 8clas 8
clas 8
 
MEDIUM ACCESS CONTROL
MEDIUM ACCESS CONTROLMEDIUM ACCESS CONTROL
MEDIUM ACCESS CONTROL
 
aloha
alohaaloha
aloha
 
07 data linkcontrol
07 data linkcontrol07 data linkcontrol
07 data linkcontrol
 
Lect21 09-11
Lect21 09-11Lect21 09-11
Lect21 09-11
 
multiplexing
 multiplexing multiplexing
multiplexing
 
Snooping TCP
Snooping TCPSnooping TCP
Snooping TCP
 
TDMA, FDMA, and CDMA
TDMA, FDMA, and CDMATDMA, FDMA, and CDMA
TDMA, FDMA, and CDMA
 
Multiple access techniques for wireless communications
Multiple access techniques for wireless communicationsMultiple access techniques for wireless communications
Multiple access techniques for wireless communications
 
Multiple Access Techniques
Multiple Access TechniquesMultiple Access Techniques
Multiple Access Techniques
 

Similar to Mac

Similar to Mac (20)

Direct Link Lan
Direct Link LanDirect Link Lan
Direct Link Lan
 
F06_Lecture7_etherne..
F06_Lecture7_etherne..F06_Lecture7_etherne..
F06_Lecture7_etherne..
 
Media Access Control
Media Access ControlMedia Access Control
Media Access Control
 
Network Topologies
Network TopologiesNetwork Topologies
Network Topologies
 
Mac
MacMac
Mac
 
wireless.ppt
wireless.pptwireless.ppt
wireless.ppt
 
16 high speedla-ns
16 high speedla-ns16 high speedla-ns
16 high speedla-ns
 
16 high speedla-ns
16 high speedla-ns16 high speedla-ns
16 high speedla-ns
 
Ethernet
EthernetEthernet
Ethernet
 
Chapter_03_Data Link Layer and its protocols.pptx
Chapter_03_Data Link Layer and its protocols.pptxChapter_03_Data Link Layer and its protocols.pptx
Chapter_03_Data Link Layer and its protocols.pptx
 
MAC.ppt
MAC.pptMAC.ppt
MAC.ppt
 
MAC.ppt
MAC.pptMAC.ppt
MAC.ppt
 
Lan
LanLan
Lan
 
Mod9
Mod9Mod9
Mod9
 
Week15 lec1
Week15 lec1Week15 lec1
Week15 lec1
 
MEDIUM ACCESS CONTROL Sublayer IN CN.ppt
MEDIUM ACCESS CONTROL Sublayer IN CN.pptMEDIUM ACCESS CONTROL Sublayer IN CN.ppt
MEDIUM ACCESS CONTROL Sublayer IN CN.ppt
 
3-MACSublayer.ppt
3-MACSublayer.ppt3-MACSublayer.ppt
3-MACSublayer.ppt
 
CS6551 COMPUTER NETWORKS
CS6551 COMPUTER NETWORKSCS6551 COMPUTER NETWORKS
CS6551 COMPUTER NETWORKS
 
Multiple Access Protocal
Multiple Access ProtocalMultiple Access Protocal
Multiple Access Protocal
 
Unit-2 Media Access Protocols.pdf
Unit-2 Media Access Protocols.pdfUnit-2 Media Access Protocols.pdf
Unit-2 Media Access Protocols.pdf
 

More from Nitesh Singh

More from Nitesh Singh (20)

Risk taking and emotions
Risk taking and emotionsRisk taking and emotions
Risk taking and emotions
 
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SADProject report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
 
The real comedy behind comedy
The real comedy behind comedyThe real comedy behind comedy
The real comedy behind comedy
 
Project report Rs Dry celaners
Project report Rs Dry celaners Project report Rs Dry celaners
Project report Rs Dry celaners
 
BIG DATA ANALYSIS
BIG DATA ANALYSISBIG DATA ANALYSIS
BIG DATA ANALYSIS
 
Udp vs-tcp
Udp vs-tcpUdp vs-tcp
Udp vs-tcp
 
Routing protocols-network-layer
Routing protocols-network-layerRouting protocols-network-layer
Routing protocols-network-layer
 
Routers vs-switch
Routers vs-switchRouters vs-switch
Routers vs-switch
 
New udp
New udpNew udp
New udp
 
I pv4 format
I pv4 formatI pv4 format
I pv4 format
 
I pv4 addressing
I pv4 addressingI pv4 addressing
I pv4 addressing
 
Hub vs-switch
Hub vs-switchHub vs-switch
Hub vs-switch
 
Ftp
FtpFtp
Ftp
 
Email ftp
Email ftpEmail ftp
Email ftp
 
Www and http
Www and httpWww and http
Www and http
 
Transmission main
Transmission mainTransmission main
Transmission main
 
Ta 104-topology
Ta 104-topologyTa 104-topology
Ta 104-topology
 
Ta 104-topology (1)
Ta 104-topology (1)Ta 104-topology (1)
Ta 104-topology (1)
 
Ta 104-tcp
Ta 104-tcpTa 104-tcp
Ta 104-tcp
 
Ta 104-media-3
Ta 104-media-3Ta 104-media-3
Ta 104-media-3
 

Mac

  • 1. CSE 123: Computer Networks Stefan Savage Lecture 6: Media Access Control
  • 2. Today: Media access  How to share a channel among different hosts?  Channel partitioning  FDMA (frequency division multiple access)  TDMA (time division multiple access)  CDMA (code division multiple access)  Random access  Contention-based » Aloha » CSMA, CSMA/CD, CSMA/CA » Ethernet, 802.11  Contention-free » Token-ring, FDDI
  • 3. Channel Partitioning  Need to share media with multiple nodes (n)  Multiple simultaneous conversations  A simple solution  Divide the channel into multiple, separate channels  Channels are completely separate  Bitrate of the channel is split across channels  Nodes can only send/receive on their assigned channel  Several different ways to do it… 3
  • 4.  Divide bandwidth of f Hz into n channels each with bandwidth f/n Hz  Easy to implement, but unused subchannels go idle » Also need “guard bands” between channels to prevent interference  Used by traditional analog cell phone service, radio, TV Amplitude Frequency Amplitude Frequency 4 Frequency Division (FDMA)
  • 5.  Divide channel into rounds of n time slots each  Assign different hosts to different time slots within a round  Unused time slots are idle  Used in GSM cell phones & digital cordless phones  Example with 1-second rounds  n=4 timeslots (250ms each) per round Host # 1 2 3 1 2 3 4 2 4 1 sec 1 sec 1 sec 5 Time Division (TDMA)
  • 6. 6 Code Division (CDMA)  Do nothing to physically separate the channels  All stations transmit at same time in same frequency bands  One of so-called spread-spectrum techniques  Sender modulates their signal on top of unique code  Sort of like the way Manchester modulates on top of clock  The bit rate of resulting signal much lower than entire channel  Receiver applies code filter to extract desired sender  All other senders seem like noise with respect to signal  Used in some newer digital cellular technologies (Verizon/Sprint US Cellular)
  • 7. Partitioning Visualization FDMA TDMA CDMA power power power Courtesy Takashi Inoue 7
  • 8. Problem w/Channel partitioning  Not terribly well suited for random access usage  Why?  Instead, design schemes for more common situations  Not all nodes want to send all the time  Don’t have a fixed number of nodes  Potentially higher throughput for transmissions  Active nodes get full channel bandwidth 8
  • 9. Aloha  Designed in 1970 to support wireless data connectivity  Between Hawaiian Islands—rough!  Goal: distributed access control (no central arbitrator)  Over a shared broadcast channel  Aloha protocol in a nutshell:  When you have data send it  If data doesn’t get through (receiver sends acknowledgement) then retransmit after a random delay  Why not a fixed delay? 9
  • 10. Collisions  Frame sent at t0 collides with frames sent in [t0-1, t0+1]  Assuming unit-length frames  Ignores propagation delay 10
  • 11. Slotted Aloha  Time is divided into equal size slots (frame size)  Host wanting to transmit starts at start of next slot  Retransmit like w/Aloha, but quantize to nearest next slot  Requires time synchronization between hosts Success (S), Collision (C), Empty (E) slots 11
  • 12. Q: What is max fraction slots successful? A: Suppose n stations have packets to send  Each transmits in slot with probability p  Prob[successful transmission], S, is: S = p (1-p)(n-1)  any of n nodes: S = Prob[one transmits] = np(1-p)(n-1) (optimal p as n->infinity = 1/n) = 1/e = .37 At best: channel used for useful transmissions 37% of time! 0.5 1.0 1.5 2.0 offered load = n X p 0.4 0.3 0.2 0.1 Slotted Aloha Pure Aloha Channel Efficiency 12
  • 13.  Aloha transmits even if another host is transmitting  Thus guaranteeing a collision  Instead, listen first to make sure channel is idle  Useful only if channel is frequently idle  Why?  Listen how long to be confident channel is idle?  Depends on maximum propagation delay  Small (<<1 frame length) for LANs  Large (>>1 frame length) for satellites 13 Carrier Sense (CSMA)
  • 14. Retransmission Options  non-persistent CSMA  Give up, or send after some random delay  Problem: may incur larger delay when channel is idle  1-persistent CSMA  Send as soon as channel is idle  Problem: blocked senders all try to send at once  P-persistent CSMA  If idle, send packet with probability p; repeat  Make sure (p * n) < 1 CSE 123 – Lecture 6: Media Access Control 14
  • 15.  Even with CSMA there can still be collisions. Why? Time for B to detect A’s transmission X collision (wire) A B  If nodes can detect collisions, abort! (CSMA/CD)  Requires a minimum frame size (“acquiring the medium”)  B must continue sending (“jam”) until A detects collision  Requires a full duplex channel  Aside: wireless is typically half duplex; need an alternative for wireless channels (we’ll return to this) 15 Jamming
  • 16.  How can A know that a collision has taken place?  Worst case: » Latency between nodes A & B is d » A sends a message at time t and B sends a message at t + d – epsilon (i.e., just before receiving A’s message)  B knows there is a collision, but not A… B must keep transmitting so A knows that its packet has collided  How long? 2 * d (keep talking until you know everyone has heard it)  IEEE 802.3 Ethernet specifies max value of 2d to be 51.2us  This relates to maximum distance of 2500m between hosts  At 10Mbps it takes 0.1us to transmit one bit so 512 bits take 51.2us to send  So, Ethernet frames must be at least 64B (512 bits) long » Padding is used if data is too small  Transmit jamming signal to insure all hosts see collision  48 bit times sufficient 16 Collision Detection
  • 17. Ethernet  First local area network (LAN)  Developed in early ’70s by Metcalfe and Boggs at PARC  Originally 1Mbps, now supports 10Mbps, 100Mbps, 1Gbps and 10Gbps flavors (40/100G in development)  Currently the dominant LAN technology  Becoming the dominant WAN technology 17
  • 18. Classic Ethernet  IEEE 802.3 standard wired LAN (modified 1-persistent CSMA/CD)  Classic Ethernet: 10 Mbps over coaxial cable  All nodes share same physical wire  Max length 2.5km, max between stations 500m  Framing nodes (wire)  Preamble, 32-bit CRC, variable length data  Unique 48-bit address per host (bcast & multicast addrs too) Preamble (8) Source (6) Dest (6) Len (2) Payload (var) Pad (var) CRC (4) 18
  • 19. Ethernet improvements  Problems with random delay with fixed mean  Few senders = unnecessary delay  Many senders = unnecessary collisions  Binary exponential back-off balances delay w/load  First collision: wait 0 or 1 min frame times at random, retry  Second time: wait 0, 1, 2, or 3 times  Nth time (n<=10): wait 0, 1, …, 2n-1 times  Max wait 1023 frames; give up after 16 attempts 19
  • 20. Capture Effect  Randomized access scheme is not fair  Suppose stations A and B always have data to send  They will collide at some time  Both pick random number of “slots” (0, 1) to wait  Suppose A wins and sends  Next time the collide, B’s chance of winning is halved » B will select from 0,1,2,3 due to exponential back-off  A keeps winning: said to have captured the channel 20
  • 21. Ethernet Performance  Much better than Aloha or CSMA in practice  Source of protocol inefficiency: collisions  More efficient to send larger frames » Acquire the medium and send lots of data » Less time on arbitration (figuring out who gets to send)  Less efficient if » More hosts – more collisions needed to identify single sender » Smaller packet sizes – more frequent arbitration » Longer links – collisions take longer to observe, more wasted bandwidth 21
  • 22. Contention-free Protocols  Problem with channel partitioning  Inefficient at low load (idle subchannels)  Problem with contention-based protocols  Inefficient at high load (collisions)  Contention-free protocols  Try to do both by explicitly taking turns  Can potentially also offer guaranteed bandwidth, latency, etc.
  • 23. Two contention-free approaches Polling  Master node “invites” slave nodes to transmit in turn  Request to Send (RTS), Clear to Send (CTS) messages  Problems:  Polling overhead  Latency  Single point of failure (master) Token Passing  Control token passed from one node to next sequentially.  Point-to-point links can be fast  Problems:  Token overhead  Latency  Single point of failure (token)
  • 24. Token Ring (802.5) C B D A nodes Direction of transmission  Token rotates permission to send around ring of nodes  Sender injects packet into ring and removes later  Maximum token holding time (THT) bounds access time  Early or delayed token release  Round robin service, acknowledgments and priorities  Monitor nodes ensure health of ring (alerts on failures) SD (1) AC (1) FC (1) Destination Address (6) Source Address (6) Data Checksum (4) ED (1) FS (1)
  • 25. FDDI (Fiber Distributed Data Interface)  Roughly a large, fast token ring  100 Mbps and 200km vs 4/16 Mbps and local  Dual counter-rotating rings for redundancy  Complex token holding policies for voice etc. traffic  Token ring advantages  No contention, bounded access delay  Support fair, reserved, priority access  Disadvantages  Complexity, reliability, scalability Break!
  • 26. Why Did Ethernet Win?  Failure modes  Token rings – network unusable  Ethernet – single node detached  Good performance in common case  Completely distributed, easy to maintain/administer  Easy incremental deployment  Volume  lower cost  higher volume …. 26
  • 27. Wireless Media Access Wireless is more complicated than wired …  Cannot detect collisions  Transmitter swamps co-located receiver  Collision avoidance  Different transmitters have different coverage areas  Asymmetries lead to hidden/exposed terminal problems » Just because A is talking to B, doesn’t mean that C can’t talk to D » A is aware of B and B is aware of C, but A and C are unaware of each other (they are hidden nodes). Both will send to B and frames will collide at B without A or C realizing  Also can use contention-free protocols (RTS/CTS)
  • 28. Hidden Terminals A B C transmit range  A and C can both send to B but can’t hear each other  A is a hidden terminal for C and vice versa  Packets will collide at B and create interference  CSMA will be ineffective – want to sense at receiver
  • 29. Exposed Terminals A B C D transmit range  B, C can hear each other but can safely send to A, D  B and C won’t transmit, when they should
  • 30. CSMA with Collision Avoidance (CSMA/CA)  Since we can’t detect collisions, we try to avoid them  When medium busy, choose random interval (contention window)  Wait for that many idle timeslots to pass before sending  Remember p-persistence … a refinement  When a collision is inferred, retransmit with binary exponential backoff (like Ethernet)  Use ACK from receiver to infer “no collision”  Again, exponential backoff helps us adapt “p” as needed  CSMA/CA vs. CSMA/CD  In CSMA/CA, backoff before collision  In CSMA/CD, backoff after collision
  • 31. RTS / CTS Protocols (MACA) RTS CTS B C D A Overcome exposed/hidden terminal problems with contention-free protocol 1. B stimulates C with Request To Send (RTS) packet 2. A hears RTS and defers to allow the CTS 3. C replies to B with Clear To Send (CTS) 4. D hears CTS and defers to allow the data 5. B sends to C
  • 32. IEEE 802.11 Wireless LAN  802.11b  2.4-5 GHz unlicensed radio spectrum  up to 11 Mbps  direct sequence spread spectrum (DSSS) in physical layer » All hosts use same code  Widely deployed, using base stations  802.11a  5-6 GHz range  up to 54 Mbps  802.11g  2.4-5 GHz range  up to 54 Mbps  All use CSMA/CA for multiple access  Optional RTS/CTS  All have base-station and ad-hoc network versions
  • 33. IEEE 802.11 Wireless LAN  Wireless host communicates with a base station  Base station = access point (AP)  Basic Service Set (BSS) (a.k.a. “cell”) contains:  Wireless hosts  Access point (AP): base station  BSS’s combined to form distribution system (DS)
  • 34. 802.11 Twists  How to support different speeds on same channel?  Physical layer header encoded at lowest bitrate and indicates bitrate of rest of packet  Network Allocation Vector (NAV)  Each frame contains field that indicates the amount of time that will be used for the communication (channel reservation)  All receivers defer transmit for that time  Allows for long or multi-frame exchange
  • 35. Misc issue: Addressing Alternatives  On a broadcast channel all nodes receive all packets  Addressing determines which packets are kept and which packets are thrown away  Packets can be sent to: » Unicast – one destination » Multicast – group of nodes (e.g. “everyone playing WoW”) » Broadcast – everybody on wire  Dynamic addresses (e.g. Appletalk)  Pick an address at random  Broadcast “is anyone using address XX?”  If yes, repeat  Static address (e.g. Ethernet, 802.11, TokenRing, etc)
  • 36. IEEE addressing (Ethernet, etc)  Addresses: 6 bytes (48 bits)  Each adapter is given a globally unique address at manufacturing time » Address space is allocated to manufacturers  24 bits identify manufacturer  E.g., 0:0:15:*  3com adapter » Frame is received by all adapters on a LAN and dropped if address does not match  Special addresses » Broadcast – FF:FF:FF:FF:FF:FF is “everybody” » Range of addresses allocated to multicast  Adapter maintains list of multicast groups node is interested in  Practical problems: non-unique addresses
  • 37. Summary  Ways to share a channel  Subdivide the channel into subchannels  Contention-based protocols » Try and retry if it fails  Contention-free protocols » Explicit control over who gets to send at each time  Particular issues for wireless  Hidden/exposed terminal problems  Addressing  For next time: bridging/switching, read P&D 3-1-3.2, 3.1