0% found this document useful (0 votes)
140 views

Data Link Layer

The data link layer provides three main services to the network layer: 1. It transmits data frames received from the network layer to the destination machine's data link layer. 2. It provides an interface between the network layer and physical layer for actual data transmission. 3. It uses various error control techniques like ARQ to detect and retransmit lost or corrupted frames between sender and receiver.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
140 views

Data Link Layer

The data link layer provides three main services to the network layer: 1. It transmits data frames received from the network layer to the destination machine's data link layer. 2. It provides an interface between the network layer and physical layer for actual data transmission. 3. It uses various error control techniques like ARQ to detect and retransmit lost or corrupted frames between sender and receiver.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

What are the services provided to the network layer by data link layer?

Service Provided to Network Layer :


The important and essential function of Data Link Layer is to provide an interface to
Network Layer. Network Layer is third layer of seven-layer OSI reference model and is
present just above Data Link Layer.
The main aim of Data Link Layer is to transmit data frames they have received to
destination machine so that these data frames can be handed over to network layer of
destination machine. At the network layer, these data frames are basically addressed and
routed.
This process is shown in diagram :

1. Actual Communication :
In this communication, physical medium is present through which Data Link Layer simply
transmits data frames. The actual path is Network Layer -> Data link layer -> Physical
Layer on sending machine, then to physical media and after that to Physical Layer -> Data
link layer -> Network Layer on receiving machine.
2. Virtual Communication :
In this communication, no physical medium is present for Data Link Layer to transmit
data. It can be only be visualized and imagined that two Data Link Layers are
communicating with each other with the help of or using data link protocol.
Types of Services provided by Data Link Layer :
The Data link layer generally provides or offers three types of services as given below :
1. Unacknowledged Connectionless Service
2. Acknowledged Connectionless Service
3. Acknowledged Connection-Oriented Service

1. Unacknowledged Connectionless Service :


Unacknowledged connectionless service simply provides datagram styles delivery
without any error, issue, or flow control. In this service, source machine generally
transmits independent frames to destination machine without having destination
machine to acknowledge these frames.
2. This service is called as connectionless service because there is no connection
established among sending or source machine and destination or receiving machine
before data transfer or release after data transfer.
3. In Data Link Layer, if anyhow frame is lost due to noise, there will be no attempt
made just to detect or determine loss or recovery from it. This simply means that
there will be no error or flow control. An example can be Ethernet.
4. Acknowledged Connectionless Service :
This service simply provides acknowledged connectionless service i.e. packet
delivery is simply acknowledged, with help of stop and wait for protocol.
5. In this service, each frame that is transmitted by Data Link Layer is simply
acknowledged individually and then sender usually knows whether or not these
transmitted data frames received safely. There is no logical connection established
and each frame that is transmitted is acknowledged individually.
6. This mode simply provides means by which user of data link can just send or transfer
data and request return of data at the same time. It also uses particular time period
that if it has passed frame without getting acknowledgment, then it will resend data
frame on time period.
7. This service is more reliable than unacknowledged connectionless service. This
service is generally useful over several unreliable channels, like wireless systems, Wi-
Fi services, etc.
8. Acknowledged Connection-Oriented Service :
In this type of service, connection is established first among sender and receiver or
source and destination before data is transferred.
9. Then data is transferred or transmitted along with this established connection. In
this service, each of frames that are transmitted is provided individual numbers first,
so as to confirm and guarantee that each of frames is received only once that too in
an appropriate order and sequence.

Write a short note on framing


Frames are the units of digital transmission, particularly in computer networks and
telecommunications. Frames are comparable to the packets of energy called photons in the
case of light energy. Frame is continuously used in Time Division Multiplexing process.
Framing is a point-to-point connection between two computers or devices consists of a wire
in which data is transmitted as a stream of bits. However, these bits must be framed into
discernible blocks of information. Framing is a function of the data link layer. It provides a
way for a sender to transmit a set of bits that are meaningful to the receiver. Ethernet,
token ring, frame relay, and other data link layer technologies have their own frame
structures. Frames have headers that contain information such as error-checking codes.
At the data link layer, it extracts the message from the sender and provides it to the
receiver by providing the sender’s and receiver’s addresses. The advantage of using frames
is that data is broken up into recoverable chunks that can easily be checked for corruption.
Problems in Framing –

