cs 3700
play

CS 3700 Networks and Distributed Systems Data Link (The Etherknot - PowerPoint PPT Presentation

CS 3700 Networks and Distributed Systems Data Link (The Etherknot Notwork) Revised 9/14/16 Data Link Layer 2 Function: Send blocks of data (frames) between Application physical devices Regulate access to the physical media


  1. Checksums 15 � Idea: � Add up the bytes in the data � Include the sum in the frame START Data Checksum END � Use ones-complement arithmetic � Lower overhead than parity: 16 bits per frame � But, not resilient to errors � Why? � Used in UDP , TCP , and IP

  2. Checksums 15 � Idea: � Add up the bytes in the data � Include the sum in the frame START Data Checksum END � Use ones-complement arithmetic � Lower overhead than parity: 16 bits per frame � But, not resilient to errors � Why? 0101001 + 1101001= 10010010 � Used in UDP , TCP , and IP

  3. Checksums 15 � Idea: � Add up the bytes in the data � Include the sum in the frame START Data Checksum END � Use ones-complement arithmetic � Lower overhead than parity: 16 bits per frame � But, not resilient to errors � Why? 1 + 0 0101001 1101001= 10010010 � Used in UDP , TCP , and IP

  4. Cyclic Redundancy Check (CRC) 16 � Uses field theory to compute a semi-unique value for a given message � Much better performance than previous approaches � Fixed size overhead per frame (usually 32-bits) � Quick to implement in hardware � Only 1 in 2 32 chance of missing an error with 32-bit CRC � Details are in the book/on Wikipedia � Today, cryptographic hashes are more common � e.g. MD5, SHA1, SHA256, SHA512

  5. What About Reliability? 17 � How does a sender know that a frame was received? � What if it has errors? � What if it never arrives at all? Sender Receiver Time

  6. What About Reliability? 17 � How does a sender know that a frame was received? � What if it has errors? � What if it never arrives at all? Sender Receiver Frame Time

  7. What About Reliability? 17 � How does a sender know that a frame was received? � What if it has errors? � What if it never arrives at all? Sender Receiver Frame Time K C A

  8. What About Reliability? 17 � How does a sender know that a frame was received? � What if it has errors? � What if it never arrives at all? Sender Receiver Frame Time K C A Acknowledgement

  9. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver

  10. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver Frame Timeout

  11. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver Frame Timeout K C A

  12. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver Frame K C A

  13. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver Frame K C A Frame Timeout

  14. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver Frame K C A Frame Timeout Frame

  15. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver � Problems? Frame K C A Frame Timeout Frame

  16. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver � Problems? Frame � Utilization � Can only have one frame in flight at any time K C A Frame Timeout Frame

  17. Stop and Wait 18 � Simplest form of reliability � Example: Bluetooth Sender Receiver � Problems? Frame � Utilization � Can only have one frame in flight at any time K C A Frame � 10Gbps link and 10ms delay � Need 100 Mbps to fill the pipe Timeout � Assume packets are 1500B 1500B*8bit/(2*10ms) = 600Kbps Frame Utilization is 0.006%

  18. Sliding Window 19 � Allow multiple outstanding, un-ACKed frames � Number of un-ACKed frames is called the window Sender Receiver Window Frames s K C A

  19. Sliding Window 19 � Allow multiple outstanding, un-ACKed frames � Number of un-ACKed frames is called the window Sender Receiver Window Frames s K C A � Made famous by TCP � We’ll look at this in more detail later

  20. Should We Error Check in the Data Link? 20 � Recall the End-to-End Argument � Cons: � Error free transmission cannot be guaranteed � Not all applications want this functionality � Error checking adds CPU and packet size overhead � Error recovery requires buffering

  21. Should We Error Check in the Data Link? 20 � Recall the End-to-End Argument � Cons: � Error free transmission cannot be guaranteed � Not all applications want this functionality � Error checking adds CPU and packet size overhead � Error recovery requires buffering � Pros: � Potentially better performance than app-level error checking

  22. Should We Error Check in the Data Link? 20 � Recall the End-to-End Argument � Cons: � Error free transmission cannot be guaranteed � Not all applications want this functionality � Error checking adds CPU and packet size overhead � Error recovery requires buffering � Pros: � Potentially better performance than app-level error checking � Data link error checking in practice � Most useful over lossy links � Wifi, cellular, satellite

  23. Outline 21 ❑ Framing ❑ Error Checking and Reliability ❑ Media Access Control 802.3 Ethernet ❑ 802.11 Wifi ❑

  24. What is Media Access? 22 � Ethernet and Wifi are both multi-access technologies � Broadcast medium, shared by many hosts � Simultaneous transmissions cause collisions ■ This destroys the data

  25. What is Media Access? 22 � Ethernet and Wifi are both multi-access technologies � Broadcast medium, shared by many hosts � Simultaneous transmissions cause collisions ■ This destroys the data � Media Access Control (MAC) protocols are required � Rules on how to share the medium � Strategies for detecting, avoiding, and recovering from collisions

  26. Strategies for Media Access 23 � Channel partitioning � Divide the resource into small pieces � Allocate each piece to one host � Example: Time Division Multi-Access (TDMA) cellular � Example: Frequency Division Multi-Access (FDMA) cellular

  27. Strategies for Media Access 23 � Channel partitioning � Divide the resource into small pieces � Allocate each piece to one host � Example: Time Division Multi-Access (TDMA) cellular � Example: Frequency Division Multi-Access (FDMA) cellular � Taking turns � Tightly coordinate shared access to avoid collisions � Example: Token ring networks

  28. Strategies for Media Access 23 � Channel partitioning � Divide the resource into small pieces � Allocate each piece to one host � Example: Time Division Multi-Access (TDMA) cellular � Example: Frequency Division Multi-Access (FDMA) cellular � Taking turns � Tightly coordinate shared access to avoid collisions � Example: Token ring networks � Contention � Allow collisions, but use strategies to recover � Examples: Ethernet, Wifi

  29. Strategies for Media Access 23 � Channel partitioning � Divide the resource into small pieces � Allocate each piece to one host � Example: Time Division Multi-Access (TDMA) cellular � Example: Frequency Division Multi-Access (FDMA) cellular � Taking turns � Tightly coordinate shared access to avoid collisions � Example: Token ring networks � Contention � Allow collisions, but use strategies to recover � Examples: Ethernet, Wifi

  30. Contention MAC Goals 24 Share the medium 1. � Two hosts sending at the same time collide, thus causing interference � If no host sends, channel is idle � Thus, want one user sending at any given time

  31. Contention MAC Goals 24 Share the medium 1. � Two hosts sending at the same time collide, thus causing interference � If no host sends, channel is idle � Thus, want one user sending at any given time High utilization 2. � TDMA is low utilization � Just like a circuit switched network

  32. Contention MAC Goals 24 Share the medium 1. � Two hosts sending at the same time collide, thus causing interference � If no host sends, channel is idle � Thus, want one user sending at any given time High utilization 2. � TDMA is low utilization � Just like a circuit switched network Simple, distributed algorithm 3. � Multiple hosts that cannot directly coordinate � No fancy (complicated) token-passing schemes

  33. Contention Protocol Evolution 25 � ALOHA � Developed in the 70’s for packet radio networks

  34. Contention Protocol Evolution 25 � ALOHA � Developed in the 70’s for packet radio networks � Slotted ALOHA � Start transmissions only at fixed time slots � Significantly fewer collisions than ALOHA

  35. Contention Protocol Evolution 25 � ALOHA � Developed in the 70’s for packet radio networks � Slotted ALOHA � Start transmissions only at fixed time slots � Significantly fewer collisions than ALOHA � Carrier Sense Multiple Access (CSMA) � Start transmission only if the channel is idle

  36. Contention Protocol Evolution 25 � ALOHA � Developed in the 70’s for packet radio networks � Slotted ALOHA � Start transmissions only at fixed time slots � Significantly fewer collisions than ALOHA � Carrier Sense Multiple Access (CSMA) � Start transmission only if the channel is idle � CSMA / Collision Detection (CSMA/CD) � Stop ongoing transmission if collision is detected

  37. ALOHA 26 � Topology: radio broadcast with multiple stations � Protocol: � Stations transmit data immediately � Receivers ACK all packets � No ACK = collision, wait a random time then retransmit A B C

  38. ALOHA 26 � Topology: radio broadcast with multiple stations � Protocol: � Stations transmit data immediately � Receivers ACK all packets � No ACK = collision, wait a random time then retransmit A B C

  39. ALOHA 26 � Topology: radio broadcast with multiple stations � Protocol: � Stations transmit data immediately � Receivers ACK all packets � No ACK = collision, wait a random time then retransmit A B C

  40. ALOHA 26 � Topology: radio broadcast with multiple stations � Protocol: � Stations transmit data immediately � Receivers ACK all packets � No ACK = collision, wait a random time then retransmit A B C

  41. ALOHA 26 � Topology: radio broadcast with multiple stations � Protocol: � Stations transmit data immediately � Receivers ACK all packets � No ACK = collision, wait a random time then retransmit A B C

  42. ALOHA 26 � Topology: radio broadcast with multiple stations � Protocol: � Stations transmit data immediately � Receivers ACK all packets � No ACK = collision, wait a random time then retransmit A B C

  43. ALOHA 26 � Topology: radio broadcast with multiple stations � Protocol: � Stations transmit data immediately � Receivers ACK all packets � No ACK = collision, wait a random time then retransmit • Simple, but radical concept • Previous attempts all divided the channel • TDMA, FDMA, etc. • Optimized for the common case: few senders A B C

  44. Tradeoffs vs. TDMA 27 � In TDMA, each host must wait for its turn � Delay is proportional to number of hosts � In Aloha, each host sends immediately � Much lower delay � But, much lower utilization

  45. Tradeoffs vs. TDMA 27 � In TDMA, each host must wait for its turn � Delay is proportional to number of hosts � In Aloha, each host sends immediately � Much lower delay � But, much lower utilization ALOHA Frame Sender A ALOHA Frame Sender B Time

  46. Tradeoffs vs. TDMA 27 � In TDMA, each host must wait for its turn � Delay is proportional to number of hosts � In Aloha, each host sends immediately � Much lower delay � But, much lower utilization 2*Frame_Width Sender A ALOHA Frame ALOHA Frame Sender B Time

  47. Tradeoffs vs. TDMA 27 � In TDMA, each host must wait for its turn � Delay is proportional to number of hosts � In Aloha, each host sends immediately � Much lower delay � But, much lower utilization 2*Frame_Width Sender A ALOHA Frame ALOHA Frame Sender B Time � Maximum throughput is ~18% of channel capacity

  48. Tradeoffs vs. TDMA 27 � In TDMA, each host must wait for its turn � Delay is proportional to number of hosts � In Aloha, each host sends immediately Throughput � Much lower delay � But, much lower utilization 2*Frame_Width Sender A ALOHA Frame ALOHA Frame Sender B Time Load � Maximum throughput is ~18% of channel capacity

  49. Slotted ALOHA 28 � Protocol � Same as ALOHA, except time is divided into slots � Hosts may only transmit at the beginning of a slot � Thus, frames either collide completely, or not at all � 37% throughput vs. 18% for ALOHA � But, hosts must have synchronized clocks

  50. Slotted ALOHA 28 � Protocol � Same as ALOHA, except time is divided into slots � Hosts may only transmit at the beginning of a slot � Thus, frames either collide completely, or not at all Throughput � 37% throughput vs. 18% for ALOHA � But, hosts must have synchronized clocks Load

  51. Broadcast Ethernet 29 � Originally, Ethernet was a broadcast technology Terminator Repeater Tee Connector

  52. Broadcast Ethernet 29 � Originally, Ethernet was a broadcast technology Terminator Repeater Tee Connector

  53. Broadcast Ethernet 29 � Originally, Ethernet was a broadcast technology Terminator Repeater Tee Connector

  54. Broadcast Ethernet 29 � Originally, Ethernet was a broadcast technology 10Base2 Terminator Repeater Tee Connector

  55. Broadcast Ethernet 29 � Originally, Ethernet was a broadcast technology 10Base2 Terminator Repeater Tee Connector Hub

Recommend


More recommend