Top Banner
EEC-484/584 EEC-484/584 Computer Networks Computer Networks Lecture 12 Lecture 12 Wenbing Zhao Wenbing Zhao [email protected] (Part of the slides are based on Drs. (Part of the slides are based on Drs. Kurose & Ross Kurose & Ross s slides for their s slides for their Computer Networking Computer Networking book) book)
30

EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao [email protected] (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

Dec 18, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

EEC-484/584EEC-484/584Computer NetworksComputer Networks

Lecture 12Lecture 12

Wenbing ZhaoWenbing Zhao

[email protected](Part of the slides are based on Drs. Kurose & (Part of the slides are based on Drs. Kurose &

RossRoss’’s slides for their s slides for their Computer Networking Computer Networking book)book)

Page 2: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

22

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

OutlineOutline

• Reminder:– April 7 5pm: CSU IS&T data center tour

• Quiz#3 results• Introduction to transport layer• Multiplexing/demultiplexing• Reliable data transfer mechanisms• Sliding window protocols (part I)

Page 3: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

33

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

EEC 584 Quiz#3 ResultsEEC 584 Quiz#3 Results• High: 100 (9 students!), low: 67, average: 93.4• Q1: 46.9/50, Q2: 17.6/20, Q3: 9.7/10, Q4: 19.2/20

Page 4: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

44

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Transport LayerTransport LayerOur goals: • Understand

principles behind transport layer services:– multiplexing/

demultiplexing– reliable data

transfer– flow control– congestion control

• Learn about transport layer protocols in the Internet:– UDP: connectionless

transport– TCP: connection-

oriented transport– TCP congestion control

Page 5: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

55

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Transport vs. Data Link LayerTransport vs. Data Link Layer

• Similarities: deal with error control, sequencing, flow control

• Difference: operating environments

Environment of the data link layer Environment of the transport layer

Page 6: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

66

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Transport vs. Network LayerTransport vs. Network Layer

• Network layer: logical communication between hosts

• Transport layer: logical communication between processes – Relies on, enhances, network layer services

Page 7: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

77

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Internet Transport-Layer ProtocolsInternet Transport-Layer Protocols

• Reliable, in-order delivery (TCP)– congestion control – flow control– connection setup

• Unreliable, unordered delivery: UDP– no-frills extension of “best-

effort” IP

• Services not available: – delay guarantees– bandwidth guarantees

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

logical end-end transport

Page 8: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

88

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Multiplexing/DemultiplexingMultiplexing/Demultiplexing

application

transport

network

link

physical

P1 application

transport

network

link

physical

application

transport

network

link

physical

P2P3 P4P1

host 1 host 2 host 3

= process= socket

delivering received segmentsto correct socket

Demultiplexing at rcv host:gathering data from multiplesockets, enveloping data with header (later used for demultiplexing)

Multiplexing at send host:

Page 9: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

99

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

How Demultiplexing WorksHow Demultiplexing Works• Host receives IP datagrams

– Each datagram has source IP address, destination IP address

– Each datagram carries 1 transport-layer segment

– Each segment has source, destination port number

• Host uses IP addresses & port numbers to direct segment to appropriate socket

source port # dest port #

32 bits

applicationdata

(message)

other header fields

TCP/UDP segment format

Page 10: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1010

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Reliable Data TransferReliable Data Transfer

characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)

Page 11: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1111

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Reliable Data TransferReliable Data Transfer

• Basic reliable data transfer mechanisms– Acknowledgement– Retransmission– Sequence numbers

Page 12: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1212

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Sliding Window ProtocolsSliding Window Protocols

• Full-duplex: Use same connection for data in both directions (AB and BA)

• Interleave data and ack packets– B piggybacks its ack for A’s packet onto B’s next packet– Savings of header in separate ack packet

• If B sends data infrequently, use timeout to determine when B should send ack in separate ack packet

• Each packet contains sequence number in ranges 0..2n-1 (for n-bit sequence numbers)

Page 13: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1313

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Sliding Window Protocols:Sliding Window Protocols:SendingSending

• Sending window– Start from 0 and grow to a maximum value– List of consecutive sequence numbers of outstanding packets

0 1 2 3 4 5 6 7

1st outstanding packet

Last packetsent

0 1 2 3 4 5 6 7

3ack

0 1 2 3 4 5 6 7

A new packet sent (if send window allows)

Sent window enlarges when more packet is sent

0 1 2 3 4 5 6 7

Sent window shrinks when the ack corresponding to the 1st outstanding packet Is received

Page 14: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1414

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Sliding Window Protocols:Sliding Window Protocols:SendingSending

• When new packet arrives from application layer, it is given next highest sequence number, and upper edge of window is incremented

