0% found this document useful (0 votes)
43 views135 pages

G Unit-Ii

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)
43 views135 pages

G Unit-Ii

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/ 135

DATA LINK LAYER

UNIT-II
Data link layer:
Data-Link Layer has responsibility of transferring frames
from one node to adjacent node over a link
 DATA LINK LAYER DESIGN ISSUES:
 Data link layer has a number of specific functions to carry
out. These functions include
 Provides a well-defined service interface to the network layer.
 Determines how the bits of the physical layer are grouped into
frames (framing).
 Deals with transmission errors (CRC and ARQ).
 Systems which automatically request the
retransmission of missing packets or packets with
errors are called Automatic Repeat reQuest (ARQ)
 Regulates the flow of frames.
Data link layer-Introduction
 The data link layer takes the packets it gets from the network layer
and encapsulates them into frames for transmission .
 Each frame contains frame header ,a payload field for holding the
packet ,and a frame trailer

Sending Machine Receiving Machine


packet packet

Header payload field Trailer Header payload field Trailer

Relationship between packets and frames


Data link layer-Introduction
 Services Provided to the Network layer:
 The function of the data link layer is to provide services to
the network layer
 The principal service is transferring data from the network

layer on the source machine to the network layer on the


destination machine.

(a) Virtual Communication (b)Actual communication


Types of services provided to the Network Layer
 Unacknowledged Connectionless service

 Acknowledged Connectionless service

 Acknowledged Connection-Oriented service


Unacknowledged Connectionless service:
 It consists of having the source machine send
independent frames to the destination machine without
having the destination acknowledge them.
 No connection is established beforehand or released
afterward
 If a frame is lost due to noise on the line, no attempt is
made to recover it in the data link layer.
 Appropriate for voice, where delay is worse than bad
data.
 Most of the LANs use unacknowledged connection
less service in the data link layer
 Acknowledged Connectionless service
 when this service is offered, there are still no
logical connections used, but each frame sent is
individually acknowledged.
 In this way ,the sender knows whether a frame has
arrived correctly.
 If it has not arrived within a specified time interval
it can be sent again.
 This service is used over unreliable channels ,such
as wireless systems.
 Acknowledged Connection-Oriented service
 The most sophisticated service the data link layer can
provide to the network layer is connection-oriented service.
 The source and destination machines establish a
connection before any data are transferred
 Each frame sent over the connection is numbered ,and the
data link layer guarantees that each frame is received
exactly once and that all frames are received in the right
order
 When connection oriented service is used ,transfers go
through three distinct phases.
 1) Connection established
 2) Data transferred
 3) connection Released
Transport layer-End to End
ACK/NAK

1 2 3 4 5

Data Data Data Data

Data link layer-Hop by Hop

Data Data Data Data


1 2 3 4 5
ACK/ ACK/ ACK/ ACK/
NAK NAK NAK NAK
Services Provided to Network Layer

Placement of the Data link protocol


Framing:
 In order to provide service to the network layer the data link
layer must use the service provided to it by the physical layer.
 Physical layer is used to accept the raw bit stream and attempt
to deliver it to the destination
 The bit stream is not guaranteed to be error free
 The number of bits received may be less than ,equal to ,or
more than the number of bits transmitted, and they may have
different values
 It is up to the data link layer to detect and if necessary ,correct
errors.
 The usual approach is for the data link layer to break the bit
stream up into discrete frames and compute the checksum for
each frame.
Framing:
 When a frame arrives at the destination ,the checksum is
recomputed.
 If the newly computed checksum is different from the one
contained in the frame, the data link layer knows that an error
has occurred and take steps to deal with it.
 e.g., discarding the bad frame and possibly also sending
back an error report
 Breaking the bit stream up into frames is more difficult than it
at first appears, One way to achieve this framing is to insert
time gaps between frames, much like the spaces between words
in ordinary text.
Methods:

1) character count

2) Flag bytes with byte stuffing

3) starting and ending flags, with bit stuffing

4)Physical Layer Coding Violations


Character count:

A character stream a) with out errors b) with one error


