unit-3
unit-3
Parts of Frame
Frame Header: It contains the source and destination address of the frame.
Payload Field: It will contain the message which is needed to be delivered.
Trailer: It contains the error correction and error detection bits.
Flag: It marks the beginning and the end of the frame.
The source and target identifiers, error-checking codes, and other control
information are added as headers and trailers by these protocols to each
frame.
The same protocol and hardware are used to put the frames back together
into the initial data stream after they have been delivered to the target. The
receiving device checks each frame for errors and drops any frames that fail
the error-checking process.
Framing also supports efficient data transmission over the network. In framing,
we divide the main data into smaller frames, which will lead to more efficiency,
reduction in congestion network, and improve overall network performance for
network devices.
There are mainly two types of framing and those are explained below:
Fixed Size Framing
This makes it easy for network devices to split the data stream into
frames, and for the receiving device to know how much data is in each
frame.
Dis advantages:
For example, video or audio files may not fit neatly into fixed-size
frames, as their size and complexity may vary.
Variable size framing involves dividing the data into frames of varying sizes.
This approach is commonly used in networks where the data being transmitted
does not fit neatly into fixed-size frames, such as video or audio streaming. In
variable-size framing, each frame contains a header that specifies the length of
the payload, allowing the receiving device to know how much data is in each
frame.
Frames can be sized to fit the data being transmitted, which can help to
reduce overhead and increase efficiency.
Dis advantages:
This increases the overhead of each frame, which can reduce overall
network efficiency.
There are two main types of framing approaches used in computer networks:
byte-oriented framing and bit-oriented framing.
Byte-oriented Framing
Bit-oriented Framing
Advantages of Framing
Overhead: Framing adds overhead to the main data stream which in turn
reduces the content of actual data that can be transmitted over the network.
Complexity: We need to use both hardware and software mechanisms to
implement framing which increases the complexity.
Delay: Framing sometimes leads to delay in large networks, as multiple frames
are transferred simultaneously.
Elementary Data link Protocols:
Protocols in the data link layer are designed so that this layer can perform
its basic functions: framing, error control and flow control.
Framing is the process of dividing bit - streams from physical layer into data
frames whose size ranges from a few hundred to a few thousand bytes. Error
control mechanisms deals with transmission errors and retransmission of
corrupted and lost frames. Flow control regulates speed of delivery and so
that a fast sender does not drown a slow receiver.
Data link protocols can be broadly divided into two categories, depending on
whether the transmission channel is noiseless or noisy.
Simplex Protocol
Stop – and – wait Automatic Repeat Request (Stop – and – Wait ARQ) is a
variation of the above protocol with added error control mechanisms,
appropriate for noisy channels. The sender keeps a copy of the sent frame. It
then waits for a finite time to receive a positive acknowledgement from
receiver. If the timer expires or a negative acknowledgement is received, the
frame is retransmitted. If a positive acknowledgement is received then the next
frame is sent.
Go – Back – N ARQ
Go – Back – N ARQ provides for sending multiple frames before receiving the
acknowledgement 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 acknowledgement of a frame is not
received within the time period, all frames starting from that frame are
retransmitted.
This protocol also provides for sending multiple frames before receiving the
acknowledgement for the first frame. However, here only the erroneous or lost
frames are retransmitted, while the good frames are received and buffered.
Data Link Layer communicates with the network layer and physical layer.
Generally, the data link layer receives packets and sends the data to the physical
layer in form of frames. Elementary Data Link Protocols ensure reliability over
a network during the transmission of frames. The Elementary data link
protocols help the data link layer solve problems such as frame loss or damage
and flow control.
The data link layer adds a header and trailer to the packet that makes up
the frame. In the frame field, it contains an error detection method such as
a checksum. Therefore, after adding the control information of the data
link layer in the header and the checksum to the trailer, it is sent to the
receiver.
When the receiver receives the frame, it calculates the checksum and
compares it with the sender’s checksum.
If the checksum value matches, then the receiver’s data link layer will
allow the frame to be sent to the network layer, otherwise, it sends
acknowledgement to the sender that the frame has been damaged.
But when the process of sending a frame is taking place over a channel, a
protocol is used, which defines the time limit for sending and receiving
the frame.
As soon as the sender sends a frame, the timer will start, and it will wait
for some time to receive an acknowledgment from the receiver that it has
received the frame.
If the sender does not receive the acknowledgment within the given time,
the sender will resend the frame to the receiver. This process is done by
the Elementary data link protocols.
When we study the various Elementary data link protocols, we will assume that
there is an unreliable channel over which frame loss occurs during transmission.
To recover frames lost during transmission, the sender starts the internal clock
each time a frame is sent. The sender will wait for some time, and if no reply is
received within the predetermined time, the clock times out, and the data link
layer will receive an interrupt signal.
There are some methods or procedures executed by the protocol that turn
the timer on and off, respectively. The clock is reset only after an interval
is reached.
Since the Elementary data link protocol is used at the data link layer, the
data link layer also controls access to the network layer. The data link
layer decides when to enable the network layer to send packets to prevent
it from swamping packets with them.
There are 3 types of Elementary Data Link Protocols.
Simplex Protocol
No matter what is happening in the network, the sender and receiver are
always ready to communicate. So they also ignore the delay in
processing.
This protocol is just a consideration so that there is infinite buffer space
available on the sender and receiver.
In this protocol, the channel used between layer-2 of the sender and
receiver never discards or damages the frame during communication.
In protocol, two entities are sender and receiver, who communicate with each
other over a channel. The sender process and receiver process are running at the
data link layer of the sender’s machine and the receiver’s machine, respectively.
Sequence number and acknowledgment number are not used. Only the
undamaged frame arrival process is going on.
On the other hand, the receiver is waiting to receive the frame. The frame
comes from the sender, so the receiver will take the frame that comes into
the hardware buffer and send it to the network layer.
After the frame is sent to the network layer, the receiver’s data link layer
will sit back to wait for the next frame.
Because this protocol is unrealistic and unrestricted, it has no flow control and
error control restrictions. Here, no frame is lost during transmission, and hence
no field of the frame is required to control the flow of data and detect the error.
As we got some basic idea about stop-and-wait protocol. Now, let’s see how the
Simplex stop-and-wait protocol handles flow control over a noiseless channel.
The diagram below explains the working of the simplex stop-and-wait protocol.
As you can see in the above diagram that the sender is sending the frame
to the receiver. After sending the frame, the sender stops the transmission
and waits for the acknowledgment from the receiver.
As soon as the receiver receives the frame, it opens it and sends it to the
network layer for further processing. Now, the receiver will create an
acknowledgment, which allows the sender to send the next frame.
You can see that the communication is bidirectional, but they are using
half-duplex mode.
Here, assume the general situation in which the sender and receiver on the
communication channel make an error during transmission. Frames can either
be damaged or lost completely during transmission.
On a noisy channel, the receiver has only a limited buffer capacity and a
limited processing speed, so the protocol prevents the sender from
flooding the receiver with data too fast to handle it.
In rare cases, the frame sent by the sender may be damaged in such a way
that the checksum is correct, causing this and all other protocols to fail.
To avoid this situation, a timer is added.
The data link layer is responsible for flow and error control. Therefore,
when the sender’s network layer transmits a series of packets to the data
link layer, the data link layer transmits the packets through the receiver’s
data link layer to the network layer.
As we have seen in the above section that the network layer does not have the
functionality to detect errors or duplication in the packet, so it is guaranteed by
the data link layer that there are no errors in the packet. But duplicate packets
can arrive at the network layer. So, let us understand this scenario with an
example.
The diagram below explains the working of the simplex stop-and-wait protocol
for a noisy channel.
As you can see in the above diagram, the sender sends the packet in the
form of a frame to the receiver. When the receiver receives the frame, it
sends the frame in a packet format to the network layer.
After frame-1 successfully reaches the receiver, the receiver will send an
acknowledgment to the sender. The sender will send the frame-2 after
receiving the acknowledgment from the receiver. But as shown in the
figure, frame-2 is lost during transmission. Therefore, the sender will
retransmit frame-2 after the timeout.
The sender is waiting for the acknowledgment, but the timeout has
elapsed, and the acknowledgment has not been received. So the sender
will assume that the frame is lost or damaged, and it will send the same
frame again to the receiver.
The receiver receives the same frame again. But how does the receiver
recognize that the packet of the frame is a duplicate or the original? So, it
will use the sequence number to identify whether the packet is duplicate
or new.
In this protocol, the only ambiguity is one frame and its next frame. Suppose
frame-n is lost or damaged, and the receiver didn’t receive the frame. Then, the
receiver will not even send the acknowledgment to the sender. So the sender
will keep sending frames again and again until the acknowledgment is received
in a given amount of time.
If the packet is successfully received on the receiver side and the sender
receives a valid acknowledgment, the sender fetches the next packet from
the network layer and overwrites the previous packet in the buffer. Also,
it increases the sequence number of the packet to prevent duplication of
packets.
If a damaged frame occurs or the clock timer has expired, the packet’s
buffer and sequence number will not change, and the sender will forward
the same or the next packet to the receiver.
When the frame reaches the receiver successfully, the receiver will check
the sequence number to see if it is a duplicate. If not, it is accepted and
passed to the network layer, and an acknowledgment will be sent to the
sender.