• Detecting start of the frame: When a frame is transmitted, every station must be
able to detect it. Station detects frames by looking out for a special sequence of bits
that marks the beginning of the frame i.e. SFD (Starting Frame Delimiter).
• How does the station detect a frame: Every station listens to link for SFD pattern
through a sequential circuit. If SFD is detected, sequential circuit alerts station.
Station checks destination address to accept or reject frame.
• Detecting end of frame: When to stop reading the frame.
Types of framing – There are two types of framing:
1. Fixed size – The frame is of fixed size and there is no need to provide boundaries to the
frame, the length of the frame itself acts as a delimiter.

• Drawback: It suffers from internal fragmentation if the data size is less than the
frame size
• Solution: Padding
2. Variable size – In this, there is a need to define the end of the frame as well as the
beginning of the next frame to distinguish. This can be done in two ways:

10. Length field – We can introduce a length field in the frame to indicate the length of
the frame. Used in Ethernet(802.3). The problem with this is that sometimes the
length field might get corrupted.
11. End Delimiter (ED) – We can introduce an ED(pattern) to indicate the end of the
frame. Used in Token Ring. The problem with this is that ED can occur in the data.
This can be solved by:
12. 1. Character/Byte Stuffing: Used when frames consist of characters. If data contains
ED then, a byte is stuffed into data to differentiate it from ED.
13. Let ED = “$” –> if data contains ‘$’ anywhere, it can be escaped using ‘\O’ character.
–> if data contains ‘\O$’ then, use ‘\O\O\O$'($ is escaped using \O and \O is escaped
using \O).
Disadvantage – It is very costly and obsolete method.
2. Bit Stuffing: Let ED = 01111 and if data = 01111
–> Sender stuffs a bit to break the pattern i.e. here appends a 0 in data = 011101.
–> Receiver receives the frame.
–> If data contains 011101, receiver removes the 0 and reads the data.

Examples –
• If Data –> 011100011110 and ED –> 0111 then, find data after bit stuffing?

• –> 011010001101100

• If Data –> 110001001 and ED –> 1000 then, find data after bit stuffing?

• –> 11001010011

Write a short note on error control

Data-link layer uses the techniques of error control simply to ensure and confirm
that all the data frames or packets, i.e. bit streams of data, are transmitted or
transferred from sender to receiver with certain accuracy. Using or providing
error control at this data link layer is an optimization, it was never requirement.
Error control is basically process in data link layer of detecting or identifying and
re-transmitting data frames that might be lost or corrupted during transmission.
In both of these cases, receiver or destination does not receive correct data-frame
and sender or source does not even know anything about any such loss regarding
data frames. Therefore, in such type of cases, both sender and receiver are
provided with some essential protocols that are required to detect or identify
such type of errors like loss of data frames.
The Data-link layer follows technique known as re-transmission of frames to
detect or identify transit errors and also to take necessary actions that are
required to reduce or remove such errors. Each and every time an effort is
detected during transmission, particular data frames retransmitted and this
process is known as ARQ (Automatic Repeat Request).

Ways of doing Error Control :


There are basically two ways of doing Error control as given below :
Ways of Error Control

14. Error Detection :


Error detection, as name suggests, simply means detection or
identification of errors. These errors may cause due to noise or any other
impairments during transmission from transmitter to the receiver, in
communication system. It is class of technique for detecting garbled i.e.
unclear and distorted data or message.
15. Error Correction :
Error correction, as name suggests, simply means correction or solving or
fixing of errors. It simply means reconstruction and rehabilitation of
original data that is error-free. But error correction method is very costly
and is very hard.

Various Techniques for Error Control :


There are various techniques of error control as given below :
Techniques of Error Control

1. Stop-and-Wait ARQ :
Stop-and-Wait ARQ is also known as alternating bit protocol. It is one of
simplest flow and error control techniques or mechanisms. This mechanism is
generally required in telecommunications to transmit data or information
among two connected devices. Receiver simply indicates its readiness to receive
data for each frame. In these, sender sends information or data packet to
receiver. Sender then stops and waits for ACK (Acknowledgment) from receiver.
Further, if ACK does not arrive within given time period i.e., time-out, sender
then again resends frame and waits for ACK. But, if sender receives ACK, then it
will transmi next data packet to receiver and then again wait for ACK fro
receiver. This process to stop and wait continues until sender has no data frame
or packet to send.

