0% found this document useful (0 votes)
74 views29 pages

CN Unit-2 Notes

Uploaded by

suneelklu
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)
74 views29 pages

CN Unit-2 Notes

Uploaded by

suneelklu
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/ 29

UNIT-2

DATALINK LAYER

Data Link Layer is second layer of OSI Layered Model. This layer is one of the most complicated layers and has
complex functionalities and liabilities. Data link layer hides the details of underlying hardware and represents itself to
upper layer as the medium to communicate.

DESIGN ISSUES:

Design issues are:


1) Services 2) framing 3)error control 4) flow control
The data link layer uses the services of the physical layer to send and receive bits over communication channels. It has a
number of functions, including:
1. Providing a well defined service interface to the network layer.
2. Dealing with transmission errors.
3. Regulating the flow of data so that slow receivers are not swamped by fast senders.
Relationship between packets and frames:
To accomplish these goals, the data link layer takes the packets it gets from the network layer and encapsulates them into
frames for transmission. Each frame contains a frame header, a payload field for holding the packet, and a frame trailer, as
illustrated in Figure 3.1. Frame management forms the heart of what the data link layer does.

Fig 3.1 relationship between packets and frames

Services Provided to the Network Layer:

• Data link: describes how a shared communication channel can be accessed, and how a data frame can be reliably
transmitted.
• Data link layer is responsible for transmitting data from source network layer to destination network layer
• Source network layer passes a number of bits to data link layer, who then packs them into frames and relies on
physical layer to do actual communication. Receiving data link layer unpacks frames and passes bits to its
network layer as shown in Figure 3.2 and Figure 3.3.
The basic services commonly provided are:
1 Unacknowledged connectionless:
• Unacknowledged connectionless service consists of having the source machine send independent frames
to the destination machine without having the destination machine acknowledge them.
• No logical connection is established beforehand or released afterward. If a frame is lost due to noise on
the line, no attempt is made to detect the loss or recover from it in the data link layer.
• This class of service is appropriate when the error rate is very low. Most LAN’S use this service.
2 Acknowledged connectionless:
• When this service is offered, there are still no logical connections used, but each frame sent is
individually acknowledged.

1
• In this way, the sender knows whether a frame has arrived correctly or been lost. If it has not arrived
within a specified time interval, it can be sent again.
• This service is useful over unreliable channels, such as wireless systems.
3 Acknowledged connection-oriented:
• This is the most sophisticated service the data link layer can provide to the network layer
• With this 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 sent
is indeed received.
• It guarantees that each frame is received exactly once and that all frames are received in the right order.
• It is appropriate over long, unreliable links such as a satellite channel or a long-distance telephone circuit.

Figure 3.2 a) virtual communication b) actual communication

FRAMING:

The datalink layer accepts the input bit stream from physical layer, breakes the packets into discrete frames (at sender
side) and computes the checksum for each frame. At receiver side datalink layer receives the bit streams and breaks them
into frames. When a frame is arrived at destination the checksum is recomputed and it is found different from the
contained in frame, the datalink layer identifies error and takes the steps to deal with it.

There are four framing methods that are employed to design a frame.

1. Character count
2. Character stuffing
3. Bit stuffing
4. Physical layer coding violations

1. Character count:

The first framing method uses a field in the header to specify the number of characters in the frame. When the
data link layer at the destination sees the byte count, it knows how many bytes follow and hence where the end of the
frame is. This technique is shown in Fig. (a) for four small example frames of sizes 5, 5, 8, and 8 bytes, respectively. The
trouble with this algorithm is that the count can be garbled by a transmission error. For example, if the byte count of 5 in
the second frame of Fig. (b) becomes a 7 due to a single bit flip, the destination will get out of synchronization. It will
then be unable to locate the correct start of the next frame. Even if the checksum is incorrect so the destination knows that
2
the frame is bad, it still has no way of telling where the next frame starts. Sending a frame back to the source asking for a
retransmission does not help either, since the destination does not know how many bytes to skip over to get to the start of
the retransmission. For this reason, the byte count method is rarely used by itself.

Fig a) without errors b) with errors

2. Character stuffing:

In byte stuffing (or character stuffing), a special byte is added to the data section of the frame. When there is a
character with the same pattern as the flag. The data section is stuffed with an extra byte. This byte is usually called the
character (DLE), which has a predefined bit pattern. Whenever the receiver encounters the DLE character, it removes it
from the data section and treats the next character as data, not a delimiting flag.
ALGORITHM FOR CHARACTER STUFFING

