1 / 99

Communications Technology

Communications Technology. Lecture 6: Data Link Layer June 2009. References. Computer Network by A. S. Tanenbaum, Chapter 3 Data & Computer Communications by William Stallings. Learning Objectives. Understand principles behind data link layer services: error detection, correction

Download Presentation

Communications Technology

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Communications Technology Lecture 6: Data Link Layer June 2009

  2. References • Computer Network by A. S. Tanenbaum, Chapter 3 • Data & Computer Communications by William Stallings

  3. Learning Objectives • Understand principles behind data link layer services: • error detection, correction • sharing a broadcast channel: multiple access • MAC protocols continued

  4. Introduction and services Error detection and correction Multiple/Media access protocols Data Link Layer (L2)

  5. Some terminologies 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 “link” L2 Introduction data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

  6. Datagram transferred by different link protocols over different links: e.g., Ethernet on first link, frame relay on intermediate links, 802.11 on last link Each link protocol provides different services E.g., reliable data transfer (rdt) transportation analogy trip from HCMC to Hanoi limo: HUT to TSN plane: TSN to Noi Bai bus: Noi Bai to Hanoi tourist = datagram transport segment = communication link transportation mode = link layer protocol travel agent = routing algorithm L2: Context

  7. L2 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 • seldom used on low bit error link (fiber, some twisted pair) • wireless links: high error rates

  8. L2 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

  9. link layer implemented in “adaptor” (aka NIC) Ethernet card, modem, 802.11 card adapter is semi-autonomous, implementing link & physical layers sending side encapsulates datagram in a frame adds error checking bits, rdt, flow control, etc. receiving side looks for errors, rdt, flow control, etc extracts datagram, passes to receiving node frame frame Adaptors Communicating datagram receiving node link layer protocol sending node adapter adapter

  10. Introduction and services Error detection and correction Multiple/Media access protocols Data Link Layer (L2)

  11. Error Detection ‘ • D = Data protected by error checking, may include header fields • ED = Error Detection bits (redundancy) • Error detection is not 100% reliable! • a good error detector may miss some errors, but rarely • larger ED field generally yields better detection

  12. Parity Checking Two Dimensional Bit Parity: Detect and correct single bit errors Single Bit Parity: Detect single bit errors 0 0

  13. 1 Error Detection: Parity Checking - add a parity bit for every d data bits so that the number of ones of each d+1 data and parity bits is even 0111 0001 1010 1011 1010 1010 0101 0101 Issue: errors generally are bursty, i.e. several consecutive bits are flipped;

  14. Sender: treat segment contents as sequence of 16-bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into UDP/TCP checksum field Receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. But maybe errors nonetheless? Internet checksum Goal: detect “errors” (e.g., flipped bits) in transmitted segment (note: used at transport layer only)

  15. Checksumming: Cyclic Redundancy Check • view data bits, D, as a binary number • choose (r+1) bit pattern (generator), G • goal: choose r CRC bits, R, such that • <D,R> exactly divisible by G (modulo 2) • receiver knows G, divides <D,R> by G. If non-zero remainder: error detected! • can detect all burst errors less than r+1 bits • widely used in practice (ATM, HDCL)

  16. Cyclic Redundancy Check: Background • Widely used in practice, e.g., • Ethernet, FDDI, PKZIP, WinZip, PNG • For a given data D, consider it as a polynomial D(x) • consider the string of 0 and 1 as the coefficients of a polynomial • e.g. consider string 10011 as x4+x+1 • addition and subtraction are modular 2, thus the same as xor • Choose generator polynomial G(x) with r+1 bits, where r is called the degree of G(x)

  17. Cyclic Redundancy Check: Objective • Given data G(x) and D(x), choose R(x) with r bits, such that • D(x)xr+R(x) is exactly divisible by G(x) • The bits correspond to D(x)xr+R(x) are sent to the receiver • Since G(x) is global, when the receiver receives the transmission T’(x), it divides T’(x) by G(x) • if non-zero remainder: error detected! • if zero remainder, assumes no error x +

  18. CRC: Steps and an Example Suppose the degree of G(x) is r Append r zero to D(x), i.e. consider D(x)xr Divide D(x)xr by G(x). Let R(x) denote the reminder Send <D, R> to the receiver

  19. The Power of CRC • Let T(x) denote D(x)xr+R(x), and E(x) the polynomial of the error bits • the received signal is T(x)+E(x) • Since T(x) is divisible by G(x), we only need to consider if E(x) is divisible by G(x) • Examples • a single bit of error: E(x) = xi • if G(x) contains two or more terms, E(x) is not divisible by G(x) • an odd number of errors: E(x) has an odd number of terms: • lemma: if E(x) has an odd number of terms, E(x) cannot be divisible by (x+1) • suppose E(x) = (x+1)F(x), let x=1, the left hand will be 1, while the right hand will be 0 • thus if G(x) contains x+1 as a factor, E(x) will not be divided by G(x) • Many more errors can be detected by designing the right G(x)

  20. Example G(x) • 16 bits CRC: • CRC-16: x16+x15+x2+1, CRC-CCITT: x16+x12+x5+1 • both can catch • all single or double bit errors • all odd number of bit errors • all burst errors of length 16 or less • >99.99% of the 17 or 18 bits burst errors • 32 bits CRC: • CRC32: x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 • used by Ethernet, FDDI, PKZIP, WinZip, and PNG • For more details see the link below and further links it contains: • http://en.wikipedia.org/wiki/Cyclic_redundancy_check

  21. Introduction and services Error detection and correction Multiple/Media access protocols Data Link Layer (L2)

  22. 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) • traditional Ethernet • upstream HFC • 802.11 wireless LAN

  23. Multiple Access Protocols • Single shared broadcast channel • thus, if two or more simultaneous transmissions by nodes, due to interference, only one node can send successfully at a time (see CDMA later for an exception) multiple access protocol • Protocol that determines how nodes share channel, i.e., determines when nodes can transmit • Communication about channel sharing must use channel itself ! • Discussion: properties of an ideal multiple accessprotocol.

  24. Ideal Multiple Access Protocol Broadcast channel of rate R bps • Efficiency: when one node wants to transmit, it can send at rate R • Fairness: when N nodes want to transmit, each can send at average rate R/N • Decentralized: • no special node to coordinate transmissions • no synchronization of clocks • Simple

  25. MAC Protocols: a taxonomy 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

  26. 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

  27. 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

  28. Evolution of Contention Protocols Aloha Developed in the 1970s for a packet radio network SlottedAloha Improvement: Start transmission only at fixed times (slots) CSMA = Carrier Sense Multiple Access Improvement: Start transmission only if no transmission is ongoing CSMA CD = Collision Detection Improvement: Stop ongoing transmission if a collision is detected (e.g. Ethernet) CSMA/CD

  29. Assumptions all frames same size time is divided into equal size slots, time to transmit 1 frame nodes start to transmit frames only at beginning of slots nodes are synchronized if 2 or more nodes transmit in slot, all nodes detect collision Operation when node obtains fresh frame, it transmits in next slot no collision, node can send new frame in next slot if collision, node retransmits frame in each subsequent slot with prob. p until success Slotted ALOHA

  30. Pure (unslotted) ALOHA • unslotted ALOHA: simpler, no synchronization • when frame first arrives • transmit immediately • collision probability increases: • frame sent at t0 collides with other frames sent in [t0-1,t0+1]

  31. 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!

  32. 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

  33. CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA • collisions detected within short time • colliding transmissions aborted, reducing channel wastage • collision detection: • easy in wired LANs: measure signal strengths, compare transmitted, received signals • difficult in wireless LANs: receiver shut off while transmitting • human analogy: the polite conversationalist

  34. CSMA/CD collision detection

  35. “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!

  36. “Taking Turns” MAC protocols Token passing: • control token passed from one node to next sequentially. • token message • concerns: • token overhead • latency • single point of failure (token) Polling: • master node “invites” slave nodes to transmit in turn • concerns: • polling overhead • latency • single point of failure (master)

  37. Summary of MAC protocols • What do you do with a shared media? • Channel Partitioning, by time, frequency or code • Time Division, Frequency Division • Random partitioning (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 • Taking Turns • polling from a central site, token passing

  38. principles behind data link layer services: error detection, correction sharing a broadcast channel: multiple access MAC protocols Chapter Summary

  39. Backup slides

  40. Overview • Ethernet and Wi-Fi are both “multi-access” technologies • Broadcast medium, shared by many hosts • Simultaneous transmissions will result in collisions • Media Access Control (MAC) protocol required • Rules on how to share medium

  41. Media Access Control Protocols • Channel partitioning • Divide channel into smaller “pieces” (e.g., time slots, frequency) • Allocate a piece to node for exclusive use • E.g. Time-Division-Multi-Access (TDMA) cellular network • Taking-turns • Tightly coordinate shared access to avoid collisions • E.g. Token ring network • Contention • Allow collisions • “recover” from collisions • E.g. Ethernet, Wi-Fi

  42. Contention Media Access Control Goals • Share medium • If two users send at the same time, collision results in no packet being received (interference) • If no users send, channel goes idle • Thus, want to have only one user send at a time • Want high network utilization • TDMA doesn’t give high utilization • Want simple distributed algorithm • no fancy token-passing schemes that avoid collisions

  43. Evolution of Contention Protocols Aloha Developed in the 1970s for a packet radio network SlottedAloha Improvement: Start transmission only at fixed times (slots) CSMA = Carrier Sense Multiple Access Improvement: Start transmission only if no transmission is ongoing CSMA CD = Collision Detection Improvement: Stop ongoing transmission if a collision is detected (e.g. Ethernet) CSMA/CD

  44. (Pure) ALOHA • Topology: Broadcast medium with multiple stations • Aloha Protocol: • Whenever a station has data, it transmits immediately • Receivers ACK all packets • No ACK = collision. Wait a random time and retransmit

  45. Simple, but Radical • Previous attempts all partitioned channel • TDMA, FDMA, etc. • Aloha optimized the common case (few senders) and dealt with collisions through retries

  46. Trade-off Compared to TDMA • In TDMA, you always have to wait your turn • delay proportional to number of sites • In Aloha, can send immediately • Aloha gives much lower delays, at the price of lower utilization (as we will see)

  47. Collisions in (Pure) ALOHA

  48. Performance of (Pure) ALOHA • Performance questions: • What is the collision probability? • What is the maximum throughput? • Notation: C : link capacity in (bits/sec) s : packet size (bits/packet) F : packet transmission time (sec)

  49. Collisions and Vulnerable Period • A frame (red frame) will be in a collision if and only if another transmission begins in the vulnerable period of the frame • Vulnerable period has the length of 2 frame times

  50. Traffic Model Poisson rate from all stations (Poisson Process’s are additive) Inter-arrival time is exponentially distributed

More Related