CS 3640: Introduction to Networks and Their Applications Fall 2018, Lecture 5: The Link Layer I – Errors and medium access Instructor: Rishab Nithyanand Teaching Assistant: Md. Kowsar Hossain 1
You should… • Be checking Piazza regularly for announcements. • Have started working on assignment 1. • Know and understand: • The three Internet design principles. • Encapsulation. • The components of the Internet. • Circuit- vs. packet- switched networks. • Components of end-to-end delay. • How do you estimate each of them? • How do you identify bottlenecks and address each delay? 2
This week in class 1. 2. 3. Recap: Link layer Thursday: Performance principles: Assignment in metrics Errors and class medium access 3
Recap: How do we assess the performance of a packet-switched network? • Delay • How long does it take a packet to get to its destination? • Transmission delay: How fast can your link interface convert bits into link signals? • Propagation delay: How fast can your link send bits from one end to the other? • Processing delay: How fast can your processor handle an incoming packet? • Queueing delay: How full is the buffer? • Loss • What fraction of packets that are sent end up getting dropped? • Throughput • At what rate is data being received by the destination?
Recap: What is the end-to-end transmission delay? Switch 2 Switch 1 .5 Gbps 100 Gbps Transmission delay: How much time for the switch/router to put all bits on the link? Source transmission delay: 8x10 9 b/1x10 9 bps = 8s Switch 1 transmission delay: 8x10 9 b/100x10 9 bps = .08s Switch 2 transmission delay: 8x10 9 b/.5x10 9 bps = 16s End-to-end transmission delay: 24.08s
Recap: What is the end-to-end propagation delay? 4000m 2000m 2000m Switch 2 Switch 1 .5 Gbps 100 Gbps Propagation delay: How much time for the link to send data from one end to the other? Source -> switch 1 propagation delay: 2x10 3 m/2x10 8 mps = 10 -5 s Switch 1 -> switch 2 propagation delay: 2x10 3 m/2x10 8 mps = 10 -5 s Switch 2 -> destination propagation delay: 4x10 3 m/2x10 8 mps = 2x10 -5 s End-to-end transmission delay: 10 -5 + 10 -5 + 2x10 -5 s = 4x10 -5 s
Recap: What is the end-to-end processing delay? 4000m 2000m 2000m Switch 1 Switch 2 .5 Gbps 100 Gbps 2 GHz 1 GHz Processing delay: How much time to check packet for errors and decide next hop? Switch 1 processing delay per packet: 1000 cycles per packet/2x10 9 cycles per second = .5x10 -6 seconds per packet Switch 2 processing delay per packet: 1000 cycles per packet/.5x109 cycles per second = 2x10 -6 seconds per packet End-to-end processing delay per packet: 2.5x10 -6 seconds per packet
Recap: What is the end-to-end (average) queueing delay? Switch 1 Switch 2 .5 Gbps 100 Gbps Queueing delay: How much time, on average, does data spend in buffers? Switch 1. Arrival rate: 1 Gbps Departure rate: 100 Gbps A packet comes in. Queue is empty. It gets sent out. Average queueing delay at switch 1 = 0 s
Recap: What is the end-to-end (average) queueing delay? Switch 1 Switch 2 .5 Gbps 100 Gbps Queueing delay: How much time, on average, does data spend in buffers? Switch 2. Arrival rate: 1 Gbps (bottlenecked by source sending rate). Departure rate: .5 Gbps For every 2 bits coming in, 1 has to wait in the queue. First bit arrives at t 0 sec. Last bit arrives at t 0 + 8s (time for a 1 GB file to arrive at 1Gbps). Last bit leaves at t 0 + 16s (time for a 1 GB file to leave at .5Gbps). Maximum queueing delay: 8s. Total bits: 8x10 9 Average queueing delay for a bit at switch 2: (0 + a + 2a + … + (8x10 9 -1)a)/8x10 9 = a(.5x(8x10 9 )x(8x10 9 -1))/8x10 9 = .5x(8x10 9 -1)a = .5x8 = 4 s.
This week in class 1. 2. 3. Recap: Link layer Thursday: Performance principles: Assignment in metrics Errors and class medium access 10
Recap: The link layer • What are the functions of the link layer? • Write bits to and read bits from the network interface. • How does the link layer perform error detection and correction? • How do multiple devices share a link? • Figure out which wire to put bits on. • What does the link layer need to know to put things on the right wire? • The link layer protocol can be different things on different devices. • Can be Ethernet on one hop, WiFi on the next. • They are usually implemented on an “adaptor” (NIC for Ethernet). • We will focus on the principles of the link layer, not any specific protocol.
Recap: The link layer • How do adaptors communicate? • At the senders side: • Link layer gets a datagram from Network layer. • Figures out which wire to use for the network layer destination. • Encapsulates datagram with link layer header. (Frame) • Adds error checking (or, correction) bits to header. • Writes frame to link.
Recap: The link layer • How do adaptors communicate? • At the receivers side: • Link layer gets a frame from the link. • Figures out which wire to use for the network layer destination. • Looks for errors and corrects them if required/possible. • Strips link layer headers and passes the datagram up to the network layer.
The link layer: Error detection and correction • The link layer may perform error detection and correction on frames when possible and if asked to do so. • Why? • The physical world is inherently noisy. Interference from radio transmissions and microwaves . • • Discuss: Is this a violation of the end-to-end principle? When is it OK?
The link layer: Error detection and correction • Discuss: How would you detect errors in frames? • Hint: Redundancy might help.
The link layer: Error detection and correction • A simple solution: Send multiple copies of each frame. An error has occurred if copy 1 != copy 2 != … != copy n. • Problems • Overhead! • n transmissions for each frame.
The link layer: Error detection and correction • A better idea: Parity bits • Add extra bits to make sure number of 1s is even. Example: 7-bit ASCII chars. Make 8 th bit the parity bit. • • If number of 1s in any 8bit sequence is odd, error occurred. • Overhead: 1 parity bit for every 7 frame bits (14%). • Problem? • Discuss: What’s the minimum number of bits that need to change for this to fail? 0101001 1 1101001 0
The link layer: Error detection and correction • A better idea: Two-dimensional parity bits • Imagine your frame as a two-dimensional array of bits. • Add one parity bit for each row and for each column. • Can detect most errors with only 14% overhead! • Discuss: What's the minimum number of bits that need to change for this to fail?
The link layer: Error detection and correction • An even better idea: Checksums • What if you just added all the bytes in your frame. • Included the sum in the frame. • Requires only 16 bits overhead for the whole frame! (~1% overhead) • This is used in the transport layer and IP layer. • Problem : Still can have errors. • Example (data): 10000000 + 01111111 = 11111111 • Error: 11000000 + 00111111 = 11111111
The link layer: Error detection and correction • What we actually use in the link layer: Cyclic Redundancy Check (CRC) • A more complicated version of checksum. • Idea: Perform a series of mathematical operations on the frames data bits to get a semi-unique value. • Typically, 32 bit overhead per frame (3%). Chance of error: 1/2 32 ! • Very cheap to implement in hardware. • Very quick.
The link layer: Error detection and correction • How does a sender know if a frame was: • Received error free? • Received at all? • Discuss: How do you do this IRL?
The link layer: Error detection and correction • The Stop and Wait protocol • I’ll wait for an ACK before I send the next frame. If I don’t get an ACK in x ms, I’ll resend the frame. • Used by Bluetooth. • Problem: Poor efficiency. At best, only one frame every RTT seconds. • Discuss: How would you improve the efficiency of this protocol. Time Time
The link layer: Error detection and correction • The Sliding Window Protocol • We can allow multiple frames to be unacknowledged. • This is the “window”. • Better efficiency: Can allow n frames per RTT. 1 2 3 1 2 3 Time Time
The link layer: Medium access protocols • What is a medium access control (MAC) protocol? • A transmission medium can be shared by many devices. • If everyone talks at the same time, we have “collisions” and unintelligible data. • MAC: Rules for sharing a common transmission medium.
The link layer: Medium access protocols • General strategies for MAC protocols • Idea 1: Partition the transmission channel so each host has its share. • We briefly saw this – Time and Frequency division. Each host has a fixed share (time or frequency band) in the medium. • What if a host has nothing to send? • Idea 2: Pass a “transmit now” token to hosts. • Like me asking a question in class and selecting one person (from many ☺ ) to answer. • What if multiple people really want to give an answer? • Problem: Transmission channel utilization isn’t great.
Recommend
More recommend