link layer introduction
play

Link Layer: Introduction link Some terminology: hosts and routers - PDF document

Link Layer: Introduction link Some terminology: hosts and routers are nodes Link Layer Error communication channels that connect adjacent nodes along Detection/Correction and MAC communication path are links wired links


  1. Link Layer: Introduction “link” Some terminology: ❒ hosts and routers are nodes Link Layer – Error ❒ communication channels that connect adjacent nodes along Detection/Correction and MAC 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: DataLink Layer 5-1 5: DataLink Layer 5-2 Adaptors Communicating Error Detection datagram EDC= Error Detection and Correction bits (redundancy) rcving link layer protocol sending D = Data protected by error checking, may include header fields node node frame frame • Error detection not 100% reliable! adapter adapter • protocol may miss some errors, but rarely ❒ receiving side • larger EDC field yields better detection and correction ❒ link layer implemented in “adaptor” (aka NIC) ❍ looks for errors, rdt, flow control, etc ❍ Ethernet card, PCMCI card, 802.11 card ❍ extracts datagram, passes to rcving node ❒ sending side: ❒ adapter is semi- ❍ encapsulates datagram in autonomous a frame ❍ adds error checking bits, ❒ link & physical layers 5: DataLink Layer 5-3 5: DataLink Layer 5-4 rdt, flow control, etc. Parity Checking Internet checksum Two Dimensional Bit Parity : Single Bit Parity: Goal: detect “errors” (e.g., flipped bits) in Detect and correct single bit errors Detect single bit errors transmitted segment (note: used at transport layer only ) Receiver: Sender: compute checksum of received ❒ ❒ treat segment contents segment as sequence of 16-bit check if computed checksum ❒ integers equals checksum field value: ❒ checksum: addition (1’s ❍ NO - error detected complement sum) of ❍ YES - no error detected. segment contents But maybe errors 0 0 ❒ sender puts checksum nonetheless? More later …. value into UDP checksum field 5: DataLink Layer 5-5 5: DataLink Layer 5-6 1

  2. CRC Example Checksumming: Cyclic Redundancy Check Want: ❒ view data bits, D, as a binary number ❒ choose r+1 bit pattern (generator), G D . 2 r XOR R = nG ❒ goal: choose r CRC bits, R, such that equivalently: ❍ <D,R> exactly divisible by G (modulo 2) D . 2 r = nG XOR R ❍ receiver knows G, divides <D,R> by G. If non-zero remainder: error detected! equivalently: ❍ can detect all burst errors less than r+1 bits if we divide D . 2 r by ❒ widely used in practice (ATM, HDCL) G, want remainder R D . 2 r R = remainder[ ] G 5: DataLink Layer 5-7 5: DataLink Layer 5-8 Multiple Access Links and Protocols Multiple Access protocols Two types of “links”: ❒ single shared broadcast channel ❒ point-to-point ❒ two or more simultaneous transmissions by nodes: ❍ PPP for dial-up access ❍ point-to-point link between Ethernet switch and host interference ❒ broadcast (shared wire or medium) ❍ collision if node receives two or more signals at the same time ❍ traditional Ethernet multiple access protocol ❍ upstream HFC ❍ 802.11 wireless LAN ❒ 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: DataLink Layer 5-9 5: DataLink Layer 5-10 Ideal Mulitple Access Protocol MAC Protocols: a taxonomy Three broad classes: Broadcast channel of rate R bps ❒ Channel Partitioning 1. When one node wants to transmit, it can send at ❍ divide channel into smaller “pieces” (time slots, rate R. frequency, code) 2. When M nodes want to transmit, each can send at ❍ allocate piece to node for exclusive use average rate R/M ❒ Random Access 3. Fully decentralized: ❍ channel not divided, allow collisions ❍ “recover” from collisions ❍ no special node to coordinate transmissions ❒ “Taking turns” ❍ no synchronization of clocks, slots 4. Simple ❍ Nodes take turns, but nodes with more to send can take longer turns 5: DataLink Layer 5-11 5: DataLink Layer 5-12 2

  3. Channel Partitioning MAC protocols: TDMA Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access TDMA: time division multiple access ❒ channel spectrum divided into frequency bands ❒ access to channel in "rounds" ❒ each station assigned fixed frequency band ❒ each station gets fixed length slot (length = pkt trans time) in each round ❒ unused transmission time in frequency bands go idle ❒ unused slots go idle ❒ example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle ❒ example: 6-station LAN, 1,3,4 have pkt, slots time frequency bands 2,5,6 idle 5: DataLink Layer 5-13 5: DataLink Layer 5-14 Random Access Protocols Slotted ALOHA ❒ When node has packet to send Assumptions Operation ❍ transmit at full channel data rate R. ❒ all frames same size ❒ when node obtains fresh ❍ no a priori coordination among nodes ❒ time is divided into equal frame, it transmits in next slot ❒ two or more transmitting nodes ➜ “collision”, size slots, time to transmit ❒ no collision, node can send new 1 frame ❒ random access MAC protocol specifies: frame in next slot ❒ nodes start to transmit ❍ how to detect collisions ❒ if collision, node retransmits frames only at beginning of ❍ how to recover from collisions (e.g., via delayed frame in each subsequent slot slots retransmissions) with prob. p until success ❒ nodes are synchronized ❒ Examples of random access MAC protocols: ❍ slotted ALOHA ❒ if 2 or more nodes transmit in slot, all nodes detect ❍ ALOHA collision ❍ CSMA, CSMA/CD, CSMA/CA 5: DataLink Layer 5-15 5: DataLink Layer 5-16 Slotted ALOHA Slotted Aloha efficiency ❒ For max efficiency with N Efficiency is the long-run nodes, find p* that fraction of successful slots maximizes when there are many nodes, each Np(1-p) N-1 with many frames to send ❒ For many nodes, take limit Suppose N nodes with many of Np*(1-p*) N-1 as N goes ❒ Pros Cons frames to send, each to infinity, gives 1/e = .37 transmits in slot with single active node can ❒ collisions, wasting slots ❒ probability p continuously transmit at full ❒ idle slots rate of channel prob that node 1 has success ❒ ❒ nodes may be able to in a slot = p(1-p) N-1 highly decentralized: only ❒ At best: channel detect collision in less slots in nodes need to be in prob that any node has a ❒ used for useful than time to transmit sync success = Np(1-p) N-1 transmissions 37% packet simple ❒ of time! ❒ clock synchronization 5: DataLink Layer 5-17 5: DataLink Layer 5-18 3

  4. Pure (unslotted) ALOHA CSMA (Carrier Sense Multiple Access) ❒ unslotted Aloha: simpler, no synchronization CSMA : listen before transmit: ❒ when frame first arrives If channel sensed idle: transmit entire frame ❍ transmit immediately ❒ If channel sensed busy, defer transmission ❒ collision probability increases: ❍ frame sent at t 0 collides with other frames sent in [t 0 -1,t 0 +1] ❒ Human analogy: don’t interrupt others! 5: DataLink Layer 5-19 5: DataLink Layer 5-20 CSMA collisions CSMA/CD (Collision Detection) spatial layout of nodes CSMA/CD: carrier sensing, deferral as in CSMA collisions can still occur: propagation delay means ❍ collisions detected within short time two nodes may not hear ❍ colliding transmissions aborted, reducing channel each other’s transmission wastage collision: ❒ collision detection: entire packet transmission time wasted ❍ easy in wired LANs: measure signal strengths, note: compare transmitted, received signals role of distance & propagation delay in determining collision ❍ difficult in wireless LANs: receiver shut off while probability transmitting ❒ human analogy: the polite conversationalist 5: DataLink Layer 5-21 5: DataLink Layer 5-22 CSMA/CD collision detection “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! 5: DataLink Layer 5-23 5: DataLink Layer 5-24 4

  5. “Taking Turns” MAC protocols Summary of MAC protocols Token passing: Polling: ❒ What do you do with a shared media? ❒ control token passed from one ❒ master node node to next sequentially. ❍ Channel Partitioning, by time, frequency or code “invites” slave ❒ token message • Time Division, Frequency Division nodes to transmit ❒ concerns: ❍ Random partitioning (dynamic), in turn ❍ token overhead • ALOHA, S-ALOHA, CSMA, CSMA/CD ❒ concerns: ❍ latency • carrier sensing: easy in some technologies (wire), ❍ single point of failure (token) ❍ polling overhead hard in others (wireless) ❍ latency • CSMA/CD used in Ethernet ❍ single point of • CSMA/CA used in 802.11 failure (master) ❍ Taking Turns • polling from a central site, token passing 5: DataLink Layer 5-25 5: DataLink Layer 5-26 5

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend