Professional Documents
Culture Documents
Unit 3
Unit 3
Layer
o In the OSI model, the data link layer is a 4 th layer from the top and 2nd layer from the bottom.
o The communication channel that connects the adjacent nodes is known as links, and in order
to move the datagram from source to the destination, the datagram must be moved across
an individual link.
o The main responsibility of the Data Link Layer is to transfer the datagram across an individual
link.
o The Data link layer protocol defines the format of the packet exchanged across the nodes as
well as the actions such as Error detection, retransmission, flow control, and random access.
o The Data Link Layer protocols are Ethernet, token ring, FDDI and PPP.
o An important characteristic of a Data Link Layer is that datagram can be handled by different
link layer protocols on different links in a path. For example, the datagram is handled by
Ethernet on the first link, PPP on the second link.
o Framing & Link access: Data Link Layer protocols encapsulate each network frame within a
Link layer frame before the transmission across the link. A frame consists of a data field in
which network layer datagram is inserted and a number of data fields. It specifies the
structure of the frame as well as a channel access protocol by which frame is to be transmitted
over the link.
o Reliable delivery: Data Link Layer provides a reliable delivery service, i.e., transmits the
network layer datagram without any error. A reliable delivery service is accomplished with
transmissions and acknowledgements. A data link layer mainly provides the reliable delivery
service over the links as they have higher error rates and they can be corrected locally, link at
which an error occurs rather than forcing to retransmit the data.
o Flow control: A receiving node can receive the frames at a faster rate than it can process the
frame. Without flow control, the receiver's buffer can overflow, and frames can get lost. To
overcome this problem, the data link layer uses the flow control to prevent the sending node
on one side of the link from overwhelming the receiving node on another side of the link.
o Error detection: Errors can be introduced by signal attenuation and noise. Data Link Layer
protocol provides a mechanism to detect one or more errors. This is achieved by adding error
detection bits in the frame and then receiving node can perform an error check.
o Error correction: Error correction is similar to the Error detection, except that receiving node
not only detect the errors but also determine where the errors have occurred in the frame.
o Half-Duplex & Full-Duplex: In a Full-Duplex mode, both the nodes can transmit the data at
the same time. In a Half-Duplex mode, only one node can transmit the data at the same time.
Types Of Errors
o Single-Bit Error
o Burst Error
Single-Bit Error:
The only one bit of a given data unit is changed from 1 to 0 or from 0 to 1.
In the above figure, the message which is sent is corrupted as single-bit, i.e., 0 bit is changed to 1.
Single-Bit Error does not appear more likely in Serial Data Transmission. For example, Sender sends
the data at 10 Mbps, this means that the bit lasts only for 1 ?s and for a single-bit error to occurred, a
noise must be more than 1 ?s.
Single-Bit Error mainly occurs in Parallel Data Transmission. For example, if eight wires are used to
send the eight bits of a byte, if one of the wire is noisy, then single-bit is corrupted per byte.
Burst Error:
The two or more bits are changed from 0 to 1 or from 1 to 0 is known as Burst Error.
The Burst Error is determined from the first corrupted bit to the last corrupted bit.
The duration of noise in Burst Error is more than the duration of noise in Single-Bit.
The number of affected bits depends on the duration of the noise and data rate.
o If two bits in one data unit are corrupted and two bits exactly the same position in another
data unit are also corrupted, then 2D Parity checker will not be able to detect the error.
o This technique cannot be used to detect the 4-bit errors or more in some cases.
Checksum
Checksum Generator
A Checksum is generated at the sending side. Checksum generator subdivides the data into equal
segments of n bits each, and all these segments are added together by using one's complement
arithmetic. The sum is complemented and appended to the original data, known as checksum field.
The extended data is transmitted across the network.
Suppose L is the total sum of the data segments, then the checksum would be ?L
1. The Sender follows the given steps:
2. The block unit is divided into k sections, and each of n bits.
3. All the k sections are added together by using one's complement to get the sum.
4. The sum is complemented and it becomes the checksum field.
5. The original data and checksum field are sent across the network.
Checksum Checker
A Checksum is verified at the receiving side. The receiver subdivides the incoming data into equal
segments of n bits each, and all these segments are added together, and then this sum is
complemented. If the complement of the sum is zero, then the data is accepted otherwise data is
rejected.
Example
Suppose that the sender wants to send 4 frames each of 8 bits, where the frames are 11001100,
10101010, 11110000 and 11000011.
The sender adds the bits using 1s complement arithmetic. While adding two numbers using 1s
complement arithmetic, if there is a carry over, it is added to the sum.
After adding all the 4 frames, the sender complements the sum to get the checksum, 11010011, and
sends it along with the data frames.
The receiver performs 1s complement arithmetic sum of all the frames including the checksum. The
result is complemented and found to be 0. Hence, the receiver assumes that no error has occurred.
o In CRC technique, a string of n 0s is appended to the data unit, and this n number is less than
the number of bits in a predetermined number, known as division which is n+1 bits.
o Secondly, the newly extended data is divided by a divisor using a process is known as binary
division. The remainder generated from this division is known as CRC remainder.
o Thirdly, the CRC remainder replaces the appended 0s at the end of the original data. This
newly generated unit is sent to the receiver.
o The receiver receives the data followed by the CRC remainder. The receiver will treat this
whole unit as a single unit, and it is divided by the same divisor that was used to find the CRC
remainder.
If the resultant of this division is zero which means that it has no error, and the data is accepted.
If the resultant of this division is not zero which means that the data consists of an error. Therefore,
the data is discarded.
Let's understand this concept through an example:
CRC Generator
o A CRC generator uses a modulo-2 division. Firstly, three zeroes are appended at the end of
the data as the length of the divisor is 4 and we know that the length of the string 0s to be
appended is always one less than the length of the divisor.
o Now, the string becomes 11100000, and the resultant string is divided by the divisor 1001.
o The remainder generated from the binary division is known as CRC remainder. The generated
value of the CRC remainder is 111.
o CRC remainder replaces the appended string of 0s at the end of the data unit, and the final
string would be 11100111 which is sent across the network.
CRC Checker
Thus, for the given CRC generator, the corresponding binary pattern is 11011011.
Rule-01:
Rule-02:
Important Notes-
Steps Involved-
At sender side,
At sender side,
The newly formed code word (Original data + CRC) is transmitted to the receiver.
At receiver side,
Case-01: Remainder = 0
Receiver assumes that no error occurred in the data during the transmission.
Receiver accepts the data.
Case-02: Remainder ≠ 0
Receiver assumes that some error occurred in the data during the transmission.
Receiver rejects the data and asks the sender for retransmission.
Problem-01:
A bit stream 1101011011 is transmitted using the standard CRC method. The generator polynomial is
x4+x+1. What is the actual bit string transmitted?
Solution-
The code word to be transmitted is obtained by replacing the last 4 zeroes of 11010110110000 with the
CRC.
Thus, the code word transmitted to the receiver = 11010110111110.
Problem-02:
A bit stream 10011101 is transmitted using the standard CRC method. The generator polynomial is x 3+1.
1. What is the actual bit string transmitted?
2. Suppose the third bit from the left is inverted during transmission. How will receiver detect this error?
Solution-
Part-01:
The code word to be transmitted is obtained by replacing the last 3 zeroes of 10011101000 with the
CRC.
Thus, the code word transmitted to the receiver = 10011101100.
Part-02:
Now,
Error Correction
Error Correction codes are used to detect and correct the errors when data is transmitted from the
sender to the receiver.
o Backward error correction: Once the error is discovered, the receiver requests the sender to
retransmit the entire data unit.
o Forward error correction: In this case, the receiver uses the error-correcting code which
automatically corrects the errors.
o
Simplest Protocol is a protocol that neither has flow control nor has error control( as we
have already told you that it lies under the category of Noiseless channels).
In this, the receiver can immediately handle the frame it receives whose processing
time is small enough to be considered as negligible.
Basically, the data link layer of the receiver immediately removes the header from the
frame and then hand over the data packet to the network layer that also accepts the
data packet immediately.
We can also say that in the case of this protocol the receiver never gets overwhelmed
with the incoming frames from the sender.
The flow control is not needed by the Simplest Protocol. The data link layer at the sender side
mainly gets the data from the network layer and then makes the frame out of data and sends
it. On the Receiver site, the data link layer receives the frame from the physical layer and
then extracts the data from the frame, and then delivers the data to its network layer.
The Datalink layers of both sender and receiver mainly provide transmission services for
their Network layers. The data link layer also uses the services provided by the physical layer
such as signaling, multiplexing, etc for the physical transmission of the bits.
Let us now take a look at the procedure used by the data link layer at both sides(sender as
well as the receiver).
There is no frame send by the data link layer of the sender site until its network layer
has a data packet to send.
Similarly, the receiver site cannot deliver a data packet to its network layer until a
frame arrives.
In case if the implementation of the protocol is done as a procedure then there is a
need to introduce the idea of events in the protocol.
The procedure at the sender site runs constantly; there is no action until there is a
request from the network layer.
Also, the procedure at the receiver site runs constantly; there is no action until there is
a notification from the physical layer.
Both the procedure runs continuously because either of them doesn't know when the
corresponding events will occur.
Using the simplest protocol the sender A sends a sequence of frames without even
thinking about receiver B.
Stop-and-Wait Protocol
As the name suggests, when we use this protocol during transmission, then the sender
sends one frame, and then stops until it receives the confirmation from the receiver, after
receiving the confirmation sender sends the next frame.
There is unidirectional communication for the data frames, but the acknowledgment
or ACK frames travel from the other direction. Thus the flow control is added here.
Thus the stop-and-wait is one of the flow control protocol which makes the use of
flow control service provided by the data link layer.
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).
Data link layer at the sender side waits for its network layer in order to send the data
packet. After that data link checks that it can send the frame or not. In case of receiving a
positive notification from the physical layer; the data link layer makes the frame out of
the data provided by the network layer and then sends it to the physical layer. After
sending the data it will then wait for the acknowledgment before sending the next frame.
The data link layer on the receiver side waits for the frame to arrive. When the frame
arrives then the receiver processes the frame and then delivers it to the network layer.
After that, it will send the acknowledgment or we can say that ACK frame back to the
sender.
Advantages
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.
Disadvantages
Given below are some of the drawbacks of using the stop-and-wait Protocol:
Suppose in a case, the frame is sent by the sender but it gets lost during the
transmission and then the receiver can neither get it nor can send an acknowledgment
back to the sender. Upon not receiving the acknowledgment the sender will not send
the next frame. Thus there will occur two situations and these are: The receiver has to
wait for an infinite amount of time for the data and the sender has to wait for an
infinite amount of time in order to send the next frame.
In the case of the transmission over a long distance, this is not suitable because the
propagation delay becomes much longer than the transmission delay.
In case the sender sends the data and this data has also been received by the receiver.
After receiving the data the receiver then sends the acknowledgment but due to some
reasons, this acknowledgment is received by the sender after the timeout period. Now
as this acknowledgment is received too late; thus it can be wrongly considered as the
acknowledgment of another data packet.
The time spent waiting for the acknowledgment for each frame also adds up in the
total transmission time.
The sender keeps a copy of each frame until the arrival of acknowledgement.
In Go-Back-N ARQ, the size of the sender is N and the size of the receiver window is
always 1.
This protocol makes the use of cumulative acknowledgements means here the
receiver maintains an acknowledgement timer; whenever the receiver receives a new
frame from the sender then it starts a new acknowledgement timer. When the timer
expires then the receiver sends the cumulative acknowledgement for all the frames
that are unacknowledged by the receiver at that moment.
It is important to note that the new acknowledgement timer only starts after the
receiving of a new frame, it does not start after the expiry of the old
acknowledgement timer.
If the receiver receives a corrupted frame, then it silently discards that corrupted
frame and the correct frame is retransmitted by the sender after the timeout timer
expires. Thus receiver silently discards the corrupted frame. By discarding silently we
mean that: “Simply rejecting the frame and not taking any action for the frame".
In case after the expiry of the acknowledgement timer, suppose there is only one
frame that is left to be acknowledged. In that case, the receiver sends the independent
acknowledgement for that frame.
In case if the receiver receives the out of order frame then it simply discards all the
frames.
In case if the sender does not receive any acknowledgement then the entire window of
the frame will be retransmitted in that case.
Using the Go-Back-N ARQ protocol leads to the retransmission of the lost frames
after the expiry of the timeout timer.
The Need of Go-Back-N ARQ
This protocol is used to send more than one frame at a time. With the help of Go-Back-N
ARQ, there is a reduction in the waiting time of the sender.
With the help of the Go-Back-N ARQ protocol the efficiency in the transmission
increases.
Basically, the range which is in the concern of the sender is known as the send sliding
window for the Go-Back-N ARQ. It is an imaginary box that covers the sequence
numbers of the data frame which can be in transit.
The size of this imaginary box is 2m-1 having three variables Sf( which indicates send
window, the first outstanding frame), Sn(indicates the send window, the next frame to be
sent), SSize.(indicates the send window, size).
The sender can transmit N frames before receiving the ACK frame.
The copy of sent data is maintained in the sent buffer of the sender until all the sent
packets are acknowledged.
If the timeout timer runs out then the sender will resend all the packets.
Once the data get acknowledged by the receiver then that particular data will be
removed from the buffer.
Whenever a valid acknowledgement arrives then the send window can slide one or more
slots.
Sender Window Size
As we have already told you the Sender window size is N.The value of N must be greater
than 1.
In case if the value of N is equal to 1 then this protocol becomes a stop-and-wait protocol.
The range that is in the concern of the receiver is called the receiver sliding window.
The window slides when a correct frame arrives, the sliding occurs one slot at a time.
The receiver always looks for a specific frame to arrive in the specific order.
Any frame that arrives out of order at the receiver side will be discarded and thus need
to be resent by the sender.
If a frame arrives at the receiver safely and in a particular order then the receiver send
ACK back to the sender.
The silence of the receiver causes the timer of the unacknowledged frame to expire.
Design of Go-Back-N ARQ
With the help of Go-Back-N ARQ, multiple frames can be transit in the forward direction
and multiple acknowledgements can transit in the reverse direction. The idea of this
protocol is similar to the Stop-and-wait ARQ but there is a difference and it is the window
of Go-Back-N ARQ allows us to have multiple frames in the transition as there are many
slots in the send window.
Window size for Go-Back-N ARQ
In the Go-Back-N ARQ, the size of the send window must be always less than 2m and the
size of the receiver window is always 1.
Flow Diagram
Advantages
Given below are some of the benefits of using the Go-Back-N ARQ protocol:
Only one ACK frame can acknowledge more than one frame.
Disadvantages
If the receiver receives a corrupt frame, it does not directly discard it. It sends a
negative acknowledgment to the sender. The sender sends that frame again as soon as
on the receiving negative acknowledgment. There is no waiting for any time-out to
send that frame. The design of the Selective Repeat ARQ protocol is shown below.
The example of the Selective Repeat ARQ protocol is shown below in the figure.
If a frame is corrupted or lost in it,all In this, only the frame is sent again, which is corrupted
subsequent frames have to be sent again. or lost.
If it has a high error rate,it wastes a lot of There is a loss of low bandwidth.
bandwidth.
It does not require sorting. In this, sorting is done to get the frames in the correct
order.
Synchronous Data Link Protocol (SDLC) − SDLC was developed by IBM in the
1970s as part of Systems Network Architecture. It was used to connect remote devices
to mainframe computers. It ascertained that data units arrive correctly and with right
flow from one network point to the next.
High Level Data Link Protocol (HDLC) − HDLC is based upon SDLC and
provides both unreliable service and reliable service. It is a bit – oriented protocol that
is applicable for both point – to – point and multipoint communications.
Serial Line Interface Protocol (SLIP) − This is a simple protocol for transmitting
data units between an Internet service provider (ISP) and home user over a dial-up
link. It does not provide error detection / correction facilities.
Link Control Protocol (LCP) − It one of PPP protocols that is responsible for
establishing, configuring, testing, maintaining and terminating links for transmission.
It also imparts negotiation for set up of options and use of features by the two
endpoints of the links.
Network Control Protocol (NCP) − These protocols are used for negotiating the
parameters and facilities for the network layer. For every higher-layer protocol
supported by PPP, one NCP is there.