1. Start
2. Append DLE STX at the beginning of the string
3. Check the data if character is present; if character DLE is present in the string (example DOODLE) insert another DLE
in the string (ex: DOODLEDLE)
4. Transmit DLE ETX at the end of the string
5. Display the string
6. Stop

ALGORITHM FOR CHARACTER DE−STUFFING

1. Start
2. Neglect initial DLE STX
3. If DLE is present in the text, neglect it; if another DLE follows, copy the same to output.
4. Neglect the trailing DLE ETX
5. Stop

3
ADVANTAGES
a. when error occurs, the receiver can wait for the next DLE
b. boundary between two frames are clearly recognized
c. can have tolerate large delays and computer crash

DISADVANTAGES:
a. overhead, sending extra character between blocks of data
b. character is the smallest unit that can be operated on (not all architectures are byte oriented)
**3. BIT STUFFING:
Bit stuffing is the insertion of one or more bits into a transmission unit as a way to provide signaling information
to a receiver. The receiver knows how to detect and remove or disregard the stuffed bits. Bit stuffing is defined by some to
include bit padding, which is the addition of bits to a transmission to make the transmission unit conform to a standard
size.
ALGORITHM:
1. Read the number of frames.
2. Read the binary data for each frame.
3. Add the flag.
4. Bit Stuffing: If there is five consecutive 1’s after zero ,add one zero as sixth bit.
5. Transmit the data.
6. Destuffing: If there is zero after the five consecutive 1’s, remove that zero in the data.
7. Display the data.

4
Fig-1. 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.

ADVANTAGES AND DISADVANTAGES:

a. boundary between two frames are clearly recognized


b. error correction is made easier
c. waste of bandwidth
d. computing time needed to insert and remove the bit stuffing

4. Physical layer coding violations:


The bits 1 and 0 are encoded by two physical bits as a higher-low pair and low-higher pair respectively i.e every
data bit has a transition in the middle ,making it easy for easy for receiver locate bit boundaries. This method is called
“Manchester encoding” is a line encoding.

5
Types of Errors

There may be three types of errors:

• Single bit error

In a frame, there is only one bit, anywhere though, which is corrupt.

• Multiple bits error

Frame is received with more than one bits in corrupted state.

• Burst error

Frame contains more than1 consecutive bits corrupted.

Error control mechanism may involve two possible ways:

• Error detection
• Error correction

Error detection

In networking, error detection refers to the techniques used to detect noise or other impairments introduced into
data while it is transmitted from source to destination. Error detection ensures reliable delivery of data across vulnerable
networks. Error detection minimizes the probability of passing incorrect frames to the destination, known as undetected
error probability

To detect the errors in frames few extra bits are sent along with actual data to confirm that bits received at other
end are same as they were sent. If the counter-check at receiver’ end fails, the bits are considered corrupted.
Error detecting codes:
Three different error-detecting codes are:
1. Parity.
2. Two dimensional parity check
6
3. Checksums. And
4. Cyclic Redundancy Checks (CRCs).
1. Parity checking:
The most common and least expensive mechanism for error –detection is simple parity check. In this technique, a
redundant bit called parity bit is appended to every data.
Two parity schemes are used. They are:
• Even parity checking scheme
• Odd parity checking scheme

Even parity checking scheme

• In this method, a redundant bit called parity bit is added to each data.
• Even parity means that total number of 1’s in data (including parity bit) is even. i.e. this scheme makes total no: of
1’s in source data even.
• The source will first pass its data unit to even parity generator.
• The parity generator will count the number of 1’s in data unit and will add parity bit 0 if there are even no: of 1’s
in source data. If the source data contains odd no: of 1’s then it will add 1 to the source data so that there will be
even no: of 1’s.
• For example, if source wants to transmit a data unit 11001111 using even parity to the destination In this example,
since the number of 1s in data unit is six which is even number, the parity generator appends a parity bit 0 to this
data unit making 110011110
• This data along with parity bit is then transmitted across the network. In this case 110011110 will be transmitted.
• At the destination, this data is passed to parity checker. The parity checker counts the number of 1s in data. If
there are odd no: of 1’s then the receiver rejects such erroneous data unit.
• This can detect all single bit error.

Fig a) even parity checking scheme


Odd parity checking scheme

