0% found this document useful (0 votes)
12 views17 pages

DCN 07-08 Sync 2018

The document discusses the tasks of the data link layer, focusing on error and flow control mechanisms such as Automatic Repeat Request (ARQ) and three common algorithms: Stop and Wait, Go Back N, and Selective Repeat. It details the processes involved in each algorithm for both transmitters and receivers, including handling acknowledgments and errors. Additionally, it covers the efficiency calculations for these algorithms based on frame error probability and transmission times.

Uploaded by

Đông Khang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views17 pages

DCN 07-08 Sync 2018

The document discusses the tasks of the data link layer, focusing on error and flow control mechanisms such as Automatic Repeat Request (ARQ) and three common algorithms: Stop and Wait, Go Back N, and Selective Repeat. It details the processes involved in each algorithm for both transmitters and receivers, including handling acknowledgments and errors. Additionally, it covers the efficiency calculations for these algorithms based on frame error probability and transmission times.

Uploaded by

Đông Khang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Data Communications and

Networks
Layer 2: Synchronization

Pham Quang Thai – pqthai.hcmut@gmail.com

1
Data link layer tasks

Error and Error


Binary data Framing
flow control detection

Transmitted Impaired Received

Error Error and


Synchronize Binary data
detection Flow control

2
Error and Flow control
• Ensure no error (corrupted or missing data): error
control
• Ensure correct data sequence: flow control
• Use Automatic Repeat Request (ARQ):
– Transmitter: send data until sending buffer is full
– Receiver: check for error and let the transmitter know
– Transmitter: resend error data or clear sending buffer for
new data
• Three common schemes
– Stop and Wait
– Go Back N
– Selective Repeat
Flow control: sliding window concept
• Transmitter: send frames within a “window” (range)
• Slide the window to new frames if old frames have
been correctly receive
• Window size is equal to transmitter buffer size
• Each frame is numbered to avoid missing
Error control
• Error detection:
– Corrupted data: use channel coding algorithm
– Missing data: compare frame number
– Timer at transmitter: waiting time in case of missing
frame
• Response:
– No error: send “acknowledgement” (ACK)
– Error:
• Explicit: send “negative - acknowledgement” (NAK)
• Implicit: wait for time out at transmitter
Stop and Wait algorithm at transmitter
• Initial: send number (SN) =0 [0,1], window size=1,
• Normal mode:
1. If buffer is free, accept frame, SN+1
2. Transmit frame SN, go to 1
3. If received ACK, RN>SN, clear frame with SN<RN, go to 1
4. If buffer is full, set timer, go to 3
5. If received NAK or timer out, go to re-transmission mode
• Re-transmission mode:
1. Re-transmit frame in buffer, set timer
2. If received ACK, RN>SN, clear frame with SN<RN
3. If received NAK or timer out, go to 1
4. If buffer is free, go to normal mode
Stop and Wait algorithm at receiver
• Initial: received number (RN) =0
• Normal mode:
1. Accept frame, check for error
2. If error, go to re-transmission mode
3. If no error, check SN
4. If SN=RN, send data to upper layer, RN=SN+1, send ACK-RN, go
to 1
5. If SN<RN, send ACK-RN, go to 1
• Re-transmission mode:
1. Send NAK and set timer (explicit) / do nothing (implicit)
2. Accept frame, check for error
3. If no error, check SN
4. If SN=RN, send data to upper layer, RN=SN+1, send ACK-RN, go
to normal mode
5. If time out, go to 1
Example of Stop and Wait
Go back N algorithm at transmitter
• Initial: send number (SN) =0 [0,2m-1], window size=2m-1,
• Normal mode:
1. If buffer is free, accept frame, SN+1
2. Transmit frame SN, go to 1
3. If received ACK, RN>SN, clear frame with SN<RN, go to 1
4. If buffer is full, set timer, go to 3
5. If received NAK or timer out, go to re-transmission mode
• Re-transmission mode:
1. Re-transmit all frames in buffer, set timer
2. If received ACK, RN>SN, clear frame with SN<RN
3. If received NAK or timer out, go to 1
4. If buffer is free, go to normal mode
Go back N algorithm at receiver
• Initial: received number (RN) =0
• Normal mode:
1. Accept frame, check for error
2. If error, go to re-transmission mode
3. If no error, check SN
4. If SN=RN, send data to upper layer, RN=SN+1, send ACK-RN, go
to 1
5. If SN<RN, send ACK-RN, go to 1
6. If SN>RN, go to re-transmission mode
• Re-transmission mode:
1. Send NAK and set timer (explicit) / do nothing (implicit)
2. Accept frame, check for error
3. If no error, check SN
4. If SN=RN, send data to upper layer, RN=SN+1, send ACK-RN, go
to normal mode
5. If time out, go to 1
Example of Go back N
Selective repeat algorithm at
transmitter
• Initial: send number (SN) =0 [0,2m-1], window size=2m-1,
• Normal mode:
1. If buffer is free, accept frame, SN+1
2. Transmit frame SN, set timer SN, go to 1
3. If received ACK, clear frame with SN=RN-1, go to 1
4. If buffer is full, go to 3
5. If received NAK or timer out, go to re-transmission mode
6. If received Receiver not Ready (RNR) , to go waiting mode
• Re-transmission mode:
1. Re-transmit frame SN in buffer, set timer SN
• Waiting mode:
1. Set waiting timer, wait for response
2. If time out, send Receiver Ready (RR), go to 1
3. If received RR, go to normal mode
Selective repeat algorithm at receiver
• Initial: received number (RN) =0, window size=2m-1
• Normal mode:
1. If buffer is free, accept frame, check for error
2. If error, go to re-transmission mode
3. Check buffer, if SN in buffer, RN=SN+1, send ACK-RN
4. If no error, save frame to buffer, RN=SN+1, send ACK-RN
5. If RN is continuous in buffer, send data to upper layer,
free buffer, set NAK flag to false, go to 1
6. If buffer is full, send RNR to Transmitter
7. If buffer is free and received RR, send RR
• Re-transmission mode:
1. If NAK flag is false, send NAK, set NAK flag and set timer
(explicit) / do nothing (implicit), go to normal mode
Example of Selective repeat
Efficiency
• Stop and Wait
– DTP (packet transmission time) [s] = frame length / bit rate
– DTA (ACK transmission time) [s] = ACK length / bit rate
– DP (propagation time) [s] = distance / velocity
– S (round trip time) [s] = DTP + DTA + 2DP
Efficiency
• Stop and Wait
– P (frame error probability)
– TO (time out)
– T (total time) T  (1  P) S  P(TO  T )
P
T  S  TO
1 P
– E (efficiency) DTP
ESW 
T
Efficiency
• Go back N and Selective repeat
– N (size of buffer) > S/DTP to ensure continuous
transmission
1 P
EGBN  ESR  1  P
1  P( N  1)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy