CS 3640: Introduction to Networks and Their Applications Fall 2018, - - PowerPoint PPT Presentation

cs 3640 introduction to
SMART_READER_LITE
LIVE PREVIEW

CS 3640: Introduction to Networks and Their Applications Fall 2018, - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

1

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

slide-2
SLIDE 2

2

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?
slide-3
SLIDE 3

3

This week in class

1.

Recap: Performance metrics

2. 3.

Link layer principles: Errors and medium access Thursday: Assignment in class

slide-4
SLIDE 4

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?
slide-5
SLIDE 5

Recap: What is the end-to-end transmission delay? Transmission delay: How much time for the switch/router to put all bits on the link? Source transmission delay: 8x109 b/1x109 bps = 8s Switch 1 transmission delay: 8x109 b/100x109 bps = .08s Switch 2 transmission delay: 8x109 b/.5x109 bps = 16s End-to-end transmission delay: 24.08s Switch 1 100 Gbps Switch 2 .5 Gbps

slide-6
SLIDE 6

Recap: What is the end-to-end propagation delay? Propagation delay: How much time for the link to send data from one end to the other? Source -> switch 1 propagation delay: 2x103m/2x108mps = 10-5s Switch 1 -> switch 2 propagation delay: 2x103m/2x108mps = 10-5s Switch 2 -> destination propagation delay: 4x103m/2x108mps = 2x10-5s End-to-end transmission delay: 10-5 + 10-5 + 2x10-5s = 4x10-5s Switch 1 100 Gbps Switch 2 .5 Gbps 2000m 2000m 4000m

slide-7
SLIDE 7

Recap: What is the end-to-end processing delay? Processing delay: How much time to check packet for errors and decide next hop? Switch 1 processing delay per packet: 1000 cycles per packet/2x109 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 Switch 1 100 Gbps 2 GHz Switch 2 .5 Gbps 1 GHz 2000m 2000m 4000m

slide-8
SLIDE 8

Recap: What is the end-to-end (average) queueing delay? 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 Switch 1 100 Gbps Switch 2 .5 Gbps

slide-9
SLIDE 9

Recap: What is the end-to-end (average) queueing delay? 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 t0 sec. Last bit arrives at t0 + 8s (time for a 1 GB file to arrive at 1Gbps). Last bit leaves at t0 + 16s (time for a 1 GB file to leave at .5Gbps). Maximum queueing delay: 8s. Total bits: 8x109 Average queueing delay for a bit at switch 2: (0 + a + 2a + … + (8x109-1)a)/8x109 = a(.5x(8x109)x(8x109-1))/8x109 = .5x(8x109-1)a = .5x8 = 4 s. Switch 1 100 Gbps Switch 2 .5 Gbps

slide-10
SLIDE 10

10

This week in class

1.

Recap: Performance metrics

2. 3.

Link layer principles: Errors and medium access Thursday: Assignment in class

slide-11
SLIDE 11

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.

slide-12
SLIDE 12

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.
slide-13
SLIDE 13

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.
slide-14
SLIDE 14

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?
slide-15
SLIDE 15

The link layer: Error detection and correction

  • Discuss: How would you detect errors in frames?
  • Hint: Redundancy might help.
slide-16
SLIDE 16

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.
slide-17
SLIDE 17

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 8th 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

slide-18
SLIDE 18

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?

slide-19
SLIDE 19

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
slide-20
SLIDE 20

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/232!
  • Very cheap to implement in hardware.
  • Very quick.
slide-21
SLIDE 21

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?
slide-22
SLIDE 22

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

slide-23
SLIDE 23

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.

Time Time

1 2 3 1 2 3

slide-24
SLIDE 24

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.
slide-25
SLIDE 25

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

The link layer: Medium access protocols

  • General strategies for MAC protocols
  • Idea 3: Allow collisions, we’ll figure out how to recover data.
  • Allows much higher utilization.
  • Now we have new problems:
  • How to identify when a collision has occurred.
  • How to recover from a collision.
  • This strategy is called “Random access MAC” or “Contention-based MAC”.
  • Used by Ethernet, mobile transmission protocols, and others.
slide-27
SLIDE 27

The link layer: The ALOHA MAC protocol (1970s)

  • Idea: Send a frame as soon as you need to.
  • If you receive a frame while transmitting, a collision has occurred.
  • Wait for some time and transmit again.
  • Eventually, a frame will get transmitted without collisions.
  • Assumptions:
  • All frames are equally sized.
  • Errors (collisions) are detectable.
  • Problem: For successful transmissions, no other frame from any other host

should start within T time before or after you.

  • Sensitive transmission period: 2T for each frame.
  • Scales terribly. (Theoretical maximum throughput for large number of hosts: 18%).
slide-28
SLIDE 28

The link layer: The Slotted ALOHA MAC protocol (1970s)

  • Idea: If we allow transmissions only at certain time points, the “sensitive”

period for transmissions reduces.

  • Transmissions on the channel can occur only every T seconds.
  • The channel is divided into slots, but anyone can send in any slot.
  • Sensitive transmission period: T for each frame.
  • If a collision occurs, wait some number of time slots and retransmit.
  • Assumptions:
  • All frames are equally sized.
  • All host clocks are synchronized (!!!)
  • Errors (collisions) are detectable.
  • Sensitive period reduced from 2T to T.
  • Theoretical maximum throughput is doubled to 36%.
  • Still not great.
slide-29
SLIDE 29

29

Announcement

  • No lecture on Thursday.
  • I am traveling.
  • In-class working hours.
  • Kowsar (TA) will be in class if you need help with your assignment or any of

the material we’ve covered so far.

slide-30
SLIDE 30

30

What you should remember from this lecture

  • What is the role of the link layer? Where is it implemented?
  • How is error detection/correction done at the link layer?
  • What are the different approaches?
  • General ideas and what goes into selection of an approach.
  • When is it not violating the end-to-end principle?
  • Why is stop-and-wait less efficient than the sliding window?
  • What function to MAC protocols provide?
  • Why is slotted ALOHA better than ALOHA?