• In this method, a redundant bit called parity bit is added to each data.
• Odd parity means that total number of 1’s in data (including parity bit) is odd. i.e this scheme makes total no: of
1’s in source data odd.
• The source will first pass its data unit to odd parity generator.
• The parity generator will count the number of 1’s in data unit and will add parity bit 0 if there are odd no: of 1’s in
source data. If the source data contains even no: of 1’s then it will add 1 to the source data so that there will be
odd no: of 1’s.
7
• For example, if source wants to transmit a data unit 11001111 using even parity to the destination In this example,
since the number of 1s in data unit is six which is even number, the parity generator appends a parity bit 1 to this
data unit making 110011111
• This data along with parity bit is then transmitted across the network. In this case 110011111 will be transmitted.
• At the destination, this data is passed to parity checker. The parity checker counts the number of 1s in data. If
there are even no: of 1’s then the receiver rejects such erroneous data unit.
• This can detect all single bit error.

Limitations:
1. The simple parity checking method is not suitable for detection of multiple errors.
2. It cannot reveal the location of erroneous bit.
3. It cannot correct the error either.

2. Two dimensional parity check:


Two-dimensional parity is exactly what the name suggests. It is based on “simple” (one-dimensional) parity, which
usually involves adding one extra bit to balance the number of 1s in the byte. This approach based on parity checks ,it
arrange the string of data bits into a two-dimensional array and append a parity bit to each row and column of data bits
and an additional parity bit in the lower-right corner.
The two sets of parity bits generated are:
i) Longitudinal redundancy check (LRC) bits
ii) Vertical redundancy check (VRC) bits
Longitudinal redundancy check (LRC) bits:
The LRC bits are parity bits associated with the rows of the data block. Each LRC bit will make the parity of the
corresponding row, an even parity. Consider the example
Row 1: 101100111 --here the data contains five 1’s to make even number of 1’s an extra bit 1 is added.
Vertical redundancy check (VRC) bits
The LRC bits are parity bits associated with the columns of the data block. Each LRC bit will make the parity of
the corresponding column, an even parity. Consider the example
Colunm1
1
1
0
1
1 -- Here the data contains three 1’s to make even number of 1’s an extra bit 1 is added

8
Consider the following example:

Two-dimensional parity scheme can detect all 2 bit errors but cannot correct the error
3. Checksum method:
The checksum is based on the concept of redundancy. Several protocols still use the checksum for error detection.
The simple parity cannot detect the two or more number of errors so to avoid this problem checksum is used.
Basic idea:
• Suppose the data is a list of five 4-bit numbers that want to send to a destination. In addition to sending these
numbers, sender sends the sum of the numbers.
• For example, if the set of numbers is (7, 11, 12, 0, 6), then sender sends (7, 11, 12, 0, 6, 36), where 36 is the sum
of the original numbers it is sent along with the data as a last word.
• The Receiver adds the five numbers and compares the result with the sum.
• If the two are the same, the receiver assumes no error, accepts the five numbers, and discards the sum.
• Otherwise, there is an error somewhere and the data are not accepted.

In order to make receivers job easy:


• The sender sends the negative (complement) sum called checksum which is appended to the data. At receiver
side, the receiver adds all data words.
• If the result is 0, it assumes no error; otherwise, there is an error.
• In this case, sender sends (7, 11, 12, 0, 6, -36). The receiver can add all the numbers received (including the
checksum).
This example/method has one major drawback. All of our data can be written as a 4-bit word (they are less than 15)
except for the checksum. One solution is to use one's complement arithmetic

One’s complement arithmetic:

• In this arithmetic, we can represent unsigned numbers between 0 and 2n - 1 using only n bits.
• If the number has more than n bits, the extra leftmost bits need to be added to the n rightmost bits (wrapping).
• In one's complement arithmetic, a negative number can be represented by inverting all bits.
• In checksum method the data is divided into k segments each of n bits.
• At sender side each segments are added i.e. each successive segment is added to its sum.
• At the end of transmission the final sum is complemented (checksum) is sent along with data word.

9
• At receiver side each segments are added and the final sum is complemented. If it (checksum) is zeros then there
is no error otherwise receiver rejects the data

Consider the following example data word 10110011, 10101011, 01011010, and 11010101

One example of a checksum is the 16-bit Internet checksum used on all Internet packets as part of the IP protocol.

Internet Checksum
Traditionally, the Internet has been using a 16-bit checksum.
Sender site:
1. The message is divided into 16-bit words.
2. The value of the checksum word is set to O.
3. All words including the checksum are added using one's complement addition.
4. The sum is complemented and becomes the checksum.
5. The checksum is sent with the data
Receiver site:
1. The message (including checksum) is divided into 16-bit words.
2. All words are added using one's complement addition.
3. The sum is complemented and becomes the new checksum.
4. If the value of checksum is 0, the message is accepted; otherwise, it is rejected.

