source: computer-networks-webdesign.com CSCI x760 - Computer Networks Spring 2016 Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu These slides are adapted from the textbook slides by J.F. Kurose and K.W. Ross
Chapter 5: The Data Link Layer Our goals: } understand principles behind data link layer services: } error detection, correction } sharing a broadcast channel: multiple access } link layer addressing } reliable data transfer, flow control: done! } instantiation and implementation of various link layer technologies 5-2 5: DataLink Layer
Link Layer } 5.1 Introduction and services } 5.6 Link-layer switches } 5.2 Error detection and } 5.7 PPP correction } 5.8 Link virtualization: MPLS } 5.3Multiple access protocols } 5.9 A day in the life of a web } 5.4 Link-layer Addressing request } 5.5 Ethernet 5-3 5: DataLink Layer
Link Layer: Introduction Some terminology: } hosts and routers are nodes } communication channels that connect adjacent nodes along communication path are links } wired links } wireless links } LANs } layer-2 packet is a frame, encapsulates datagram data-link layer has responsibility of transferring datagram from one node to adjacent node over a link 5-4 5: DataLink Layer
Link layer: context transportation analogy } datagram transferred by } trip from Princeton to Lausanne different link protocols over } limo: Princeton to JFK different links: } plane: JFK to Geneva } e.g., Ethernet on first link, frame } train: Geneva to Lausanne relay on intermediate links, 802.11 on last link } tourist = datagram } each link protocol provides } transport segment = different services communication link } e.g., may or may not provide rdt } transportation mode = link over link layer protocol } travel agent = routing algorithm 5-5 5: DataLink Layer
Link Layer Services } framing, link access: } encapsulate datagram into frame, adding header, trailer } channel access if shared medium } “MAC” addresses used in frame headers to identify source, dest } different from IP address! } reliable delivery between adjacent nodes } we learned how to do this already (chapter 3)! } seldom used on low bit-error link (fiber, some twisted pair) } wireless links: high error rates } Q: why both link-level and end-end reliability? 5-6 5: DataLink Layer
Link Layer Services (more) } flow control: } pacing between adjacent sending and receiving nodes } error detection : } errors caused by signal attenuation, noise. } receiver detects presence of errors: } signals sender for retransmission or drops frame } error correction: } receiver identifies and corrects bit error(s) without resorting to retransmission } half-duplex and full-duplex } with half duplex, nodes at both ends of link can transmit, but not at same time 5-7 5: DataLink Layer
Where is the link layer implemented? } in each and every host } link layer implemented in “adaptor” (aka network host schematic interface card NIC) application transport } Ethernet card, PCMCI card, cpu network memory link 802.11 card } implements link, physical layer host bus controller } attaches into host’s system (e.g., PCI) link physical buses physical transmission } combination of hardware, software, firmware network adapter card 5-8
Adaptors Communicating datagram datagram controller controller sending host receiving host datagram frame } sending side: } receiving side } encapsulates datagram in frame } looks for errors, rdt, flow control, etc } adds error checking bits, rdt, flow control, etc. } extracts datagram, passes to upper layer at receiving side 5-9 5: DataLink Layer
Link Layer } 5.1 Introduction and services } 5.6 Link-layer switches } 5.2 Error detection and } 5.7 PPP correction } 5.8 Link virtualization: MPLS } 5.3Multiple access protocols } 5.9 A day in the life of a web } 5.4 Link-layer Addressing request } 5.5 Ethernet 5-10 5: DataLink Layer
Multiple Access Links and Protocols Two types of “links”: } point-to-point } PPP for dial-up access } point-to-point link between Ethernet switch and host } broadcast (shared wire or medium) } old-fashioned Ethernet } upstream HFC } 802.11 wireless LAN humans at a cocktail party shared wire (e.g., shared RF shared RF cabled Ethernet) (shared air, acoustical) (e.g., 802.11 WiFi) (satellite) 5-11 5: DataLink Layer
Multiple Access protocols } single shared broadcast channel } two or more simultaneous transmissions by nodes: interference } collision if node receives two or more signals at the same time multiple access protocol } distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit } communication about channel sharing must use channel itself! } no out-of-band channel for coordination 5-12 5: DataLink Layer
Ideal Multiple Access Protocol Broadcast channel of rate R bps 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 5-13 5: DataLink Layer
MAC Protocols: a taxonomy MAC = Medium Access Control Three broad classes: } Channel Partitioning } divide channel into smaller “pieces” (time slots, frequency, code) } allocate piece to node for exclusive use } Random Access } channel not divided, allow collisions } “recover” from collisions } “Taking turns” } nodes take turns, but nodes with more to send can take longer turns 5-14 5: DataLink Layer
Channel Partitioning MAC protocols: TDMA TDMA: time division multiple access } access to channel in "rounds" } each station gets fixed length slot (length = pkt trans time) in each round } unused slots go idle } example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle 6-slot frame 3 3 4 1 4 1 5-15 5: DataLink Layer
Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access } channel spectrum divided into frequency bands } each station assigned fixed frequency band } unused transmission time in frequency bands go idle } example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle t i m e frequency bands FDM cable 5-16 5: DataLink Layer
Random Access Protocols } When node has packet to send } transmit at full channel data rate R. } no a priori coordination among nodes } two or more transmitting nodes ➜ “collision”, } random access MAC protocol specifies: } how to detect collisions } how to recover from collisions (e.g., via delayed retransmissions) } Examples of random access MAC protocols: } slotted ALOHA } ALOHA } CSMA, CSMA/CD, CSMA/CA 5-17 5: DataLink Layer
Slotted ALOHA Assumptions: Operation: } all frames same size } when node obtains fresh frame, transmits in next slot } time divided into equal size } if no collision: node can send slots (time to transmit 1 new frame in next slot frame) } if collision: node retransmits } nodes start to transmit only frame in each subsequent slot slot beginning with prob. p until success } nodes are synchronized } if 2 or more nodes transmit in slot, all nodes detect collision 5-18 5: DataLink Layer
Slotted ALOHA Cons Pros } collisions, wasting slots } single active node can } idle slots continuously transmit at full rate of channel } nodes may be able to detect collision in less than } highly decentralized: only time to transmit packet slots in nodes need to be } clock synchronization in sync } simple 5-19 5: DataLink Layer
Slotted Aloha efficiency } max efficiency: find p* that Efficiency : long-run maximizes fraction of successful slots Np(1-p) N-1 (many nodes, all with many } for many nodes, take limit of frames to send) Np*(1-p*) N-1 as N goes to infinity, gives: Max efficiency = 1/e = .37 } suppose: N nodes with many frames to send, each transmits in slot with probability p } prob that given node has success in a slot = p(1-p) N-1 ! At best: channel } prob that any node has a success = Np(1-p) N-1 used for useful transmissions 37% of time! 5-20 5: DataLink Layer
Pure (unslotted) ALOHA } unslotted Aloha: simpler, no synchronization } when frame first arrives } transmit immediately } collision probability increases: } frame sent at t 0 collides with other frames sent in [t 0 -1,t 0 +1] 5-21 5: DataLink Layer
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 ,t 0+1 ]) = p . (1-p) N-1 . (1-p) N-1 = p . (1-p) 2(N-1) … choosing optimum p and then letting n -> infty ... = 1/(2e) = .18 even worse than slotted Aloha! 5-22 5: DataLink Layer
CSMA (Carrier Sense Multiple Access) CSMA : listen before transmit: If channel sensed idle: transmit entire frame } If channel sensed busy, defer transmission } human analogy: don’t interrupt others! 5-23 5: DataLink Layer
CSMA collisions spatial layout of nodes collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted note: role of distance & propagation delay in determining collision probability “the longer the propagation delay, the larger the chance of collision” 5-24 5: DataLink Layer
Recommend
More recommend