• The first framing method uses a field in the header to specify
the number of characters in the frame.
• When the data link layer in the destination sees the character
count ,it knows how many characters follow and hence where the
end of the frame is.
Character count:
 The trouble with this algorithm is that the count can be
garbled by a transmission error.
 For example, if the character count of 5 in the second frame
becomes a 7,the destination will get out of synchronization and
will be unable to locate the start of the next frame.
 Disadvantages:
 The count can be garbled by the transmission error
 Resynchronization is not possible. Even if with checksum, the
receiver knows that the frame is bad there is no way to tell where
the next frame starts.
 Asking for retransmission doesn’t help either because the
start of the retransmitted frame is not known
 No longer used
 The second transmission method gets around the
problem of Resynchronization called character
stuffing.
 Most protocols used the same byte ,called flag byte,
as both the starting and ending delimiter as FLAG.
 Two consecutive flag bytes indicate the end of one
frame and start of the next one.
• Framing: Character stuffing – newer
protocols
– Frame starts / ends with same char: FLAG
starting and ending flags, with bit stuffing
 This new technique allows data frames to contain an
arbitrary number of bits and allow character codes with an
arbitrary number of bits per character.
 Each frame begins and ends with a special bit
pattern,01111110 called a flag byte.
 whenever the senders data link layer encounters six
consecutive ones in the data , it automatically stuffs a 0 bit into
the outgoing bit stream.
 whenever the receiver sees five consecutive incoming 1 bits,
followed by a 0 bit ,it automatically destuffs (i.e deletes) the 0
bit.
 If the flag pattern 01111110,this flag is transmitted as
011111010 but stored in the receiver memory as 01111110.
starting and ending flags, with bit stuffing

Bit stuffing
(a) The original data.
(b) The data as they appear on the line.
(c) The data as they are stored in receiver’s memory after
destuffing.
• Framing: Coding violation
– Redundancy in the encoding on medium is
required
– e.g. Manchester encoding: transition in the middle of a
slot

violation

– Use no transition in a slot (= coding violation) as start of frame

20
Error Control:

 Next problem: How to make sure all frames are eventually


delivered to the network layer at the destination, and in the
proper order.

 The usual way to ensure reliable delivery is to provide the


sender with some feedback about what is happening at the other
end of the line.

 The protocol calls for the receiver to send back special control
frames bearing positive and negative acknowledgements about
the incoming frames
Error Control:

 If the sender receives a positive acknowledgement about a


frame ,it knows the frame has arrived safely.
 on the other hand, a negative acknowledgement means that
something has gone wrong, and the frame must be transmitted
again.
 An additional complication comes from hardware troubles.
 Managing the Timers and sequence numbers so as to ensure
that each frame is ultimately passed to the network layer at the
destination exactly once.
Error Control:
 Maintaining Timers for Error Control: When a sender
transmits a frame, it generally also starts a timer .
 The timer is set to expire after an interval long enough for the
frame to reach the destination, be processed there ,and have
the acknowledgement to propagate back to the sender.
 Normally, the frame will be correctly received and the
acknowledgement will get back before the timer runs out ,in
which case the timer will be cancelled.
 However, if either the frame or the acknowledgement is lost
,the timer will go off ,alerting the sender to a potential
problem .the obvious solution is to just transmit the frame
again.
 Sequence number is used to recognize the duplicate packet.
Flow control:
 A sender that systematically wants to transmit frames faster
than the receiver can accept them..
 When the sender is running on a fast (or lightly loaded)
computer and the receiver is running on a slow (or heavily
loaded machine)
 The sender keeps pumping the frames out at a higher rate
until the receiver is completely swamped.
 Even if the transmission is error free ,at a certain point the
receiver will simply be unable to handle the frames as they
arrive and will start to lose someone
 To prevent this situation Feedback- based flow control &
Rate-based flow control mechanisms are used.
 Feedback- based flow control ,the receiver sends back
information to the sender giving it permission to send more
data .
 Rate based :Has built in mechanism with out feedback.
Error Detection and correction:
 In some cases it is sufficient to detect an error and in some, it
requires the errors to be corrected also.

 For e.g.
 On a reliable medium : Error Detection is sufficient where