10
** 4. Cyclic redundancy check

The cyclic redundancy check, or CRC, is a technique for detecting errors in digital data, but not for making
corrections when errors are detected. It is used primarily in data transmission. In the CRC method, a certain number of
check bits, often called a checksum, are appended to the message being transmitted. The receiver can determine whether
or not the check bits agree with the data, to ascertain with a certain degree of probability whether or not an error occurred
in transmission. If an error occurred, the receiver sends a “negative acknowledgement” (NAK) back to the sender,
requesting that the message be retransmitted.

THE ALGORITHM FOR COMPUTING THE CRC IS AS FOLLOWS:

1. Let r be the degree of G(x)(generator) and m be no: of bits in the dataword. Append r zero bits (i.e. if generator contains
n no: of bits then add n-1 bits) to the low-order end of the frame so it now contains m + r bits
2. Divide the bit string corresponding to G(x)(divisor) into the bit string corresponding to new(m + r) bits, using XOR
operation..
3. Remainder will be appended to original dataword (m bits) and the sender sends this to the receiver.
4. Both sender and receiver agree on common divisor i.e. g(x).
5. When the receiver receives the data it checks the data exactly done by the sender i.e. it divides the transmitted data by
the divisor and does XOR operation
6. At receiver side the if the reminder is all 0’s then transmitted data is error free otherwise there is error in transmitted
data.
7. If there is error the receiver sends negative acknowledgement to sender and sender retransmits the data
Consider below example

The dataword is 1101011011


Generator g(x) is 10011
The generator contains 5 bits so append (5-1) 4 0’s to the dataword

11
Left most bit is 0
then do xor
operation with
00000

• Here the remainder is 1110 append this to original data word-1101011011


• Now the dataword 11010110111110 is transmitted to receiver.
• At receiver side the receiver do same process as sender does that is receiver divides the transmitted frame
11010110111110 with the generator 10011.If the remainder is 0’s then there is no error in transmitted data word

Undetected errors in CRC:


1. CRC cannot detect all types of errors.
2. The probability of error detection and types of detectable errors depends on the choice of divisor

Example: write the steps to compute the checksum in CRC code. Calculate CRC for the frame 110101011 and the
generator polynomial= 𝑥4 + 𝑥 + 1 and write the transmitted frame

Error correction technique:


* Hamming codes:

Hamming codes are linear block codes FEC technique. Hamming code is a set of error-correction codes that can
be used to detect and correct bit errors that can occur when computer data is moved or stored. Like other error-correction
code, Hamming code makes use of the concept of parity and parity bits, which are bits that are added to data so that the
validity of the data can be checked when it is read or after it has been received in a data transmission.
➢ Depending on the following equation parity bits are inserted

(𝟐𝒌 -1) ≥ ( m + k)
Where
12
m-- No: of bits
k--no: of parity bits
➢ In a Hamming code
– K parity bits added to m-bit word
– Forms codeword with length (m + k) bits
➢ Bit numbering
– Starts at 1 with rightmost (lower-order) bit
– All powers of 2 are parity bits positions
– Remaining bits are for data (fill data bits from leftmost except in parity positions)

Minimum no: of parity bits:

The following table gives a listing of minimum number of parity bits needed for various ranges of m information
bits.
Number of information bits (m) Number of parity bit (k) needed
2 to 4 3
5 to 11 4
12 to 26 5
27 to 57 6
58 to 120 7

Table 3.1 Minimum no: of parity bits

BIT NUMBERING FOR HAMMING ALGORITHM

Deciding the values of parity bits:

The following table indicates which bit positions are associated with each parity bit in order to establish required
parity (even or odd) over selected bits positions
Parity bit Bits to be checked in positions
P1 1,3,5,7,9,11,13,15
P2 2,3,6,7,10,11,14,15
P4 4,5,6,7,12,13,14,15
P8 8,9,10,11,12,13,14,15

TABLE 3.2 Deciding the values of parity bits

13
METHOD FOR PARITY CHECK

• For parity bit 1


– p1  d3  d5  d7  d9  d11
• For parity bit 2
– p2  d3  d6  d7 d10  d11
For parity bit 4
– p4  d5  d6  d7  d12
• For parity bit 8
– p8  d9  d10  d11  d12

Example: A bit word 1011 is to be transmitted. Constructing the seven bit hamming code for this data is as follows

step1: make the code word format


Given data is 1011 i.e. m=4bits .For 4 bits of information the number of parity bits k=3 (see in table 3.1)
Therefore the codeword contains m+k bits i.e. 4+3=7 bits