2. Sliding Window ARQ :


This technique is generally used for continuous transmission error control. It is
further categorized into two categories as given below :
• Go-Back-N ARQ :
• Go-Back-N ARQ is form of ARQ protocol in which transmission process
continues to send or transmit total number of frames that are specified by
window size even without receiving an ACK (Acknowledgement) packet
from the receiver. It uses sliding window flow control protocol. If no errors
occur, then operation is identical to sliding window.
• Selective Repeat ARQ :
• Selective Repeat ARQ is also form of ARQ protocol in which only suspected
or damaged or lost data frames are only retransmitted. This technique is
similar to Go-Back-N ARQ though much more efficient than the Go-Back-N
ARQ technique due to reason that it reduces number of retransmission. In
this, the sender only retransmits frames for which NAK is received. But this
technique is used less because of more complexity at sender and receiver
and each frame must be needed to acknowledged individually

Write a short note of Flow control.

Flow control is design issue at Data Link Layer. It is technique that generally observes
proper flow of data from sender to receiver. It is very essential because it is possible for
sender to transmit data or information at very fast rate and hence receiver can receive this
information and process it. This can happen only if receiver has very high load of traffic as
compared to sender, or if receiver has power of processing less as compared to sender.
Flow control is basically technique that gives permission to two of stations that are working
and processing at different speeds to just communicate with one another. Flow control in
Data Link Layer simply restricts and coordinates number of frames or amount of data
sender can send just before it waits for an acknowledgment from receiver. Flow control is
actually set of procedures that explains sender about how much data or frames it can
transfer or transmit before data overwhelms receiver.
The receiving device also contains only limited amount of speed and memory to store data.
This is why receiving device should be able to tell or inform the sender about stopping the
transmission or transferring of data on temporary basis before it reaches limit. It also needs
buffer, large block of memory for just storing data or frames until they are processed.
Approaches to Flow Control :
Flow Control is classified into two categories –

• Feedback – based Flow Control :


In this control technique, sender simply transmits data or information or frame to
receiver, then receiver transmits data back to sender and also allows sender to
transmit more amount of data or tell sender about how receiver is processing or
doing. This simply means that sender transmits data or frames after it has received
acknowledgments from user.
• Rate – based Flow Control :
In this control technique, usually when sender sends or transfer data at faster
speed to receiver and receiver is not being able to receive data at the speed, then
mechanism known as built-in mechanism in protocol will just limit or restricts
overall rate at which data or information is being transferred or transmitted by
sender without any feedback or acknowledgment from receiver.

Techniques of Flow Control in Data Link Layer :


There are basically two types of techniques being developed to control the flow of data –
1. Stop-and-Wait Flow Control :
This method is the easiest and simplest form of flow control. In this method, basically
message or data is broken down into various multiple frames, and then receiver indicates
its readiness to receive frame of data. When acknowledgment is received, then only sender
will send or transfer the next frame.
This process is continued until sender transmits EOT (End of Transmission) frame. In this
method, only one of frames can be in transmission at a time. It leads to inefficiency i.e. less
productivity if propagation delay is very much longer than the transmission delay.
Advantages –

• This method is very easiest and simple and each of the frames is checked and
acknowledged well.
• It can also be used for noisy channels.
• This method is also very accurate.
Disadvantages –

• This method is fairly slow.


• In this, only one packet or frame can be sent at a time.
• It is very inefficient and makes the transmission process very slow.

2. Sliding Window Flow Control :


This method is required where reliable in-order delivery of packets or frames is very much
needed like in data link layer. It is point to point protocol that assumes that none of the
other entity tries to communicate until current data or frame transfer gets completed. In
this method, sender transmits or sends various frames or packets before receiving any
acknowledgment.
In this method, both the sender and receiver agree upon total number of data frames after
which acknowledgment is needed to be transmitted. Data Link Layer requires and uses this
method that simply allows sender to have more than one unacknowledged packet “in-
flight” at a time. This increases and improves network throughput.
Advantages –