the error rate is low and asking for retransmission after
Error Detection would work efficiently
 In contrast, on an unreliable medium : Retransmission after
Error Detection may result in another error and still
another and so on. Hence Error Correction is desirable.
Error Detection and Correction

• Types of Errors
• Error-Correcting Codes
• Error-Detecting Codes
Types of Errors
Single-Bit Error:

Burst Error:

(a)

(b)
Redundancy
 All error detection/correction methods are based on redundancy
Error detecting Codes:
 Polynomial code or CRC( Cyclic Redundancy Check )

 CRCs are among the best checksums available to detect errors


in communications transmissions
 polynomial codes are based upon treating bit strings as
representations of polynomials with coefficients of 0 and 1
only.
 A k-bit frame is regarded as the coefficient list for a
polynomial with K terms ,ranging from Xk-1 to x0. such a
polynomial is said to be of degree k-1.
 The higher order (left-most) bit is the coefficient of xk-1 .the
next bit coefficient of xk-2
 Ex: 110001 has 6 bits. It represents a six-term polynomial
with coefficients 1100001
 110001 : x5+x4+1
Error detecting Codes:
 When the polynomial code method is employed ,the sender
and receiver must agree upon a generator polynomial G(x) .
 In advance both higher and lower order bits of generator must
be 1.
 To compute the check sum for some frame with m bits
,corresponding to the polynomial M(x), the frame must be
longer than the generator polynomial.
 The idea is to append a checksum to the end of the frame in
such a way that the polynomial represented by the check
summed frame is divisible by G(x).
 When the receiver gets the check summed frame, it tries
dividing it by G(x). If there is a remainder ,there has been a
transmission error
Algorithm:

 Let r be the degree of G(x)


 Append r zero bits to the low-order end of the frame
,so it now contains m+r bits and corresponds to the
polynomial xrM(x).
 Divide the bit string corresponding to G(x) in to the
bit string corresponding to XrM(x) using modulo 2
division.
 subtract the remainder (which is always r or fewer
bits ) from the bit string correspond to xrM(x) using
modulo 2 subtraction.
 the result is the check summed frame to be
transmitted .call its polynomial T(x).
Calculation of the polynomial code checksum:

Frame: 1001 Generator : 1011


Division in the CRC decoder for two cases:
CRC
Example:

Message transmitted: T = 100100001


 The modulo-2 division process is defined as follows:

 Call the uppermost c+1 bits of the message the remainder

 Beginning with the most significant bit in the original message and for each
bit position that follows, look at the c+1 bit remainder:
 If the most significant bit of the remainder is a one, the divisor is said to
divide into it. If that happens (just as in any other long division) it is
necessary to indicate a successful division in the appropriate bit position
in the quotient and to compute the new remainder. In the case of
modulo-2 binary division, we simply:
 Set the appropriate bit in the quotient to a one, and
 XOR the remainder with the divisor and store the result back into the
remainder
 Otherwise (if the first bit is not a one):

 Set the appropriate bit in the quotient to a zero, and


 XOR the remainder with zero (no effect)
 Left-shift the remainder, shifting in the next bit of the message. The bit
that's shifted out will always be a zero, so no information is lost.

 The final value of the remainder is the CRC of the given message.
CRC
Why polynomials?

Standard polynomials:

(IEEE 802)
CRC

r bits

r+1 bits

r bits
Checksum
At the sender

The unit is divided into k sections, each of n


bits.
All sections are added together using one’s
complement to get the sum.
The sum is complemented and becomes the
checksum.
The checksum is sent with the data
Performance
The checksum detects all errors involving an
odd number of bits.
It detects most errors involving an even
number of bits.
If one or more bits of a segment are damaged
and the corresponding bit or bits of opposite
value in a second segment are also damaged,
the sums of those columns will not change and
the receiver will not detect a problem.
At the receiver

The unit is divided into k sections, each of n


bits.
All sections are added together using one’s
complement to get the sum.
The sum is complemented.
If the result is zero, the data are accepted:
otherwise, they are rejected.
Error correcting codes:
 A frame consists of m data (i.e,message ) bits and r