7 6 5 4 3 2 1
Step2: Except in parity bits position insert the data in remaining positions i.e. at d7, d6, d5, d3, remaining positions are
occupied by parity bits
Parity bits position are the power of 2 i.e. p1, p2, p4

1 0 1 P4 1 P2 P1
(d7) (d6) (d5) (d3)

Step3: Deciding the values of parity bits: (see table 3.2)

• For parity bit 1 (do XOR operation)


– p1  d3  d5  d7
• For parity bit 2
– p2  d3  d6  d7
• For parity bit 4
– p4  d5  d6  d7
a) P1= p1  d3  d5  d7
= -111
= 1
b) P2= p2  d3  d6  d7
= -101
= 0
c) P4= p4  d5  d6  d7
= -101
= 0
Step 4: insert the calculated parity bits in code word
The resultant code word is

1 0 1 0 1 0 1
(d7) (d6) (d5) (P4) (d3) (P2) (P1)

Hence the complete 7 bit hamming codeword is 1010101


This codeword 1010101 is sent to receiver.

14
Error detection and correction at receiver end:
• AT receiver end the receiver detects and corrects the error.
• It checks the parity bits by following
• For parity bit p1
– d1  d3  d5  d7  d9  d11...
• For parity bit p2
– d2  d3  d6  d7 d10  d11....
• For parity bit p4
– d4  d5  d6  d7  d12....
• For parity bit p8
– d8  d9  d10  d11  d12...
• Then the corresponding error position is obtained by present calculated p4p2p1

For example if p4=1, p2=0, p1=1 i.e. 101(p4p2p1) binary number is equivalent to 5
Therefore the error is at 5th position
If all parity bits are zeros then there is no error and data is accepted.

Flow control and error control:


Flow control and Error control are the two main responsibilities of the Data link layer.
• flow control is a set of procedures that mainly tells the sender how much data the sender can send. The
data flow must not be allowed to overwhelm the receiver; because any receiving device has a very limited
speed at which the device can process the incoming data and the limited amount of memory to store the
incoming data.
• flow control makes the sender; wait for the acknowledgment from the receiver before the continuation to
send more data to the receiver.
• Error Control contains both error detection and error correction. It mainly allows the receiver to inform
the sender about any damaged or lost frames during the transmission and then it coordinates with the
retransmission of those frames by the sender.
• Error control is mainly implemented in a simple way and that is whenever there is an error detected during
the exchange, then specified frames are retransmitted and this process is also referred to as Automatic
Repeat request(ARQ).

15
For noiseless channel
1. Simplest Protocol:
Simplest Protocol is a protocol that neither has flow control nor has error control
• The simplest protocol is basically a unidirectional protocol in which data frames only travel in one
direction; from the sender to the receiver.
• the receiver can immediately handle the frame it receives whose processing time is small enough to be
considered as negligible.

In order to send the three frames, there will be an occurrence of three events at sender A and three events at the
receiver B.

The procedure for protocol:

Given below is the algorithm used at the sender's site: Given below is the algorithm used at the receiver's
while(true) //Repeat Forever site:
{ while(true) //Repeat Forever
WaitForEvent(); {
if(Event(RequestToSend)) WaitForEvent();
{ if(Event(ArrivalNotification))
GetData(); {
MakeFrame(); ReceiveFrame();
SendFrame(); ExtractData();
} DeliverData();
} }
}

2.Simple Stop and Wait Protocol:


• In order to prevent the receiver from overwhelming, there is a need to tell the sender to slow down the
transmission of frames.To do this stop and wait protocol is used.
• during transmission, the sender sends one frame, then stops until it receives the confirmation from the
receiver, after receiving the confirmation sender sends the next frame.
• For every sent frame, the acknowledgment is needed and it takes the same amount of time for propagation
in order to get back to the sender.
• In order to end up the transmission, the sender transmits an end of transmission that means(EOT frame).

16
Advantage:

One of the main advantages of the stop-and-wait protocol is the accuracy provided. As the transmission of the next
frame is only done after receiving the acknowledgment of the previous frame. Thus there is no chance for data loss.

Disadvantage:

17
Automatic repeat request(ARQ) techniques:

In ARQ system error control, when an error is detected, a request is made for retransmission of the signal.
Therefore a feedback channel is required for sending the request for retransmission.
Types of ARQ systems:
1. Stop and wait ARQ system
2. Sliding window protocol
a) Go back n ARQ system and
b) Selective repeat ARQ system