• It performs much better than stop-and-wait flow control.


• This method increases efficiency.
• Multiples frames can be sent one after another.
Disadvantages –

• The main issue is complexity at the sender and receiver due to the transferring of
multiple frames.
• The receiver might receive data frames or packets out the sequence.

Write a short note on error detection


Error
A condition when the receiver’s information does not match with the sender’s information.
During transmission, digital signals suffer from noise that can introduce errors in the binary
bits travelling from sender to receiver. That means a 0 bit may change to 1 or a 1 bit may
change to 0.

Error Detecting Codes (Implemented either at Data link layer or Transport Layer of OSI
Model)
Whenever a message is transmitted, it may get scrambled by noise or data may get
corrupted. To avoid this, we use error-detecting codes which are additional data added to a
given digital message to help us detect if any error has occurred during transmission of the
message.

Basic approach used for error detection is the use of redundancy bits, where additional
bits are added to facilitate detection of errors.
Some popular techniques for error detection are:
1. Simple Parity check
2. Two-dimensional Parity check
3. Checksum
4. Cyclic redundancy check

1. Simple Parity check


Blocks of data from the source are subjected to a check bit or parity bit generator form,
where a parity of :

• 1 is added to the block if it contains odd number of 1’s, and


• 0 is added if it contains even number of 1’s
This scheme makes the total number of 1’s even, that is why it is called even parity
checking.

2. Two-dimensional Parity check


Parity check bits are calculated for each row, which is equivalent to a simple parity check
bit. Parity check bits are also calculated for all columns, then both are sent along with the
data. At the receiving end these are compared with the parity bits calculated on the
received data.
3. Checksum

• In checksum error detection scheme, the data is divided into k segments each of m
bits.
• In the sender’s end the segments are added using 1’s complement arithmetic to get
the sum. The sum is complemented to get the checksum.
• The checksum segment is sent along with the data segments.
• At the receiver’s end, all received segments are added using 1’s complement
arithmetic to get the sum. The sum is complemented.
• If the result is zero, the received data is accepted; otherwise discarded.
4. Cyclic redundancy check (CRC)

• Unlike checksum scheme, which is based on addition, CRC is based on binary


division.
• In CRC, a sequence of redundant bits, called cyclic redundancy check bits, are
appended to the end of data unit so that the resulting data unit becomes exactly
divisible by a second, predetermined binary number.
• At the destination, the incoming data unit is divided by the same number. If at this
step there is no remainder, the data unit is assumed to be correct and is therefore
accepted.
• A remainder indicates that the data unit has been damaged in transit and therefore
must be rejected.
Example :

Protocols
Write a short note on simplex stop and wait protocol for noiseless
channel
Stop – and – Wait protocol is data link layer protocol for transmission of frames over
noiseless channels. It provides unidirectional data transmission with flow control
facilities but without error control facilities.

This protocol takes into account the fact that the receiver has a finite processing speed.
If data frames arrive at the receiver’s end at a rate which is greater than its rate of
processing, frames be dropped out. In order to avoid this, the receiver sends an
acknowledgement for each frame upon its arrival. The sender sends the next frame only
when it has received a positive acknowledgement from the receiver that it is available
for further data processing.

Design
• Sender Site: The data link layer in the sender site waits for the network layer for
a data packet. It then checks whether it can send the frame. If it receives a positive
notification from the physical layer, it makes frames out of the data and sends it.
It then waits for an acknowledgement before sending the next frame.
• Receiver Site: The data link layer in the receiver site waits for a frame to arrive.
When it arrives, the receiver processes it and delivers it to the network layer. It
then sends an acknowledgement back to the sender.

Write a short note on stop and wait protocol for noisy channel
Simplex Stop – and – Wait protocol for noisy channel is data link layer protocol for data
communications with error control and flow control mechanisms. It is popularly known
as Stop – and –Wait Automatic Repeat Request (Stop – and –Wait ARQ) protocol. It
adds error control facilities to Stop – and – Wait protocol.