redundant, or check bits.
 Let the total length be n (i.e., n=m+r).an n-bit unit containing
data and check bits is often referred to as an n-bit codeword.
 Given any two code words ,say,10001001 and 10110001,it is
possible to define how many bits differ .In this case 3 bits
differ. To determine how many bits differ ,just EXCLUSIVE
OR the two code words ,and count the number of 1 bits in the
result. The number of bit positions in which two code words
differ is called the Hamming distance.
 Its significance is that if two code words are a hamming
distance d a apart, it will require d single-bit errors to convert
one into another.
Error correcting codes:
 Forward Error Correction: FEC is the only error correction
scheme that actually detects and corrects transmission errors at
the receive end with out calling for retransmission.
 Ex: Hamming code
 No of bits in hamming code is dependent on the no. of bits in
the data character by using the relation.
 2n>=m+n+1

 Where n=no. of hamming bits


 m= no. of bits in the data character

 Ex: For a 12-bit data stream of 101100010010,determine


the hamming bits ,assume a single bit in error & prove how
hamming code detects it.
Error correcting codes:
 No. of bits in hamming code
 2n>=m+n+1
 Take n=4

 24=16>=12+4+1
 16>=17
 Take n=5

 25=32>=12+5+1=18

 32>=18 ---- 5 bits are required for hamming code.

 12 bits of data +5 bits of code=17 bits of data stream.


Error correcting codes:
Hamming Code
Hamming Code
Hamming Code
Example of Hamming Code
Single-bit error
Error
Detection
Hamming Code: Alternate method

 consider the example m= 1101110


 2n >=m+n+1
 n=4 i.e 24>=7+4+1
 16>=12
 4 hamming bits needed.

11 10 9 8 7 6 5 4 3 2 1

1 1 0 r 1 1 1 r 0 r r
11 10 9 8 7 6 5 4 3 2 1
1 1 0 r 1 1 1 r 0 r r
Express all bit positions that contains a 1 as four bit number and xor them together.
Bit position binary number
5 0101
6 0110
Xor 0011
7 0111
xor 0100
10 1010
xor 1110
11 1011
0101
Error correcting codes:

 Hamming code: 0101


 positions: b1=1 b2=0 b4=1 b8=0
 The 11 bit data stream is

11 10 9 8 7 6 5 4 3 2 1

1 1 0 r 1 1 1 r 0 r r

1 1 0 0 1 1 1 1 0 0 1
Error correcting codes:

 proof: If the receiver receive an error at 7 th position i.e 1 is


misinterpreted as 0,then the error message received in.

11 10 9 8 7 6 5 4 3 2 1

1 1 0 0 1 1 1 1 0 0 1

The garbled data is: 11000111001


Error correcting codes:

 At receiver: hamming code 0101


5 0101
xor 0000
6 0110
xor 0110
10 1010
xor 1100
11 1011
0111
Error correcting codes:

Use of a Hamming code to correct burst errors .


Frame header of Data link layer

 packet

network layer buffer

frame

data link layer info ack seq kind


Flow and Error Control
Data link control = flow control + error control
Flow control refers to a set of procedures used to restrict the
amount of data that the sender can send before waiting for
acknowledgement
Error control in the data link layer is based on automatic repeat
request (ARQ), which is the retransmission of data
ACK, NAK(Negative ACK), Piggybacking (ACKs and NAKs in data
frames)
Elementary Data link Protocols:
 Protocols:
 1) unrestricted simplex protocol
 2) A simplex stop-and-wait protocol
 3) A simplex protocol for a Noisy Channel
Protocol Definitions

Continued 
Some definitions needed in the protocols to follow.
These are located in the file protocol.h.
Protocol
Definitions
(ctd.)

Some definitions
needed in the
protocols to follow.
These are located in
the file protocol.h.
unrestricted simplex protocol
 Data are transmitted in one direction only.
 Both the transmitting and receiving network layers are always
ready
 processing time can be ignored
 Infinite buffer space is available
 The protocol consists of two distinct procedures, a sender and