1.Stop & Wait Protocol for noisy channel:


➢ In this protocol, the communication channel is assumed to be noisy and can introduce errors in data travelling
over.

18
2 Sliding Window protocol
Concept:

• In sliding window method, multiple frames are sent by sender at a time before needing an acknowledgment.
• Multiple frames sent by source are acknowledged by receiver using a single ACK frame.

Sliding Window

• Sliding window refers to an imaginary boxes that hold the frames on both sender and receiver side.
• It provides the upper limit on the number of frames that can be transmitted before requiring an acknowledgment.
• Frames may be acknowledged by receiver at any point even when window is not full on receiver side.
• Frames may be transmitted by source even when window is not yet full on sender side.
• The windows have a specific size in which the frames are numbered modulo- n, which means they are numbered from 0
to n-l. For e.g. if n = 8, the frames are numbered 0, 1,2,3,4,5,6, 7, 0, 1,2,3,4,5,6, 7, 0, 1, ....

Sliding Window on Sender Side

19
At the beginning of a transmission, the sender's window contains n-l frames. The buffer is provided to the
sender that has the size equal to the size of the window. The buffer size needed by the receiver is 1.

Implementation of sliding window protocol

sliding window protocol

Go back N ARQ selective repeat ARQ

1. Goback N sliding window protocol:

• Stop and wait ARQ mechanism does not utilize the resources at their best. When the acknowledgement is
received, the sender sits idle and does nothing.
• In Go-Back-N ARQ method, in which the sending process continues to send a number of frames specified by
a window size even without receiving an ACK packet from the receiver. The sender maintains the window size of
N-1 and receiver maintains the window size 1.
• The receiver process keeps track of sequence number of the next frame it expects to receive, and sends that
number with every ACK it sends

Three cases are :


1. All Packets reach the receiver and send acknowledgements back to the sender.
2. Some Packets are lost on their way to destination.
3. Some Acknowledgements are lost on their way back to sender.

1. Go-Back-N ARQ, normal operation:


• Here the window size of sender is 3 which contain three frames and receiver window size is 1.
• The sender sends the three frames and as soon as the receiver receives the frame it sends ACK with a number
indicating to send the specified number frame.
• Here the receiver may use accumulator ACK or normal ACK. Accumulator ACK means after receiving two or
more frames then receiver sends the ACK n means frames ,n-1,n-2, ... are acknowledged, which indicates to send
n frame. The advantage of this is number of acknowledgments sent to sender will be decreased

20
• The sender sends 0,1,2 frames as soon as 0 frames is received the receiver slides the window waiting for frame1
after it sends the ACK2 instructing sender to send the frame2.
• Now the sender will slide its window which contain 2,3,0 since frame 2 is not received and sends the frames the
contained in window (always window size will be 3) and receiver slides the window to receive next frame.
• The receiver sends the ACK3 indicating to send frame 3.then the sender slides the window 3,0,1 and sends the
frames so on. The process repeats until the sender sends all the frames.

1.2. Go-Back-N ARQ, Frame lost operation:

• For each frame there will a timer. If the ACK for corresponding frame is not received at specified time i.e. at time
out, then the sender retransmits the all frames in window.
• Receiver discards all subsequent frames(frame 3..) following an error one, and sends no acknowledgement for
thosediscarded.

• So that the sender knows that subsequent frames are not received including the error frame and resends frame 2
back to receiver

1.3. Go-Back-N ARQ, ACK lost operation:

• If ACK is lost then after the time has been expired the sender again sends the previous frames.
• Then the receiver will discard the duplicate frames and resends the ACK with a number so that sender sends the
next frames with the sequence number

Draw backs of GO back N ARQ:

1. It transmits all frames if one frame is damaged or lost.


2. This protocol is inefficient in noisy channel

21
2. Selective repeat sliding window protocol (SRP):

➢ In selective repeat ARQ the sender and receiver window size are equal.
➢ Here if receiver receives out of order frame instead of discarding as done in Go back N, it buffers the out of order
frames and sends the NAK (negative acknowledgement) with a sequence number of lost frame or damaged frame
➢ As soon as the sender gets NAK it resends the only damaged frame but not entire window as in Go back N ARQ

Negative Acknowledgement (NAK):