This protocol takes into account the facts that the receiver has a finite processing speed
and that frames may get corrupted while transmission. If data frames arrive at the
receiver’s end at a rate which is greater than its rate of processing, frames can be
dropped out. Also, frames may get corrupted or entirely lost when they are transmitted
via network channels. So, the receiver sends an acknowledgment for each valid frame
that it receives. The sender sends the next frame only when it has received a positive
acknowledgment from the receiver that it is available for further data processing.
Otherwise, it waits for a certain amount of time and then resends the frame.

Design
• Sender Site − At the sender site, a field is added to the frame to hold a sequence
number. If data is available, the data link layer makes a frame with the certain
sequence number and sends it. The sender then waits for arrival of
acknowledgment for a certain amount of time. If it receives a positive
acknowledgment for the frame with that sequence number within the stipulated
time, it sends the frame with next sequence number. Otherwise, it resends the
same frame.
• Receiver Site − The receiver also keeps a sequence number of the frames
expected for arrival. When a frame arrives, the receiver processes it and checks
whether it is valid or not. If it is valid and its sequence number matches the
sequence number of the expected frame, it extracts the data and delivers it to the
network layer. It then sends an acknowledgement for that frame back to the
sender along with its sequence number.

Flow Diagram
The following flow diagram depicts communication via simplex stop – and – wait ARQ
protocol for noisy channel −
Write a short note on sliding window protocol

Sliding window protocols are data link layer protocols for reliable and sequential
delivery of data frames. The sliding window is also used in Transmission Control
Protocol.

In this protocol, multiple frames can be sent by a sender at a time before receiving an
acknowledgment from the receiver. The term sliding window refers to the imaginary
boxes to hold frames. Sliding window method is also known as windowing.

Working Principle
In these protocols, the sender has a buffer called the sending window and the receiver
has buffer called the receiving window.
The size of the sending window determines the sequence number of the outbound
frames. If the sequence number of the frames is an n-bit field, then the range of sequence
numbers that can be assigned is 0 to 2 𝑛−1. Consequently, the size of the sending
window is 2 𝑛−1. Thus in order to accommodate a sending window size of 2𝑛−1, a n-bit
sequence number is chosen.

The sequence numbers are numbered as modulo-n. For example, if the sending window
size is 4, then the sequence numbers will be 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, and so on. The
number of bits in the sequence number is 2 to generate the binary sequence 00, 01, 10,
11.

The size of the receiving window is the maximum number of frames that the receiver can
accept at a time. It determines the maximum number of frames that the sender can send
before receiving acknowledgment.

Example
Suppose that we have sender window and receiver window each of size 4. So the
sequence numbering of both the windows will be 0,1,2,3,0,1,2 and so on. The following
diagram shows the positions of the windows after sending the frames and receiving
acknowledgments.
Types of Sliding Window Protocols
The Sliding Window ARQ (Automatic Repeat reQuest) protocols are of two categories

• Go – Back – N ARQ
• Go – Back – N ARQ provides for sending multiple frames before receiving the
acknowledgment for the first frame. It uses the concept of sliding window, and
so is also called sliding window protocol. The frames are sequentially numbered
and a finite number of frames are sent. If the acknowledgment of a frame is not
received within the time period, all frames starting from that frame are
retransmitted.

• Selective Repeat ARQ

• This protocol also provides for sending multiple frames before receiving the
acknowledgment for the first frame. However, here only the erroneous or lost
frames are retransmitted, while the good frames are received and buffered.

Write a short note on piggybacking

Piggybacking in Computer Networks


In this article, we will cover the overview of networking communication and mainly focus on
the concept of piggybacking in networks. And we will also discuss the advantages and
disadvantages of using piggybacking in networks. Finally, we will see the conclusion. Let’s
discuss it one by one.
Networking Communication :
Sliding window algorithms are methods of flow control for network data transfer. The
data link layer uses a sender to have more than one acknowledgment packet at a time,
which improves network throughput. Both the sender and receiver maintain a finite-size
buffer to hold outgoing and incoming packets from the other side. Every packet sends by
the sender must be acknowledged by the receiver. The sender maintains a timer for every
packet sent, and any packet unacknowledged at a certain time is resent. The sender may
send a whole window of packets before receiving an acknowledgment for the first packet
in the window. This results in higher transfer rates, as the sender may send multiple
packets without waiting for each packet’s acknowledgment. The receiver advertises a
window size that tells the sender not to fill up the receiver buffers.
Efficiency can also be improved by making use of full-duplex transmission. Full Duplex
transmission is a two-way directional communication simultaneously. It provides better
performance than simple and half-duplex transmission modes.
Full-duplex transmission