a receiver. The sender runs in the data link layer of the source
machine and the receiver runs in the data link layer of the
destination machine.
 MAX-SEQ is not used because No sequence numbers and
Acknowledgements are used here.
 The only event type possible is frame-arrival (i.e. an arrival of
undamaged frame)
Noiseless Channels: Simplest Protocol
Simplest protocol with no flow or error control
Flow diagram for Noiseless Channels: Simplest Protocol

11.66
A simplex stop-and-wait protocol:
 If data frames arrives at the receiver side faster than
they can be processed, the frames must be stored until
their use
 Normally ,the receiver does not have enough storage
space ,especially if it is receiving data from many
sources
 This may result in the discarding frames
 To prevent this there must be feedback from the
receiver to the sender.
A simplex stop-and-wait protocol:
 Def : Protocol in which the sender sends one frame
and then waits for acknowledgement before
proceeding is called stop-and-wait.
 Flow Diagram:
A B
Request
Frame
Arrival
Ack
Arrival
Frame
Request Ack
Arrival
Stop-and-Wait Protocol
Simple tokens of ACK and flow control added
Stop-and-Wait Protocol: Example
A simplex stop-and-wait protocol:
 Receiver 2 is that after delivering a packet to the network
layer, receiver 2 sends an acknowledgement frame back to the
sender before entering the wait loop again. because the only
arrival of the frame back at the sender is important. the
receiver need not put any particular information on it.
 points:
 1) sender start out fetching a packet from the network layer,
using it to construct a frame and sending it on its way.
 2)sender must wait until an acknowledgement frame
arrives before looping back and fetching the next packet
from the network layer
A simplex protocol for a Noisy Channel
 The channel is noisy, frames may be damaged or lost
 Good scene : data frame reaches intact, ack sent back and
received, next frame sent
 Bad scene :
 Data frame damaged or lost ..hence no ack – sender times

out and resends .. No problems


 Data frame reaches intact but Ack lost .. Times out

..resends.. Receiver receives duplicate frames. Problem


 Solution :Keep a sequence number for each frame to

distinguish between the new frame and a duplicate frame


A simplex protocol for a Noisy Channel
 What should be minimum number of bits required for the
sequence number?
 The only ambiguity in this protocol is between a frame,m.and
its direct successor,m+1.If a frame m is lost or damaged ,the
receiver will not acknowledge it ,so the sender will keep
trying to send it. Once it has been correctly received ,the
receiver will send an ack back to the sender. Depending upon
whether the acknowledgement frame gets back to the sender
correctly or not ,the sender may try to send m or m+1.the
event triggers the sender to start sending m+2 is the arrival
of an acknowledgement m+1.
 Protocols in which the sender waits for a positive
acknowledgement before advancing to the next data item are
often called (PAR-Positive acknowledgement retransmission
or ARQ- Automatic Repeat Request)
A simplex protocol for a Noisy Channel

A positive
acknowledg
ement with
retransmissi
on protocol.
A simplex protocol for a Noisy Channel

A positive acknowledgement with retransmission protocol.


Noisy Channels: Stop-and-Wait ARQ
Stop-and-wait Automatic Repeat Request (ARQ)
Error correction in Stop-and-Wait ARQ is done by keeping a
copy of the sent frame and retransmitting of the frame
when the timer expires
In Stop-and-Wait ARQ, we use sequence numbers to number
the frames. The sequence numbers are based on modulo-2
arithmetic
Acknowledgment number always announces in modulo-2
arithmetic the sequence number of the next frame
expected.
Stop-and-Wait ARQ
Stop-and-Wait ARQ: Example
Contd..
• The Stop-and-Wait ARQ is very inefficient if
our channel has a large bandwidth and long
round-trip delay.
• There is no Pipelining in this protocol
because we need to wait for a frame to reach
the destination and be acknowledged before
the next frame is sent.
Sliding window protocols
 Must be able to transmit data in both directions.
 Choices for utilization of the reverse channel:
 mix DATA frames with ACK frames.

 Piggyback the ACK

 Receiver waits for DATA traffic in the opposite direction.

 Use the ACK field in the frame header to send sequence