• SRP is often combined with NAK
• When error is suspected by receiver, receiver request retransmission of a frame
❑ Arrival of a damaged frame
❑ Arrival of a frame other than the expected
➢ Receiver has a buffer for each sequence number within receiving window.Each buffer is associated with an
"arrived" bit and Checks whether sequence number of an arriving frame within window or not .If so, accept and
store.
➢ Receiver stores correct frames following the bad one(lost frame)
➢ Sender retransmits the bad one after noticing NAKn
➢ Receiver passes data to network layer and acknowledge with the highest number
➢ In SRP if the ACK or NAK frames are lost i.e. if no ACK is arrives in allowed time, then all that frames that
remain unacknowledged are retransmitted.
➢ The window size in this method is less than or equal to (n+1)/2 ,where as in case of go back n it is (n-1)

Fig: Selective repeat sliding window protocol:

• The advantage with this method is that it gives best throughput efficiency.

22
• The disadvantage of this method is that because of complexity of sorting and storage required by receiver and the
extra logic required by transmitter to select frames for retransmission, the system becomes more expensive
Comparison

Use Go BackN(GBN) or Selective Repeat(SR)? If errors low, might use GBN.


• If errors high, might use SR.
• If bandwidth cheap, might use GBN.
• If bandwidth costly, might use SR.
• If memory costly at receiver, might use GBN.
• If memory cheap at receiver, might use SR.

Difference between go back n and selective repeat protocol:

GO BACK AND ARQ SELECTIVE REPEAT ARQ

Go Back N ARQ is inefficient for noisy link. Selective repeat ARQ is efficient for noisy links

Go Back N ARQ is less complicated than Selective Selective Repeat ARQ is complicated
repeat ARQ.

Go Back N ARQ Sender Window Size is 2^ (m)-1 .in Sender and receiver Window Size is 2^ (m-1)
and receiver window size is 1.

Go-Back-N ARQ is a specific instance of the Selective Repeat ARQ / Selective Reject ARQ is a
automatic repeat request (ARQ) protocol, in which specific instance of the Automatic Repeat-Request
the sending process continues to send a number of (ARQ) protocol used for communications. It may
frames specified by a window size even without be used as a protocol for the delivery and
receiving an acknowledgement (ACK) packet from acknowledgement of message units, or it may be
the receiver. It is a special case of the general used as a protocol for the delivery of subdivided
sliding window protocol with the transmit window message sub-units.
size of N and receive window size of 1.

23
HDLC (High-Level Data Link Control)
HDLC (High-Level Data Link Control) is a bit-oriented protocol that is used for communication over
the point-to-point and multipoint links. This protocol implements the mechanism of ARQ(Automatic Repeat
Request).
In order to make the HDLC protocol applicable for various network configurations, there are three types of
stations and these are as follows:

• Primary Station it is the responsibility of the primary station to connect and disconnect the data link. The
frames issued by the primary station are commonly known as commands.
• Secondary Station The secondary station operates under the control of the primary station. The Frames
issued by the secondary stations are commonly known as responses.
• Combined Station The combined station acts as both Primary stations as well as Secondary stations. The
combined station issues both commands as well as responses.

Transfer Modes in HDLC

The HDLC protocol offers two modes of transfer that mainly can be used in different configurations. These are as
follows:
• Normal Response Mode(NRM)
• Asynchronous Balance Mode(ABM)

1. Normal Response Mode(NRM):

In this mode, the configuration of the


station is unbalanced. There are one
primary station and multiple secondary
stations. Where the primary station can
send the commands and the secondary
station can only respond.
This mode is used for both point-to-
point as well as multiple-point links.

24
2. Asynchronous Balance Mode(ABM)

In this mode, the


configuration of the station is
balanced. In this mode, the link is
point-to-point, and each station can
function as a primary and as
secondary. Asynchronous Balance
mode(ABM) is a commonly used
mode today.

HDLC Frames

In order to provide the flexibility that is necessary to support all the options possible in the modes and
Configurations that are just described above. There are three types of frames defined in the HDLC:
• Information Frames(I-frames) These frames are used to transport the user data and the control
information that is related to the user data. If the first bit of the control field is 0 then it is identified as I-
frame.
• Supervisory Frames(S-frames) These frames are only used to transport the control information. If the
first two bits of the control field are 1 and 0 then the frame is identified as S-frame
• Unnumbered Frames(U-Frames) These frames are mainly reserved for system management. These
frames are used for exchanging control information between the communicating devices.

different HDLC frames:

1. Flag Field: This field of the HDLC frame is mainly a sequence of 8-bit having the bit pattern 01111110 and it
is used to identify the beginning and end of the frame.

