Вы находитесь на странице: 1из 23

The Data Link Layer

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Elementary Data Link Protocols

• Unrestricted Simplex Protocol


• Simplex Stop-and-Wait Protocol
Error-Free Channel
• Simplex Stop-and-Wait Protocol
Noisy Channel

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Elementary Data Link Protocols

...

Some definitions needed in the protocols to follow. These


definitions are located in the file protocol.h.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Unrestricted Simplex Protocol
Unrealistic protocol with:
• Data are transmitted in one direction only.
• Both transmitting and receiving network layers are
always ready.
• Processing time can be ignored.
• Infinite buffer space is available.
• Communication channel is error free!!

So this protocol is also called “Utopia”

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Unrestricted Simplex Protocol
• The protocol consists of two procedures.-
• sender and receiver procedure

• The sender runs in the data link layer of the source


machine and receiver runs in destination machine.

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Utopian Simplex Protocol

...

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Utopian Simplex Protocol

A utopian simplex protocol.

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Simplex Stop-and-Wait Protocol

• We have to take care about the flooding situation.

• i.e prevent the sender from flooding the receiver with


data faster than the latter is able to process them.

• One method is to insert a delay into protocol1 to slow it


down sufficiently to keep from swamping the receiver.

• It leads to bandwidth utilization that is far below the


optimum.

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Simplex Stop-and-Wait Protocol

• A general solution is receiver provide feedback to the


sender.

• After sending packets to the network layer, receiver


sends a little dummy frame back to the sender which
gives the permission to send the next frame.

• Protocol in which the sender sends one frame and then


waits for ack before proceeding are called Stop-and-
wait.

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Simplex Stop-and-Wait Protocol

...
A simplex stop-and-wait protocol.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Simplex Stop-and-Wait Protocol

A simplex stop-and-wait protocol.

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
A simplex protocol for noisy channel

• Channel with errors.


• Frames may be damaged or lost completely.
• Timer- may leads to duplication.
• Sequence no.
• 1 bit sequence no (0 or 1) -modulo 2
• Sender waits for a positive ack before sending next.
• Also called PAR(Positive Ack with Retransmission)
or ARQ(Automatic Repeat reQuest) protocol.
• This protocol also transmit data in one direction.
A simplex protocol for noisy channel

• Here both sender and receiver have a variable,


whose value is remembered while the data link layer
in wait state.
• The sender remembers the sequence no.of the next
frame to send and receiver remembers the
sequence no. of next frame expected.
Data Frame Transmission
• Unidirectional assumption in previous
elementary protocols
 Not general
• Full-duplex - approach 1
– Two separate communication channels
• Forward channel for data
• Reverse channel for acknowledgement
 Problems: 1. reverse channel bandwidth wasted
2. cost

14
Data Frame Transmission
• Full-duplex - approach 2
– Same circuit for both directions
– Data and acknowledgement are intermixed
– How do we tell acknowledgement from data?
"kind" field telling data or acknowledgement
– Can it be improved?
• Approach 3
– Attaching acknowledgement to outgoing data
frames
 Piggybacking
15
Piggybacking
• Temporarily delaying transmission of outgoing
acknowledgement so that they can be hooked
onto the next outgoing data frame
• Advantage: higher channel bandwidth
utilization
• Complication:
– How long to wait for a packet to piggyback?
– If longer than sender timeout period then
sender retransmit
 Purpose of acknowledgement is lost

16
Piggybacking
• Solution for timing complexion
– If a new packet arrives quickly
 Piggybacking
– If no new packet arrives after a receiver ack
timeout
 Sending a separate acknowledgement frame

17
Sliding window protocols
• 3 bidirectional sliding window protocols:
– One-bit sliding window protocol (1, 1)
– Go back N (>1, 1)
– Selective repeat (>1, >1)
(max sending window size, receiving window size)
• Here, at any instant of time, the sender maintains a set
of sequence nos corresponding to frames it is permitted
to send.
• These frames are said to fall within sending window.
• Similarly receiver maintains receiving window
corresponding to the set of frames it is permitted to
receive.
A one-bit sliding window protocol
• Here max window size is 1.
• Uses stop-and-wait.
• i.e sender sends frame and waits for ack
• Two variables:
• Next_frame_to_send tells which frame the sender is
trying to send.
• Frame_expected tells which frame the receiver is
expecting.
Go Back N
Go back N
• Here after occuring an error, the receiver simply discard
the incoming frames.

• The sender, unaware of this problem, continues to send


frames until the timer for damaged frame(here frame 2)
expires.

• Then it go back and starts sending the frames from 2


onwards.
Selective repeat
• Here bad frames that is received is discarded, but good
frames received after it are buffered.
• When the sender times out, only the oldest
unacknowledged frame is retransmitted.
• Receiver produce a Neg ack (NAK)when it detects an
error.
End

Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011

Вам также может понравиться