Solution 1 –
One way to achieve full-duplex transmission is to have two separate channels with one
for forwarding data transmission and the other for reverse data transfer (to accept). But
this will almost completely waste the bandwidth of the reverse channel.
Solution 2(Piggybacking) –
A preferable solution would be to use each channel to transmit the frame (front and back)
both ways, with both channels having the same capacity. Assume that A and B are users.
Then the data frames from A to B are interconnected with the acknowledgment from A to
B. and can be identified as a data frame or acknowledgment by checking the sort field in
the header of the received frame.
One more improvement can be made. When a data frame arrives, the receiver waits does
not send the control frame (acknowledgment) back immediately. The receiver waits until
its network layer moves to the next data packet.
Acknowledgment is associated with this outgoing data frame. Thus the acknowledgment
travels along with the next data frame.
Definition of Piggybacking :
This technique in which the outgoing acknowledgment is delayed temporarily is called
piggybacking.
As we can see in the figure, we can see with piggybacking, a single message (ACK + DATA)
over the wire in place of two separate messages. Piggybacking improves the efficiency of
the bidirectional protocols.
Advantages of piggybacking :
16. The major advantage of piggybacking is the better use of available channel
bandwidth. This happens because an acknowledgment frame needs not to be sent
separately.
17. Usage cost reduction
18. Improves latency of data transfer
Disadvantages of piggybacking :
19. The disadvantage of piggybacking is the additional complexity.
20. If the data link layer waits long before transmitting the acknowledgment (block the
ACK for some time), the frame will rebroadcast.
NOTE – To avoid the delay and rebroadcast of frame transmission, piggybacking uses a very
short duration timer.
Conclusion :
There is a dispute as to whether this is a legal or illegal activity, but piggybacking is still a
dark side of Wi-Fi. Cyber-terrorist attacks in India are a clear reminder that we cannot
control incidents occurring anywhere in the world or control unsecured Wi-Fi networks.
So it is the responsibility of the owner and administrator to secure their wireless
connection.

Difference between go back n arq and selective repeat


Both Go-Back-N Protocol and Selective Repeat Protocol are the types of sliding window
protocols. The main difference between these two protocols is that after finding the
suspect or damage in sent frames go-back-n protocol re-transmits all the frames whereas
selective repeat protocol re-transmits only that frame which is damaged. Now, we shall see
the difference between them:
S.NO Go-Back-N Protocol Selective Repeat Protocol
1. In Go-Back-N Protocol, if the In selective Repeat protocol,
sent frame are find only those frames are re-
suspected then all the transmitted which are
frames are re-transmitted found suspected.
from the lost packet to the
last packet transmitted.
2. Sender window size of Go- Sender window size of
Back-N Protocol is N. selective Repeat protocol is
also N.
3. Receiver window size of Go- Receiver window size of
Back-N Protocol is 1. selective Repeat protocol is
N.
4. Go-Back-N Protocol is less Selective Repeat protocol is
complex. more complex.
5. In Go-Back-N Protocol, In selective Repeat protocol,
neither sender nor at receiver side needs sorting
receiver need sorting. to sort the frames.
6. In Go-Back-N Protocol, type In selective Repeat protocol,
of Acknowledgement is type of Acknowledgement is
cumulative. individual.
7. In Go-Back-N Protocol, Out- In selective Repeat protocol,
of-Order packets are NOT Out-of-Order packets are
Accepted (discarded) and Accepted.
the entire window is re-
transmitted.
8. In Go-Back-N Protocol, if In selective Repeat protocol,
Receives a corrupt packet, if Receives a corrupt
then also, the entire packet, it immediately sends
window is re-transmitted. a negative
acknowledgement and
hence only the selective
packet is retransmitted.
9. Efficiency of Go-Back-N Efficiency of selective
Protocol is Repeat protocol is also
N/(1+2*a) N/(1+2*a)

Go back Arq and Selective repeat Arq

You might also like