Module-2-DataLinkLayer
Module-2-DataLinkLayer
Layer
Module -3
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
• Data link layer is deals with algorithms for
achieving reliable efficient communication
between two adjacent machines( connected
machines).
• The DLL provides the functional and procedural
means to transfer data between machines and
might provide the means to detect and possibly
correct errors that may occur in the physical
layer.
• Machine A puts some bits on the wire and B
just takes them off
2
Shijo M Joseph Dept of Computer Science
• Local delivery of frames/ data units
• DLL do not cross the boundaries of a local
network.
• Inter network routing and global addressing
are higher layer functions.
• It has two sub layers
• 1. logical control layer
• 2. media access control
1. Byte count.
2. Flag bytes with byte stuffing.
3. Flag bits with bit stuffing.
4. Physical layer coding violations.
Bit stuffing. (a) The original data. (b) The data as they appear on
the line. (c) The data as they are stored in the receiver’s memory after destuffing.
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Simplex Protocol For Noisy Channel
Now let us consider the normal situation of a
communication channel that makes errors. Frames
may be either damaged or lost completely.
However, we assume that if a frame is
damaged in transit, the receiver hardware will detect
this when it computes the checksum.
If the frame is damaged in such a way that the
checksum is nevertheless correct, this protocol can
fail i.e., deliver an incorrect packet to the network
layer.
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
a) The network layer on machine A gives a series of
packets to its data link layer, which must ensure that
an identical series of packets are delivered to the
network layer on machine B by its data link layer.
b) In particular, the network layer on B has no way of
knowing that a packet has been lost or duplicated,
so the data link layer must guarantee that no
combination of transmission errors, however unlikely,
can cause a duplicate packet to be delivered to a
network layer. For this a sequence number can be
included.
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
At each instant of time, the receiver expects a particular
sequence number next. Any arriving frame
containing the wrong sequence number is rejected
as a duplicate.
When a frame containing the correct sequence number
arrives, it is accepted and passed to the network
layer.
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Protocol 3 differs from its predecessors in
that both sender and receiver have a variable
whose value is remembered while the data link
layer is in the wait state.
The sender remembers the sequence number
of the next frame to send in
next_frame_to_send; the receiver remembers
the sequence number of the next frame
expected in frame_expected.
Each protocol has a short initialization phase
before entering the infinite loop.
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
After transmitting a frame, the sender starts the timer
running. If it was already running, it will be reset to allow
another full timer interval.
The time interval should be chosen to allow enough
time for the frame to get to the receiver, for the receiver to
process it in the worst case, and for the
acknowledgement frame to propagate back to the sender.
Only when that time interval has elapsed is it safe to
assume that either the transmitted frame or its
acknowledgement has been lost, and to send a duplicate.
If the timeout interval is set too short, the sender will
transmit unnecessary frames. While these extra frames
will not affect the correctness of the protocol, they will
hurt performance
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
After transmitting a frame and starting the timer, the
sender waits for something exciting to happen.
Only three possibilities exist: an acknowledgement
frame arrives undamaged, a damaged
acknowledgement frame staggers in, or the timer
expires.
If a valid acknowledgement comes in, the sender
fetches the next packet from its network layer and puts
it in the buffer, overwriting the previous packet.
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
It also advances the sequence number. If a
damaged frame arrives or no frame at all
arrives, neither the buffer nor the sequence
number is changed so that a duplicate can be
sent.
When a valid frame arrives at the receiver, its
sequence number is checked to see if it is a
duplicate. If not, it is accepted, passed to the
network layer, and an acknowledgement is
generated. Duplicates and damaged frames
are not passed to the network layer.
Shijo M Computer
Joseph Dept Networks,
of Computer Science
Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
End
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011