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

Computer Network_Unit 2

The document discusses the Data Link Layer of the OSI model, which is responsible for transferring datagrams across individual links and includes protocols such as Ethernet and PPP. It explains the Stop and Wait Protocol and Sliding Window Protocol for flow control, detailing their operations, advantages, and disadvantages. Additionally, it covers MAC addresses, multiple access protocols, and random access protocols like Aloha, highlighting their importance in managing data transmission in networks.

Uploaded by

swapnil jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Computer Network_Unit 2

The document discusses the Data Link Layer of the OSI model, which is responsible for transferring datagrams across individual links and includes protocols such as Ethernet and PPP. It explains the Stop and Wait Protocol and Sliding Window Protocol for flow control, detailing their operations, advantages, and disadvantages. Additionally, it covers MAC addresses, multiple access protocols, and random access protocols like Aloha, highlighting their importance in managing data transmission in networks.

Uploaded by

swapnil jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Data Link Layer

o In the OSI model, the data link layer is a 4th 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.

Stop and Wait Protocol


Here stop and wait means, whatever the data that sender wants to send, he sends the
data to the receiver. After sending the data, he stops and waits until he receives the
acknowledgment from the receiver. The stop and wait protocol is a flow control
protocol where flow control is one of the services of the data link layer.

It is a data-link layer protocol which is used for transmitting the data over the noiseless
channels. It provides unidirectional data transmission which means that either sending
or receiving of data will take place at a time. It provides flow-control mechanism but
does not provide any error control mechanism.

The idea behind the usage of this frame is that when the sender sends the frame then
he waits for the acknowledgment before sending the next frame.

Primitives of Stop and Wait Protocol


The primitives of stop and wait protocol are:

Sender side
Rule 1: Sender sends one data packet at a time.

Rule 2: Sender sends the next packet only when it receives the acknowledgment of
the previous packet.

Therefore, the idea of stop and wait protocol in the sender's side is very simple, i.e.,
send one packet at a time, and do not send another packet before receiving the
acknowledgment.

Receiver side
Rule 1: Receive and then consume the data packet.

Rule 2: When the data packet is consumed, receiver sends the acknowledgment to the
sender.

Therefore, the idea of stop and wait protocol in the receiver's side is also very simple,
i.e., consume the packet, and once the packet is consumed, the acknowledgment is
sent. This is known as a flow control mechanism.

Working of Stop and Wait protocol

The above figure shows the working of the stop and wait protocol. If there is a sender
and receiver, then sender sends the packet and that packet is known as a data packet.
The sender will not send the second packet without receiving the acknowledgment of
the first packet. The receiver sends the acknowledgment for the data packet that it has
received. Once the acknowledgment is received, the sender sends the next packet. This
process continues until all the packet are not sent. The main advantage of this protocol
is its simplicity but it has some disadvantages also. For example, if there are 1000 data
packets to be sent, then all the 1000 packets cannot be sent at a time as in Stop and
Wait protocol, one packet is sent at a time.

Disadvantages of Stop and Wait protocol.


The following are the problems associated with a stop and wait protocol:

1. Problems occur due to lost data

Suppose the sender sends the data and the data is lost. The receiver is waiting for the
data for a long time. Since the data is not received by the receiver, so it does not send
any acknowledgment. Since the sender does not receive any acknowledgment so it
will not send the next packet. This problem occurs due to the lost data.

In this case, two problems occur:

o Sender waits for an infinite amount of time for an acknowledgment.


o Receiver waits for an infinite amount of time for a data.

2. Problems occur due to lost acknowledgment


Suppose the sender sends the data and it has also been received by the receiver. On
receiving the packet, the receiver sends the acknowledgment. In this case, the
acknowledgment is lost in a network, so there is no chance for the sender to receive
the acknowledgment. There is also no chance for the sender to send the next packet
as in stop and wait protocol, the next packet cannot be sent until the acknowledgment
of the previous packet is received.

In this case, one problem occurs:

o Sender waits for an infinite amount of time for an acknowledgment.


3. Problem due to the delayed data or acknowledgment

Suppose the sender sends the data and it has also been received by the receiver. The
receiver then sends the acknowledgment but the acknowledgment is received after
the timeout period on the sender's side. As the acknowledgment is received late, so
acknowledgment can be wrongly considered as the acknowledgment of some other
data packet.

Sliding Window Protocol


Sliding Window