2. Address Field: It is the second field of the HDLC frame and it mainly contains the address of the secondary
station. T. In case if the frame is sent by the primary station, then this field contains the address(es) of the
secondary stations. If the frame is sent by the secondary station, then this field contains the address of the primary
25
station.
3. Control Field:This is the third field of the HDLC frame and it is a 1 or 2-byte segment of the frame and is
mainly used for flow control and error control.
4. Information Field:This field of the HDLC frame contains the user's data from the network layer or the
management information. The length of this field varies from one network to another.
5. FCS Field:FCS means Frame check sequence and it is the error detection field in the HDLC protocol. There is a
16 bit CRC code for error detection.

PPP(Point-To-Point) protocol
PPP(Point-To-Point) protocol is a protocol used in the data link layer. The PPP protocol is mainly used to
establish a direct connection between two nodes(routers) in WAN(Wide area Network)
In the PPP protocol, the framing is done using the byte-oriented technique. It does not implement flow and
error control techniques.

PPP Frame Format:

1. Flag:The PPP frame mainly starts and ends with a 1-byte flag field that has the bit pattern: 01111110. It is
important to note that this pattern is the same as the flag pattern used in HDLC. But there is a difference too and
that is PPP is a byte-oriented protocol whereas the HDLC is a bit-oriented protocol.
2. Address:The value of this field in PPP protocol is constant and it is set to 11111111 which is a broadcast
address. The two parties can negotiate and can omit this byte.
3. Control:The value of this field is also a constant value of 11000000. We have already told you that PPP does
not provide any flow control and also error control is limited to error detection. The two parties can negotiate and
can omit this byte.
4. Protocol:This field defines what is being carried in the data field. It can either be user information or other
information. By default, this field is 2 bytes long.
5. Payload field
This field carries the data from the network layer. The maximum length of this field is 1500 bytes. This can also
be negotiated between the endpoints of communication.
6. FCS:It is simply a 2-byte or 4-byte standard CRC(Cyclic redundancy check).

26
Transition Phases in the PPP Protocol

1.Dead:In this phase, the link is not being used. No active carrier is there at the physical layer and the line is
simply quiet.
2.Establish:If one of the nodes starts the communication then the connection goes into the established phase. In
this phase, options are negotiated between the two parties. In case if the negotiation is done successfully then the
system goes into the Authenticate phase (in case if there is the requirement of authentication otherwise goes into
the network phase.)
3.Authenticate:This is an optional phase. During the establishment phase, the two nodes may decide not to skip
this phase. If the two nodes decide to proceed with the authentication then they send several authentication
packets.If the result of this is successful then the connection goes into the networking phase otherwise goes into
the termination phase.
4.Network:In this phase, the negotiation of the protocols of the network layer takes place. The PPP protocol
specifies that the two nodes establish an agreement of the network layer before the data at the network layer can be
exchanged. The reason behind this is PPP supports multiple protocols at the network layer.In case if any node is
running multiple protocols at the network layer simultaneously then the receiving node needs to know that which
protocol will receive the data.
5.Open:In this phase the transfer of the data takes place. Whenever a connection reaches this phase, then the
exchange of data packets can be started. The Connection remains in this phase until one of the endpoints in the
communication terminates the connection.
6.Terminate:In this phase, the connection is terminated. There is an exchange of several packets between two
ends for house cleaning and then closing the link.

27
Multiplexing and Multi link PPP

Multiplexing is a technique used to combine and send the multiple data streams over a single medium. The
process of combining the data streams is known as multiplexing and hardware used for multiplexing is known as a
multiplexer
Why Multiplexing?
• When multiple signals share the common medium, there is a possibility of collision. Multiplexing concept
is used to avoid such collision.
• The transmission medium is used to send the signal from sender to receiver. The medium can only have
one signal at a time.
• If there are multiple signals to share one medium, then the medium must be divided in such a way that
each signal is given some portion of the available bandwidth. For example: If there are 10 signals and
bandwidth of medium is100 units, then the 10 unit is shared by each signal.
MLPPP (Multilink Point-to-Point Protocol)

MLPPP (Multilink Point-to-Point Protocol) is the protocol that bundles multiple serial wan links into a one Logical
Bundle.There can be multiple PPP serial links between two nodes. With MLPPP, these links are bundled and become a
single logical link.

PPP Multilink Load Balancing

In PPP Multilink, Load Balancing is used between the member links of the Logical Link. The traffic is shared
between ea linkh of these links. Load Balancing is used with fragmentation in MLPPP.

MLPPP Fragmentation

In MLPPP (PPP Multilink) , packet fragmentation is also supported beside load balancing. With packet
fragmentation, the packets that are fragmented are sent at the same time in different members of the Logical Bundle.

28
29

You might also like