• When ack arrives from receiver, lower edge of window is incremented

• Within sending window, packets sent but not acked– Sender must keep those packets for possible retransmission– If max window size = w, need w buffers

Page 15: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1515

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Sliding Window Protocols:Sliding Window Protocols:ReceivingReceiving

• Receiving window – list of consecutive sequence numbers of packets that receiver is permitted to accept

• When packet with (seq num = lower edge of window) arrives– Packet is passed to higher layer– Ack is generated– Window slid down by 1 (remains same size as was initially)

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

3

Page 16: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1616

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Reliable Data Transfer:Reliable Data Transfer:Sliding Window ProtocolsSliding Window Protocols

• A One-Bit Sliding Window Protocol• A Protocol Using Go Back n• A Protocol Using Selective Repeat

Page 17: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1717

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

One-Bit Sliding Window ProtocolOne-Bit Sliding Window ProtocolA sliding window of size 1, with a 3-bit sequence number

Initially After first packet sent

After first packet received

After first ack received

Page 18: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1818

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Sliding Window Protocols: PipeliningSliding Window Protocols: Pipelining

• Problem of one-bit sliding window protocol:– Sender blocks till receives acks

• Solution: pipelining– Allow sender to send up to w packets before blocking

• With pipelining, if packet in middle is lost or damaged, what to do with the packets following it ?

• Solution: two strategies– Go Back n - all the packets following it are discarded– Selective repeat – nack the lost/damaged packet and

retransmit that packet

Page 19: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

1919

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Pipelining and Error RecoveryPipelining and Error Recovery

Go back n: Effective receiver window size is 1

Packets discarded

Page 20: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2020

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Pipelining and Error RecoveryPipelining and Error Recovery

Selective repeat

Can you think of an alternative to go-back-n and selective-repeat?

Packets buffered

Page 21: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2121

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Go Back Go Back nn

• Sender– Stores all packets in output buffer– Must get acks in order in which packets are sent

• Receiver– Discards all packets following lost or damaged one

• Works well – If transmission errors rare and few retransmissions– If lot of traffic in both directions

Page 22: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2222

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Selective RepeatSelective Repeat

• Receiver accepts and buffers packets following lost or damaged packets

• Both sender and receiver maintain windows– Sender’s window starts at 0, grows to MAX SEQ– Receiver’s window fixed at MAX SEQ

• Receiver has buffer reserved for each seq num in its window

0 1 2 3 4 5 6 7

Page 23: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2323

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Selective RepeatSelective Repeat• When packet arrives, receiver checks if seq num in

window• If so and if not already received, this packet is accepted

and stored• If all lower numbered packets delivered, this packet is

delivered as well

0 1 2 3 4 5 6 7

5

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

3

Page 24: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2424

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Non-Sequential Receive Problem Non-Sequential Receive Problem

• New range of valid sequence numbers for receiver can overlap old range

• Overlap can contain duplicates• Example: n = 3-bit seq num (8 possible

numbers, 0 through 7, back to 0)

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Page 25: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2525

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Non-Sequential Receive ProblemNon-Sequential Receive Problem• Sender sends 0,1,2,3,4,5,6• Receiver

– Receives 0,1,2,3,4,5,6– Sends ack but ack gets lost– Expects to receive 7,0,1,2,3,4,5

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Page 26: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2626

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Non-Sequential Receive ProblemNon-Sequential Receive Problem• Sender times out, retransmits 0,1,2,3,4,5,6• Receiver checks 0 is in new window, thinks new 0

because has sent ack for old 6, waits for 7

0 1 2 3 4 5 6

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Page 27: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2727

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Non-Sequential Receive ProblemNon-Sequential Receive Problem

• Sender receives ack for 0-6, sends 7• Receiver receives 7, delivers 7 and

old 0 (as new 0 !)

7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Page 28: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2828

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Non-Sequential Receive ProblemNon-Sequential Receive Problem

• The problem is caused by the overlap of sequence number between the new receiving window and the old receiving window

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Overlap Overlap

Page 29: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

2929

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Non-Sequential Receive ProblemNon-Sequential Receive Problem

• Solution: – make sure no overlap when receiver advances its

window– Make window size w =1/2 range of seq numbers

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

No Overlap

Page 30: EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.

3030

Spring Semester 2008Spring Semester 2008 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Selective RepeatSelective Repeat

• If no reverse traffic before timer goes off, separate ack is sent

• When receiver suspects error, sends NAK back to sender (request for retransmission)

• Two circumstances that trigger NAK– Damaged packet arrives– Packet other than expected one arrives, suspect expected one is

lost

• Receiver sends only one NAK for packet expected