o The Sliding Window is a method of flow control in which a sender can transmit
the several frames before getting an acknowledgement.
o In Sliding Window Control, multiple frames can be sent one after the another
due to which capacity of the communication channel can be utilized efficiently.
o A single ACK acknowledge multiple frames.
o Sliding Window refers to imaginary boxes at both the sender and receiver end.
o The window can hold the frames at either end, and it provides the upper limit
on the number of frames that can be transmitted before the acknowledgement.
o Frames can be acknowledged even when the window is not completely filled.
o The window has a specific size in which they are numbered as modulo-n means
that they are numbered from 0 to n-1. For example, if n = 8, the frames are
numbered from 0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1........
o The size of the window is represented as n-1. Therefore, maximum n-1 frames
can be sent before acknowledgement.
o When the receiver sends the ACK, it includes the number of the next frame that
it wants to receive. For example, to acknowledge the string of frames ending
with frame number 4, the receiver will send the ACK containing the number 5.
When the sender sees the ACK with the number 5, it got to know that the frames
from 0 through 4 have been received.

Sender Window

o At the beginning of a transmission, the sender window contains n-1 frames, and
when they are sent out, the left boundary moves inward shrinking the size of
the window. For example, if the size of the window is w if three frames are sent
out, then the number of frames left out in the sender window is w-3.
o Once the ACK has arrived, then the sender window expands to the number
which will be equal to the number of frames acknowledged by ACK.
o For example, the size of the window is 7, and if frames 0 through 4 have been
sent out and no acknowledgement has arrived, then the sender window
contains only two frames, i.e., 5 and 6. Now, if ACK has arrived with a number 4
which means that 0 through 3 frames have arrived undamaged and the sender
window is expanded to include the next four frames. Therefore, the sender
window contains six frames (5,6,7,0,1,2).
Receiver Window

o At the beginning of transmission, the receiver window does not contain n


frames, but it contains n-1 spaces for frames.
o When the new frame arrives, the size of the window shrinks.
o The receiver window does not represent the number of frames received, but it
represents the number of frames that can be received before an ACK is sent.
For example, the size of the window is w, if three frames are received then the
number of spaces available in the window is (w-3).
o Once the acknowledgement is sent, the receiver window expands by the
number equal to the number of frames acknowledged.
o Suppose the size of the window is 7 means that the receiver window contains
seven spaces for seven frames. If the one frame is received, then the receiver
window shrinks and moving the boundary from 0 to 1. In this way, window
shrinks one by one, so window now contains the six spaces. If frames from 0
through 4 have sent, then the window contains two spaces before an
acknowledgement is sent.
Types of Sliding Window Protocol
Sliding window protocol has two types:

1. Go-Back-N ARQ
2. Selective Repeat ARQ

Go-Back-N ARQ
In Go-Back-N ARQ, N is the sender's window size. Suppose we say that Go-Back-3,
which means that the three frames can be sent at a time before expecting the
acknowledgment from the receiver.

It uses the principle of protocol pipelining in which the multiple frames can be sent
before receiving the acknowledgment of the first frame. If we have five frames and the
concept is Go-Back-3, which means that the three frames can be sent, i.e., frame no 1,
frame no 2, frame no 3 can be sent before expecting the acknowledgment of frame no
1.

In Go-Back-N ARQ, the frames are numbered sequentially as Go-Back-N ARQ sends
the multiple frames at a time that requires the numbering approach to distinguish the
frame from another frame, and these numbers are known as the sequential numbers.

The number of frames that can be sent at a time totally depends on the size of the
sender's window. So, we can say that 'N' is the number of frames that can be sent at a
time before receiving the acknowledgment from the receiver.

If the acknowledgment of a frame is not received within an agreed-upon time period,


then all the frames available in the current window will be retransmitted. Suppose we
have sent the frame no 5, but we didn't receive the acknowledgment of frame no 5,
and the current window is holding three frames, then these three frames will be
retransmitted.

The sequence number of the outbound frames depends upon the size of the sender's
window. Suppose the sender's window size is 2, and we have ten frames to send, then
the sequence numbers will not be 1,2,3,4,5,6,7,8,9,10. Let's understand through an
example.

o N is the sender's window size.


o If the size of the sender's window is 4 then the sequence number will be
0,1,2,3,0,1,2,3,0,1,2, and so on.

The number of bits in the sequence number is 2 to generate the binary sequence
00,01,10,11.

Working of Go-Back-N ARQ


Suppose there are a sender and a receiver, and let's assume that there are 11 frames
to be sent. These frames are represented as 0,1,2,3,4,5,6,7,8,9,10, and these are the
sequence numbers of the frames. Mainly, the sequence number is decided by the
sender's window size. But, for the better understanding, we took the running sequence
numbers, i.e., 0,1,2,3,4,5,6,7,8,9,10. Let's consider the window size as 4, which means
that the four frames can be sent at a time before expecting the acknowledgment of
the first frame.