number of frame being ACKed.
  better use of the channel capacity.
Sliding window protocols:
 In the Previous protocols ,Data frames were transmitted in one
direction only.
 In most practical situations ,there is a need for transmitting
data in both directions.
 One way of achieving full-duplex data transmission is to have
two separate communication channels and each one for
simplex data traffic (in different directions)
 we have two separate physical circuits ,each with a
“forward” channel (for data) and a “reverse” channel( for
acknowledgements).
 Data
source Destination
Acknowledgements
Sliding window protocols:
 Disadvantage: The bandwidth of the reverse channel is almost
entirely wasted.
 A better idea is to use the same circuits for data in both
directions
 In this model the data frames from A and B are intermixed
with the acknowledgement frames from A to B.
 Kind: kind field in the header of an incoming frame, the
receiver can tell whether the frame is data or
acknowledgements.
Sliding window protocols:
 Piggybacking:
Frame sent(Frame1)

source Destination
Ack(frame1)+Frame2
• When a data frame arrives, instead of immediately sending a separate
control frame, the receiver restrains itself and waits until the network layer
passes it the next packet.
• The acknowledgement is attached to the outgoing data frame
• Disadv: This technique is temporarily delaying outgoing
acknowledgements.
• If the datalinklayer waits longer than the senders timeout period, the
frame will be retransmitted.
Sliding window protocols:
 Rule: sender waiting a fixed number of milliseconds. If a
new packet arrives quickly the acknowledgement is
piggybacked onto it. other wise if no new packet has arrived
by the end of this time period ,the data link layer just sends a
separate acknowledgement frame.
 In sliding window protocol each frame contains a sequence
number ranging from 0 up to some maximum.
 The maximum is usually 2n-1 so the sequence number fits
nicely in an n-bit field.
 The stop-and-wait sliding window protocol uses n=1
restricting the sequence numbers 0 and 1.
 The sender must keep all these frames in its memory for
possible retransmission
Sliding window protocols:
 Thus if the maximum window size is n, the sender needs n
buffers to hold the unacknowledged frames
 3 bit field -000
001
010..etc
here n=3 i.e. 23-1=7
window size is 0 to 7
Sliding window :: sender has a window of frames and maintains a
list of consecutive sequence numbers for frames that it is
permitted to send without waiting for ACKs.
receiver has a window that is a list of frame sequence numbers it is
permitted to accept.
Note – sending and receiving windows do NOT have to be the same
size.
Sliding window protocols:

A sliding window of size 1, with a 3-bit sequence number.


(a) Initially.
(b) After the first frame has been sent.
(c) After the first frame has been received.
(d) After the first acknowledgement has been received.
Sliding window protocols:
 Sliding window protocols: 3 methods
 1) 1-bit sliding window protocol
 2) Go –Back N
 3) Selective Repeat
 1-bit sliding window protocol:
 Window size 1.
 Stop-and-wait.
 Must get ack before can send next frame.
 Both machines are sending and receiving.
1-bit sliding window protocol
1-bit sliding window protocol
1-bit sliding protocol :
 Example:
 A trying to send its frame 0 to B.
B trying to send its frame 0 to A.
 Imagine A's timeout is too short. A repeatedly times out and

sends multiple copies to B, all with seq=0, ack=1.


