COMP 3331/9331: Computer Networks and Applications Week 10 Data Reading Guide: Chapter 5, Sections 5.3
Assignment 1: Marking issues v Almost 150 submissions (>40%) could not be run due to: Submission issues (submission not recorded, incorrect code submitted, etc.) Archiving issues (how hard is it to tar files?) Compilation errors Issues with command line arguments Hard coding port numbers, etc. code Code did not run (crashed, seg faults, etc.) v This is UNACCEPTABLE v For the second assignment if we encounter such errors, your assignment will NOT be marked 2
Link layer, LANs: outline 5.1 introduction, services 5.2 error detection, correction 5.3 multiple access protocols 5.4 LANs addressing, ARP Ethernet switches 5.7 a day in the life of a web request 3
Multiple access links, protocols two types of links : v point-to-point PPP for dial-up access point-to-point link between Ethernet switch, host v broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 802.11 wireless LAN shared wire (e.g., cabled Ethernet) shared RF (e.g., 802.11 WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical) 4
Multiple access protocols v single shared broadcast channel v two or more simultaneous transmissions by nodes: interference collision if node receives two or more signals at the same time multiple access protocol v distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit v communication about channel sharing must use channel itself! no out-of-band channel for coordination 5
An ideal multiple access protocol given: broadcast channel of rate R bps desiderata: 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can send at average rate R/M 3. fully decentralized: no special node to coordinate transmissions no synchronization of clocks, slots 4. simple 6
MAC protocols: taxonomy three broad classes: v channel partitioning divide channel into smaller pieces (time slots, frequency, code) allocate piece to node for exclusive use v random access channel not divided, allow collisions recover from collisions v taking turns nodes take turns, but nodes with more to send can take longer turns 7
Channel partitioning MAC protocols: TDMA TDMA: time division multiple access v access to channel in "rounds" v each station gets fixed length slot (length = pkt trans time) in each round v unused slots go idle v example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle 6-slot frame 6-slot frame 1 3 4 1 3 4 8
Channel partitioning MAC protocols: FDMA FDMA: frequency division multiple access v channel spectrum divided into frequency bands v each station assigned fixed frequency band v unused transmission time in frequency bands go idle v example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle time FDM cable frequency bands 9
Quiz: Does channel partitioning satisfy ideal properties? 1. if only one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can send at average rate R/M (fairness) 3. fully decentralized: no synchronization of clocks, slots no special node to coordinate transmissions 4. simple A. 0 B. 1 C. 2 D. 3 E. 4 (Which ones?) 10
Random access protocols v when node has packet to send transmit at full channel data rate R. no a priori coordination among nodes v two or more transmitting nodes collision, v random access MAC protocol specifies: how to detect collisions how to recover from collisions (e.g., via delayed retransmissions) v examples of random access MAC protocols: slotted ALOHA ALOHA CSMA, CSMA/CD, CSMA/CA 11
Where it all Started: AlohaNet v Norm Abramson left Stanford in 1970 (so he could surf!) v Set up first data communication system for Hawaiian islands v Central hub at U. Hawaii, Oahu
Slotted ALOHA assumptions: v all frames same size v time divided into equal size slots (time to transmit 1 frame) v nodes start to transmit only slot beginning v nodes are synchronized v if 2 or more nodes transmit in slot, all nodes detect collision operation: v when node obtains fresh frame, transmits in next slot if no collision: node can send new frame in next slot if collision: node retransmits frame in each subsequent slot with prob. p until success 13
Slotted ALOHA node 1 1 1 1 1 node 2 2 2 2 node 3 3 3 3 Pros: C E C S E C E S S v single active node can continuously transmit at full rate of channel v highly decentralized: only slots in nodes need to be in sync v simple Cons: v collisions, wasting slots v idle slots v nodes may be able to detect collision in less than time to transmit packet v clock synchronization 14
Slotted ALOHA: efficiency efficiency: long-run fraction of successful slots (many nodes, all with many frames to send) v suppose: N nodes with many frames to send, each transmits in slot with probability p v prob that given node has success in a slot = p(1- p) N-1 v prob that any node has a success = Np(1-p) N-1 v max efficiency: find p* that maximizes Np(1-p) N-1 v for many nodes, take limit of Np*(1-p*) N-1 as N goes to infinity, gives: max efficiency = 1/e =.37 at best: channel used for useful transmissions 37% of time!! 15
Pure (unslotted) ALOHA v unslotted Aloha: simpler, no synchronization v when frame first arrives transmit immediately v collision probability increases: frame sent at t 0 collides with other frames sent in [t 0-1,t 0 +1] 16
Pure ALOHA efficiency P(success by given node) = P(node transmits). P(no other node transmits in [t 0-1,t 0 ]. P(no other node transmits in [t 0-1,t 0 ] = p. (1-p) N-1. (1-p) N-1 = p. (1-p) 2(N-1) choosing optimum p and then letting n = 1/(2e) =.18 even worse than slotted Aloha! 17
CSMA (carrier sense multiple access) CSMA: listen before transmit: if channel sensed idle: transmit entire frame v if channel sensed busy, defer transmission v human analogy: don t interrupt others! v Does this eliminate all collisions? No, because of nonzero propagation delay 18
CSMA collisions spatial layout of nodes v collisions can still occur: propagation delay means two nodes may not hear each other s transmission v collision: entire packet transmission time wasted distance & propagation delay play role in in determining collision probability CSMA reduces but does not eliminate collisions Biggest remaining problem? Collisions still take full slot! 19
CSMA/CD (collision detection) CSMA/CD: carrier sensing, deferral as in CSMA collisions detected within short time colliding transmissions aborted, reducing channel wastage v collision detection: easy in wired LANs: measure signal strengths, compare transmitted, received signals difficult in wireless LANs: received signal strength overwhelmed by local transmission strength v human analogy: the polite conversationalist 20
CSMA/CD (collision detection) Note: for this to work, need restrictions on minimum frame size and maximum distance. spatial layout of nodes Why? http://media.pearsoncmg.com/aw/aw_kurose_network_2/applets/csmacd/csmacd.html 21
Ethernet CSMA/CD 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: after mth collision, NIC chooses K at random from {0,1,2,, 2 m -1}. NIC waits K 512 bit times, returns to Step 2 longer backoff interval with more collisions 22
Minimum Packet Size v Why enforce a minimum packet size? v Give a host enough time to detect collisions v In Ethernet, minimum packet size = 64 bytes (two 6-byte addresses, 2-byte type, 4-byte CRC, and 46 bytes of data) v If host has less than 46 bytes to send, the adaptor pads (adds) bytes to make it 46 bytes v What is the relationship between minimum packet size and the length of the LAN? 23
Limits on CSMA/CD Network Length a) Time = t; Host 1 starts to send frame Host 1 Host 2 propagation delay (d) b) Time = t + d; Host 2 starts to send a frame, just before it hears from host 1 s frame c) Time = t + 2*d; Host 1 hears Host 2 s frame à detects collision Host 1 Host 2 propagation delay (d) Host 1 Host 2 propagation delay (d) LAN length = (min_frame_size)*(propagation_speed)/(2*bandwidth) = = (8*64b)*(2*10 8 mps)/(2*10 7 bps) = 5120m approx What about 100 mbps? 1 gbps? 10 gbps? 24
Performance of CSMA/CD v Time wasted in collisions Proportional to distance d v Time spend transmitting a packet Packet length p divided by bandwidth b v Rough estimate for efficiency (K some constant) v Note: For large packets, small distances, E ~ 1 As bandwidth increases, E decreases That is why high-speed LANs are all switched 25
Quiz: Does CSMA/CD satisfy ideal properties? 1. if only one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can send at average rate R/M (fairness) 3. fully decentralized: no synchronization of clocks, slots no special node to coordinate transmissions 4. simple A. 0 B. 1 C. 2 D. 3 E. 4 (Which ones?) 26
Taking turns MAC protocols channel partitioning MAC protocols: share channel efficiently and fairly at high load inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! random access MAC protocols efficient at low load: single node can fully utilize channel high load: collision overhead taking turns protocols look for best of both worlds! 27
Taking turns MAC protocols polling: v master node invites slave nodes to transmit in turn v typically used with dumb slave devices v concerns: polling overhead latency single point of failure (master) data slaves data poll master 28
Taking turns MAC protocols token passing: v control token passed from one node to next sequentially. v token message v concerns: token overhead latency single point of failure (token) (nothing to send) T T data 29
Quiz: Does taking turns satisfy ideal properties? 1. if only one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can send at average rate R/M (fairness) 3. fully decentralized: no synchronization of clocks, slots no special node to coordinate transmissions 4. simple A. 0 B. 1 C. 2 D. 3 E. 4 (Which ones?) 30
Summary of MAC protocols v channel partitioning, by time, frequency or code Time Division, Frequency Division v random access (dynamic), ALOHA, S-ALOHA, CSMA, CSMA/CD carrier sensing: easy in some technologies (wire), hard in others (wireless) CSMA/CD used in Ethernet CSMA/CA used in 802.11 v taking turns polling from central site, token passing bluetooth, FDDI, token ring 31
In practice: Cable access network Internet frames,tv channels, control transmitted downstream at different frequencies cable headend CMTS cable modem termination system splitter cable modem ISP upstream Internet frames, TV control, transmitted upstream at different frequencies in time slots v multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels v multiple 30 Mbps upstream channels multiple access: all users contend for certain upstream channel time slots (others assigned) 32
Cable access network cable headend CMTS MAP frame for Interval [t1, t2] Downstream channel i Upstream channel j t 1 t 2 Residences with cable modems Minislots containing minislots request frames Assigned minislots containing cable modem upstream data frames DOCSIS: data over cable service interface spec v FDM over upstream, downstream frequency channels v TDM upstream: some slots assigned, some have contention downstream MAP frame: assigns upstream slots request for upstream slots (and data) transmitted random access (binary backoff) in selected slots 33