introduction to computer networks...sliding window protocol using selective repeat • if the...

24
Introduction to Computer Networks Tian Song (嵩天), Ph.D., Assoc. Prof. [email protected]

Upload: others

Post on 10-Mar-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

Introduction to Computer Networks

Tian Song (嵩天), Ph.D., Assoc. [email protected]

Introduction to Computer Networks

Tian Song (嵩天), Ph.D., Assoc. [email protected]

Data Link Protocol

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian3

Outline

• Elementary Data Link Protocol

• Sliding Window Protocols

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian4

Elementary Data Link Protocol

1: An Unrestricted Simplex Protocol

2: A Simplex Stop‐and‐Wait Protocol

3: A Simplex Protocol for a Noisy Channel

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian5

Elementary Data Link Protocol

Some basic assumptions:–We have a machine A that wants to send data to machine B

– There is always enough data for A to send– There is a well‐defined interface to the network layer, and to the physical layer

– The receiver generally waits for an event to happen by calling wait_for_event

boolean, seq_nr, packet, frame_kind, frame

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian6

Elementary Data Link Protocol1: An Unrestricted Simplex Protocol

sender receiver

packet = from_network()

packet ‐> frame

to_physical(frame)

wait_for_event()

frame =  from_physical()

frame ‐> packet

to_network(packet)

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian7

Elementary Data Link Protocol

Issue of Protocol 1:

How to prevent the sender from flooding?

Solutions:

Control the pace of sending and receiving

Stop‐and‐Wait

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian8

Elementary Data Link Protocol2: A Simple Stop‐and‐Wait Protocol

sender receiver

packet = from_network()

packet ‐> frame

to_physical(frame)

wait_for_event()

wait_for_event()

frame =  from_physical()

frame ‐> packet

to_network(packet)

receiver sender

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian9

Elementary Data Link Protocol

Issue of Protocol 2:

How about we lost some frames?

Solutions:

(1) Lost a data frame  ‐>  Timer

(2) Lost a feedback frame  ‐>  Sequence Number

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian10

Elementary Data Link Protocol3: A Simplex Protocol for a Noisy Channel

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian11

Elementary Data Link Protocol3: A Simplex Protocol for a Noisy Channel

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian12

Improvement

Motivation:

from Simplex (单工) to Duplex (双工)

Observation:

Feedback frame is very small compared to data. 

Solution:

Piggybacking (捎带确认)

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian13

Sliding Window Protocols

Motivation:

Send more packets at one time

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian14

a: Initially.                                   b: After sending frame #1. 

c: After receiving frame #1.     d: After receiving ack for frame #1.

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian15

How to Understand?

Page 196, Q 23

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian16

Sliding Window Protocols4: One‐Bit Sliding Window Protocol

maximum window size: 1 

stop and wait

piggybacking

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian17

(a) Normal case.                       (b) Abnormal case. 

(序号, 确认, 包号)

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian18

Sliding Window ProtocolsProblem:

What should the receiver do if a frame is damaged?

Solution:(1) Request retransmission starting from frame #N

5: Sliding Window Protocol Using Go Back N

(2) Request just retransmission of damaged frame 

6: Sliding Window Protocol Using Selective Repeat

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian19

Sliding Window Protocols

否定确认

pipeline: 流水线

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian20

Sliding Window Protocol Using Selective Repeat

• If the receiver delivers all frames in its window just after sending an ACK for the entire window, we may have a serious problem:

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian21

Sliding Window Protocol Using Selective Repeat

• Solution

we must avoid overlapping send and receive windows, the 

highest sequence number must be at least twice the 

window size.

If window size: 0 – MAX_SEQ

Then,     protocol 6:

window size: (MAX_SEQ+1)/2.

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian22

Link Utilization

2. Stop‐and‐Wait

5. Sliding Window, Go back N

6. Sliding Window, selective repeat

Q 32, page 197

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian23

Conclusion

• Elementary Data Link Protocol

• Sliding Window Protocols

• Six Protocols

School of Computer Science and Technology, BIT, http://cs.bit.edu.cn/~songtian24

End

This page is intended blank.