Step 1: Firstly, the sender will send the first four frames to the receiver, i.e., 0,1,2,3, and
now the sender is expected to receive the acknowledgment of the 0th frame.

Let's assume that the receiver has sent the acknowledgment for the 0 frame, and the
receiver has successfully received it.
The sender will then send the next frame, i.e., 4, and the window slides containing four
frames (1,2,3,4).

The receiver will then send the acknowledgment for the frame no 1. After receiving the
acknowledgment, the sender will send the next frame, i.e., frame no 5, and the window
will slide having four frames (2,3,4,5).
Now, let's assume that the receiver is not acknowledging the frame no 2, either the
frame is lost, or the acknowledgment is lost. Instead of sending the frame no 6, the
sender Go-Back to 2, which is the first frame of the current window, retransmits all the
frames in the current window, i.e., 2,3,4,5.
Selective-Repeat ARQ

o Selective-Repeat ARQ technique is more efficient than Go-Back-n ARQ.


o In this technique, only those frames are retransmitted for which negative
acknowledgement (NAK) has been received.
o The receiver storage buffer keeps all the damaged frames on hold until the
frame in error is correctly received.
o The receiver must have an appropriate logic for reinserting the frames in a
correct order.
o The sender must consist of a searching mechanism that selects only the
requested frame for retransmission.
MAC Address
o MAC address is the physical address, which uniquely identifies each device on
a given network. To make communication between two networked devices, we
need two addresses: IP address and MAC address. It is assigned to the NIC
(Network Interface card) of each device that can be connected to the internet.
o It stands for Media Access Control, and also known as Physical address,
hardware address, or BIA (Burned In Address).
o It is globally unique; it means two devices cannot have the same MAC address.
It is represented in a hexadecimal format on each device, such
as 00:0a:95:9d:67:16.
o It is 12-digit, and 48 bits long, out of which the first 24 bits are used
for OUI(Organization Unique Identifier), and 24 bits are for NIC/vendor-specific.
o It works on the data link layer of the OSI model.
o It is provided by the device's vendor at the time of manufacturing and
embedded in its NIC, which is ideally cannot be changed.

Multiple access protocol


When a sender and receiver have a dedicated link to transmit data packets, the data
link control is enough to handle the channel. Suppose there is no dedicated path to
communicate or transfer the data between two devices. In that case, multiple stations
access the channel and simultaneously transmits the data over the channel. It may
create collision and cross talk. Hence, the multiple access protocol is required to reduce
the collision and avoid crosstalk between the channels.

For example, suppose that there is a classroom full of students. When a teacher asks a
question, all the students (small channels) in the class start answering the question at
the same time (transferring the data simultaneously). All the students respond at the
same time due to which data is overlap or data lost. Therefore it is the responsibility
of a teacher (multiple access protocol) to manage the students and make them one
answer.

Following are the types of multiple access protocol that is subdivided into the different
process as:

A. Random Access Protocol


In this protocol, all the station has the equal priority to send the data over a channel.
In random access protocol, one or more stations cannot depend on another station
nor any station control another station. Depending on the channel's state (idle or
busy), each station transmits the data frame. However, if more than one station sends
the data over a channel, there may be a collision or data conflict. Due to the collision,
the data frame packets may be lost or changed. And hence, it does not receive by the
receiver end.

Following are the different methods of random-access protocols for broadcasting


frames on the channel.

o Aloha
o CSMA
o CSMA/CD
o CSMA/CA

ALOHA Random Access Protocol

It is designed for wireless LAN (Local Area Network) but can also be used in a shared
medium to transmit data. Using this method, any station can transmit data across a
network simultaneously when a data frameset is available for transmission.

Aloha Rules

1. Any station can transmit data to a channel at any time.


2. It does not require any carrier sensing.
3. Collision and data frames may be lost during the transmission of data through multiple
stations.
4. Acknowledgment of the frames exists in Aloha. Hence, there is no collision detection.
5. It requires retransmission of data after some random amount of time.
Pure Aloha

Whenever data is available for sending over a channel at stations, we use Pure Aloha.
In pure Aloha, when each station transmits data to a channel without checking whether
the channel is idle or not, the chances of collision may occur, and the data frame can
be lost. When any station transmits the data frame to a channel, the pure Aloha waits
for the receiver's acknowledgment. If it does not acknowledge the receiver end within
the specified time, the station waits for a random amount of time, called the backoff
time (Tb). And the station may assume the frame has been lost or destroyed. Therefore,
it retransmits the frame until all the data are successfully transmitted to the receiver.