When first one of these gets to B, it is accepted. Set
expected=1. B sends its frame, seq=0, ack=0.
All subsequent copies of A's frame rejected since seq=0 not
equal to expected. All these also have ack=1.
B repeatedly sends its frame, seq=0, ack=0. But A not
getting it because it is timing out too soon.
Eventually, A gets one of these frames. A has its ack now
(and B's frame). A sends next frame and acks B's frame.
1-bit sliding protocol :

Two scenarios for protocol 4. (a) Normal case. (b) Abnormal


case. The notation is (seq, ack, packet number). An asterisk
indicates where a network layer accepts a packet.
A protocol using Go Back N:
Go Back n, is for the receiver simply to discard all subsequent
frames, sending no acknowledgements for the discarded frames.
This strategy corresponds to a receive window of size 1.
The data link layer refuses to accept any frame except the next one
it must give to the network layer.
Points: fig ( a)
1) frame 0 and 1 correctly received and Acknowledged
2) Frame 2 is damaged or lost ,The sender continuous to send
frames until the timer for frame 2 expires.
3) Then it backs up to frame 2 and starts all over with it ,sending
2,3,4 etc. all over again.
A protocol using Go Back N:
Go-Back-N ARQ
• Pipelining improves the efficiency of the transmission
• In the Go-Back-N Protocol, the sequence numbers are modulo
2m, where m is the size of the sequence number field in bits
• The send window is an abstract concept defining an imaginary
box of size 2m − 1 with three variables: Sf, Sn, and Ssize
• The send window can slide one or more slots when a valid
acknowledgment arrives.
Go-Back-N ARQ
• Receive window for Go-Back-N ARQ
• The receive window is an abstract concept defining an
imaginary box of size 1 with one single variable Rn. The window
slides when a correct frame has arrived; sliding occurs one slot
at a time.
Go-Back-N ARQ
• Sliding windows, Timers, ACK, Resending a frame
Go-Back-N ARQ: Send Window
Size
• In Go-Back-N ARQ, the size of the send window must be less
than 2m; the size of the receiver window is always 1
• Stop-and-Wait ARQ is a special case of Go-Back-N ARQ in
which the size of the send window is 1
Go-Back-N ARQ: Sender Algorithm
Go-Back-N ARQ: Receiver Algorithm
Go-Back-N ARQ: Example 1
Go-Back-N ARQ: Example 2
Selective Repeat:
 When selective repeat is used ,a bad frame that is received is
discarded. But good frames after it are buffered.
 when the senders timeout ,only the oldest unacknowledged
frame is retransmitted.
 If that frames arrives correctly ,the receiver can deliver it to the
network layer in sequence all the frames it has buffered.
 fig (b) :
 1) Frames 0 and 1 correctly received and acknowledged.
 2) Frame 2 is lost, when frame 3 arrives at the receiver ,the data link
layer notices that it has a missed frame. so it sends back a NAK for 2 but
buffers 3
 3) when frame 4 and 5 arrive ,they are buffered by the data link layer
instead of being passed to the network layer
 4)The NAK 2 gets back to the sender which immediately resends frame 2.
A protocol using selective repeat:
Selective Repeat ARQ
• Sender window size

• Receive window size


Selective Repeat ARQ
Selective Repeat ARQ: Window Size
• The size of the sender and receiver window must be at most
one-half of 2m
Selective Repeat ARQ: Sender-Site Algorithm
Selective Repeat ARQ: Receiver-Site Algorithm
Selective Repeat ARQ: Example
Piggybacking
• To improve the efficiency of the bidirectional protocols
• Piggybacking in Go-Back-N ARQ
HDLC
• High-level Data Link Control is a bit-oriented protocol for
communication over point-to-point and multipoint links.
• Two common transfer mode: normal response mode (NRM)
and asynchronous balanced mode (ABM)

NRM

ABM
FRAMES

• To provide the flexibility necessary to support


all the options possible in the modes and
configuration, HDLC defines three types of
frames:
Information frames(I-frame)
Supervisory frames(S-frames)
Unnumbered frames(U-frames)
• I-frames are used to transport user data and the
control information relating to user
data(Piggybacking).
• S-frames are used only to transport control
information.
• U-frames are reserved for system management.
The information carried by U-frame is intended
for managing the link itself.
HDLC frames:
HDLC: Frames
• Flag field: 01111110 to identify both the beginning and the end of a
frame and serve as synchronization pattern for receiver.

• Address: contains address of secondary station. If a primary station


created the frame, it contains a to address. If secondary creates the
frame, it contains a from address(1 byte or several bytes long).

• Control field: 1-or 2-bytes segment used for flow and error control
(interpretation depends on the frame type).

• Information field: contains the user’s data from the network layer or
management information(its length vary from one network to another)

• FCS field: 2- or 4-byte ITU-T CRC for error detection


