Docsity

Data Link Layer - Computer Networks - Lecture Slides | CS 4457, Study notes of Computer Systems Networking and Telecommunications

Partial preview of the text

Download Data Link Layer - Computer Networks - Lecture Slides | CS 4457 and more Study notes Computer Systems Networking and Telecommunications in PDF only on Docsity!

1

Data Link Layer

Flow Control

Copyright by Jorg Liebeherr 98,99 2

Flow Control

n Flow Control is a technique for speed-matching of transmitter and receiver. Flow control ensures that a transmitting station does not overflow a receiving station with data

n We will discuss two protocols for flow control:

n Stop-and-Wait

n Sliding Window

n For the time being, we assume that we have a perfect channel ( no errors)

Copyright by Jorg Liebeherr 98,99 3

Stop-and-Wait Flow Control

n Simplest form of flow control

n In Stop-and-Wait flow control, the receiver indicates its readiness to receive data for each frame

n Operations:

1. Sender: Transmit a single frame 2. Receiver: Transmit acknowledgment (ACK) 3. Goto 1.

Copyright by Jorg Liebeherr 98,99 4

Analysis of Stop-and-Wait

Frame ACK

Frame ACK

Receiver

Sender

propagation delay

Last bit received End of Transmit of ACK

Start Transmit End Transmit Last bit of ACK received

transmission delay

Efficiency =?

Copyright by Jorg Liebeherr 98,99 7

Operation of Sliding Window

n Receiving Window:

n The receiver maintains a receiving window corresponding to the sequence numbers of frames that are accepted

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

Frames already received Window of frames that areaccepted by receiver

Last frame acknowledged Window shrinks as frames are received

Window expands as acknowledgements are sent

Copyright by Jorg Liebeherr 98,99 8

Operation of Sliding Window

n How is “flow control” achieved?

n Receiver can control the size of the sending window

n By limiting the size of the sending window data flow from sender to receiver can be limited

n Interpretation of ACK N message: n Receiver acknowledges all packets until (but not including) sequence number N

Copyright by Jorg Liebeherr 98,99 9

Example

Transmitter Receiver

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

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

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

F F F

ACK4 (^) 3

Copyright by Jorg Liebeherr 98,99 10

Example Continued

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

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

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

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

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

F

F4 ACK F F

4

Copyright by Jorg Liebeherr 98,99 13

ARQ Error Control

n Types of errors: Lost frames, damaged frames n Most Error Control techniques are based on (1) Error Detection Scheme (e.g., Parity checks, CRC), and (2) Retransmission Scheme

n Error control schemes that involve error detection and retransmission of lost or corrupted frames are referred to as Automatic Repeat Request ( ARQ ) error control

Copyright by Jorg Liebeherr 98,99 14

ARQ Schemes

n The most common ARQ retransmission schemes:

n Stop-and-Wait ARQ

n Go-Back-N ARQ

n Selective Repeat ARQ

n The protocol for sending ACKs in all ARQ protocols are based on the sliding window flow control scheme

Copyright by Jorg Liebeherr 98,99 15

Stop-and-Wait ARQ

n Stop-and-Wait ARQ is an addition to the Stop-and- Wait flow control protocol:

n Frames have 1-bit sequence numbers ( SN = 0 or 1) n Receiver sends an ACK (1-SN) if frame SN is correctly received n Sender waits for an ACK (1-SN) before transmitting the next frame with sequence number 1-SN n If sender does not receive anything before a timeout value expires, it retransmits frame SN

Copyright by Jorg Liebeherr 98,99 16

Stop-and-Wait ARQ

Frame 1

n Lost Frame A

B

ACK 0

Frame 0

Timeout

ACK 1

Frame 1 Frame 1

ACK 0

Copyright by Jorg Liebeherr 98,99 19

Go-Back-N ARQ

n Operations:

n A station may send multiple frames as allowed by the window size

n Receiver sends a NAK i if frame i is in error. After that, the receiver discards all incoming frames until the frame in error was correctly retransmitted n If sender receives a NAK i it will retransmit frame i and all packets i+1, i+2,... which have been sent, but not been acknowledged

Copyright by Jorg Liebeherr 98,99 20

Go-Back-N ARQ

Frame 0

n Lost Frame A

B

Frame 1 Frame 2Frame 3Frame 4

ACK 3

Frame 5Frame 6

NAK 4

Frame 4Frame 5Frame 6

Frames 4,5, are retransmitted

ACK 6

Frames 5 and 6 are discarded

Copyright by Jorg Liebeherr 98,99 21

Go-Back-N ARQ

Frame 0

n Lost ACK

A

B

Frame 1 Frame 2Frame 3

ACK 3

Frame 4 Frame 0 Frame 3Frame 4Frame 5

Frames 0- are retransmitted Timeout

Frame 1Frame 2

ACK 3 ACK 5

Frames 3 and 4 are discarded

Copyright by Jorg Liebeherr 98,99 22

Selective-Repeat ARQ

n Similar to Go-Back-N ARQ. However, the sender only retransmits frames for which a NAK is received

n Advantage over Go-Back-N: n Fewer Retransmissions.

n Disadvantages: n More complexity at sender and receiver

n Each frame must be acknowledged individually (no cumulative acknowledgements)

n Receiver may receive frames out of sequence