1. The total vulnerable time of pure Aloha is 2 * Tfr.


2. Maximum throughput occurs when G = 1/ 2 that is 18.4%.
3. Successful transmission of data frame is S = G * e ^ - 2 G.

As we can see in the figure above, there are four stations for accessing a shared channel
and transmitting data frames. Some frames collide because most stations send their
frames at the same time. Only two frames, frame 1.1 and frame 2.2, are successfully
transmitted to the receiver end. At the same time, other frames are lost or destroyed.
Whenever two frames fall on a shared channel simultaneously, collisions can occur,
and both will suffer damage. If the new frame's first bit enters the channel before
finishing the last bit of the second frame. Both frames are completely finished, and
both stations must retransmit the data frame.
Slotted Aloha

The slotted Aloha is designed to overcome the pure Aloha's efficiency because pure
Aloha has a very high possibility of frame hitting. In slotted Aloha, the shared channel
is divided into a fixed time interval called slots. So that, if a station wants to send a
frame to a shared channel, the frame can only be sent at the beginning of the slot, and
only one frame is allowed to be sent to each slot. And if the stations are unable to send
data to the beginning of the slot, the station will have to wait until the beginning of
the slot for the next time. However, the possibility of a collision remains when trying
to send a frame at the beginning of two or more station time slot.

1. Maximum throughput occurs in the slotted Aloha when G = 1 that is 37%.


2. The probability of successfully transmitting the data frame in the slotted Aloha is S =
G * e ^ - 2 G.
3. The total vulnerable time required in slotted Aloha is Tfr.

CSMA (Carrier Sense Multiple Access)

It is a carrier sense multiple access based on media access protocol to sense the
traffic on a channel (idle or busy) before transmitting the data. It means that if the
channel is idle, the station can send data to the channel. Otherwise, it must wait until
the channel becomes idle. Hence, it reduces the chances of a collision on a
transmission medium.

CSMA Access Modes


1-Persistent: In the 1-Persistent mode of CSMA that defines each node, first sense the
shared channel and if the channel is idle, it immediately sends the data. Else it must
wait and keep track of the status of the channel to be idle and broadcast the frame
unconditionally as soon as the channel is idle.

Non-Persistent: It is the access mode of CSMA that defines before transmitting the
data, each node must sense the channel, and if the channel is inactive, it immediately
sends the data. Otherwise, the station must wait for a random time (not continuously),
and when the channel is found to be idle, it transmits the frames.

P-Persistent: It is the combination of 1-Persistent and Non-persistent modes. The P-


Persistent mode defines that each node senses the channel, and if the channel is
inactive, it sends a frame with a P probability. If the data is not transmitted, it waits for
a (q = 1-p probability) random time and resumes the frame with the next time slot.
CSMA/ CD

It is a carrier sense multiple access/ collision detection network protocol to transmit


data frames. The CSMA/CD protocol works with a medium access control layer.
Therefore, it first senses the shared channel before broadcasting the frames, and if the
channel is idle, it transmits a frame to check whether the transmission was successful.
If the frame is successfully received, the station sends another frame. If any collision is
detected in the CSMA/CD, the station sends a jam/ stop signal to the shared channel
to terminate data transmission. After that, it waits for a random time before sending a
frame to a channel.

CSMA/ CA

It is a carrier sense multiple access/collision avoidance network protocol for carrier


transmission of data frames. It is a protocol that works with a medium access control
layer. When a data frame is sent to a channel, it receives an acknowledgment to check
whether the channel is clear. If the station receives only a single (own)
acknowledgments, that means the data frame has been successfully transmitted to the
receiver. But if it gets two signals (its own and one more in which the collision of
frames), a collision of the frame occurs in the shared channel. Detects the collision of
the frame when a sender receives an acknowledgment signal.

Following are the methods used in the CSMA/ CA to avoid the collision:

Interframe space: In this method, the station waits for the channel to become idle,
and if it gets the channel is idle, it does not immediately send the data. Instead of this,
it waits for some time, and this time period is called the Interframe space or IFS.
However, the IFS time is often used to define the priority of the station.

Contention window: In the Contention window, the total time is divided into different
slots. When the station/ sender is ready to transmit the data frame, it chooses a
random slot number of slots as wait time. If the channel is still busy, it does not restart
the entire process, except that it restarts the timer only to send data packets when the
channel is inactive.

Acknowledgment: In the acknowledgment method, the sender station sends the data
frame to the shared channel if the acknowledgment is not received ahead of time.

You might also like