Control Field
• Control Field: 1- or 2-byte segment of the frame used for flow and
error control
• Determine the type of frame and define its functionality
• Control field for I-frame: P/F (poll/final bit for primary/secondary)
HDLC: Frames
• Control field for S-frame
• Used for flow and error control whenever piggybacking is either
impossible or inappropriate
• Receive ready (RR), Receive not ready (RNR), Reject (REJ) Selective
reject (SREJ)
HDLC: Frames
• Control field for U-frame
HDLC: Example 1
• Connection and disconnection
HDLC: Example 2
• Piggybacking without error
HDLC: Example 3
• Piggybacking with error
HDLC: Bit Stuffing and Unstuffing
Example Data Link Protocols:
The Data Link Layer in the Internet - LANs use
broadcast protocols (Ethernet) to connect many hosts
but interconnection of LANs into larger networks is
primary done through routers running a point-to-point
protocol. In the case of the Internet, point-to-point
protocol is also used to connect host to router in the
form of an Internet Service Provider. Two point-to-point
protocols widely used on the Internet are SLIP and PPP.
SLIP – Serial Line Internet Protocol- Designed to connect
hosts to the internet over serial communications.
The Data Link Layer in the Internet

A home personal computer acting as an


internet host.

A home personal computer acting as an internet host.


PPP operation
 PC calls the provider’s router via a modem.
 After establishment of the connection PC sends a series of
LCP packets.
 Then a series of NCP packets are sent to configure the
network layer.
 Now PC is ready to send and receive IP packets.
 After finishing again NCP packets are sent to tear down
the network layer connections.
 Finally LCP packets are used to shutdown the
connection.
 PC releases the physical connection via the modem.
SLIP – Serial Line Internet Protocol
 Designed to connect hosts to the Internet over serial
communications.
 Send raw IP packets over serial (possibly modem) line with
C0 hex at end for framing, if occurs in IP packet uses
character stuffing.
 Recent versions use TCP and IP header compression by
omitting when multiple packets going to same destination.
 No error detection/correction, responsibility of higher layers.
 Supports only IP.
 No authentication (though could be handled by higher
layers).
 Fixed IPs, both must know each others in advance (not a
problem if yours and ISP never change).
Drawbacks of SLIP

 SLIP does not do error detection and correction


 SLIP supports only IP
 Each side must know others IP address in
advance
 SLIP does not provide any form of authentication
 SLIP is not approved as internet standard
PPP - Point-to-Point Protocol
 Fixes many of SLIPs problems and is an official Internet
protocol
 Used in Dial-up connection between residential host and ISP
 Framing
 Byte stuffing
 Connection oriented
 Error detection by checksum.
 Permits authentication.
 LCP: It is responsible for establishing the connection and
releasing the connection
 NCP: Network Control Protocol – It provides all the services
of Network layer
 Overcomes all deficiencies of SLIP.
 A better framing method.
 Frame format supports error detection.
 Provide with a Link Control protocol (LCP), for
bringing lines up, testing them, negotiating options,
and bringing then down back.
 Have different NCP (Network Control Protocol) for
each different network protocol.
PPP - Point-to-Point Protocol
• Flag: A PPP frame starts and ends with a 1-byte flag with the bit pattern
01111110.It is a byte-oriented protocol. The flag is treated as a byte.
• Address: It is a constant value and is set to 11111111(broadcast
address).During negotiation, the two parties may agree to omit this byte.
• Control:11000000(imitating U-frame in HDLC).PPP does not provide any
flow control. Error control is also limited to error detection.
• Protocol: It defines what is being carried in the data field:either user data or
other information.
• Payload field: It carries either the user data or other information. The
default of max..1500 bytes.
• FCS: 2-bytes or 4-bytes standard CRC.
Byte Stuffing:

• PPP is a byte oriented protocol.


• The flag in PPP is a byte and needs to be escaped
whenever it appears in the data section of the frame.
• The esc byte is 01111101,means that every time the
flag like pattern appears in the data, this extra byte is
stuffed to tell the receiver that the next byte is not a
flag.
PPP – Point to Point Protocol

A simplified phase diagram for bring a line up and down.


l PPP – Point to Point Protocol

• The LCP frame types.

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