Professional Documents
Culture Documents
Computer Network Important Question
Computer Network Important Question
1> compare and contrast the go-back-n arq protocol with the selective-
repeat arq protocal with diagram.
Solution :- 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.
Go-Back-N Protocol:
The Go-Back-N protocol is a sliding window protocol used for reliable data transfer
in computer networks. It is a sender-based protocol that allows the sender to transmit
multiple packets without waiting for an acknowledgement for each packet. The
receiver sends a cumulative acknowledgement for a sequence of packets, indicating
the last correctly received packet. If any packet is lost, the receiver sends a negative
acknowledgement (NACK) for the lost packet, and the sender retransmits all the
packets in the window starting from the lost packet. The sender also maintains a
timer for each packet, and if an acknowledgement is not received within the timer’s
timeout period, the sender retransmits all packets in the window.
The key features of the Go-Back-N (GBN) protocol include:
Sliding window mechanism
Sequence numbers
Cumulative acknowledgements
Timeout mechanism
NACK mechanism
Simple implementation.
The Selective Repeat protocol is another sliding window protocol used for reliable
data transfer in computer networks. It is a receiver-based protocol that allows the
receiver to acknowledge each packet individually, rather than a cumulative
acknowledgement of a sequence of packets. The sender sends packets in a window
and waits for acknowledgements for each packet in the window. If a packet is lost,
the receiver sends a NACK for the lost packet, and the sender retransmits only that
packet. The sender also maintains a timer for each packet, and if an
acknowledgement is not received within the timer’s timeout period, the sender
retransmits only that packet.
key features include:
Receiver-based protocol
Each packet is individually acknowledged by the receiver
Only lost packets are retransmitted, reducing network congestion
Maintains a buffer to store out-of-order packets
Requires more memory and processing power than Go-Back-N
Provides efficient transmission of packets.
The following table highlights the major differences between the Go-Back-N
and the Selective Repeat protocols −
In Go-Back-N, if In Selective
a sent frame is Repeat, only the
found suspected suspected or
or damaged, damaged frames
Definition
then all the are
frames are retransmitted.
retransmitted till
the last packet.
Go-Back-N is In Selective
easier to Repeat, receiver
Complexity
implement. window needs to
sort the frames.
Acknowledgeme Acknowledgeme
Acknowledgeme
nt type is nt type is
nt
cumulative. individual.
Out-of-Order Out-of-Order
packets are packets are
Out-of-order
rejected, and the accepted in the
Packets
entire window is selective Repeat
re-transmitted. protocol.
Key Go-Back-N Selective Repeat
Conclusion
2 > differentiate between pure aloha and slotted aloha with example
and diagram.
Solution :- The Aloha Protocol allows several stations to send data frames
over the same communication channel at the same time. This protocol is a
straightforward communication method in which each network station is
given equal priority and works independently.
Aloha is a medium access control (MAC) protocol for transmission of data via a
shared network channel. Using this protocol, several data streams originating
from multiple nodes are transferred through a multi-point transmission
channel.
There are two types of Aloha protocols − Pure Aloha and Slotted Aloha.
In Pure Aloha, the time of transmission is continuous. Whenever a station has an
available frame, it sends the frame. If there is collision and the frame is destroyed, the
sender waits for a random amount of time before retransmitting it.
In Slotted Aloha, time is divided into discrete intervals called slots, corresponding to a
frame.
In this article, we will highlight the major differences between Pure Aloha and
Slotted Aloha.
Due to the bursty nature of traffic inside a network, the possibilities of data
frames colliding are quite high when using the Pure Aloha protocol.
In slotted aloha, successful data transmission occurs only when each slot sends just one
data frame at a time. The chance of a collision is considerably reduced by doing so.
Here, time is divided into discrete intervals called slots, corresponding to a frame. The
communicating stations agree upon the slot boundaries.
Any station can send only one frame in each slot. Also, the stations cannot transmit at any
time whenever a frame is available. They should wait for the beginning of the next slot.
It will stay idle if no data packets are sent in any of the slots. It should be noted that if a
packet does not get acknowledgment after a collision, it is deemed lost and is
retransmitted in a different slot after back-off time is taken into account.
However, there still can be collisions. If more than one frame transmits at
the beginning of a slot, collisions occur.
What is aloha?
Aloha is designed for wireless LAN (Local Area Network) but can also be used in a
shared medium to transmit data. In aloha, any station can transmit data to a channel
at any time. It does not require any carrier sensing.
Pure Aloha
Pure aloha is used when data is available for sending over a channel at stations. 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 a station transmits the data frame to a channel without checking whether the
channel is free or not, there will be a possibility of the collision of data frames.
Station expects the acknowledgement from the receiver, and if the
acknowledgement of the frame is received at the specified time, then it will be OK;
otherwise, the station assumes that the frame is destroyed. Then station waits for a
random amount of time, and after that, it retransmits the frame until all the data are
successfully transmitted to the receiver.
Slotted Aloha
There is a high possibility of frame hitting in pure aloha, so slotted aloha is designed
to overcome it. Unlike pure aloha, slotted aloha does not allow the transmission of
data whenever the station wants to send it.
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. If the station is failed to send the data, it has to wait until the next slot.
However, there is still a possibility of a collision because suppose if two stations try to
send a frame at the beginning of the time slot.
1. Basic In pure aloha, data can be transmitted In slotted aloha, data can be
at any time by any station. transmitted at the beginning of
the time slot.
4. Number of It does not decrease the number of On the other hand, slotted aloha
collisions collisions to half. enhances the efficiency of pure
aloha.
It decreases the number of
collisions to half.
5. Vulnerable time In pure aloha, the vulnerable time is = Whereas, in slotted aloha, the
2 x Tt vulnerable time is = Tt
6. Successful In pure aloha, the probability of the In slotted aloha, the probability
transmission successful transmission of the frame is of the successful transmission of
- the frame is -
S = G * e-2G S = G * e-G
Conclusion
From the above discussion, it can be said that slotted aloha is somewhat better than
pure aloha. It is because there is less possibility of collision in slotted aloha.
Definition Of Pure ALOHA
If a frame is
damaged, then the stations wait for a random amount of type and retransmits the
frame till it transmits successfully. The waiting time of the each station must be
random and it must not be same just to avoid the collision of the frames again and
again.
The throughput of the Pure ALOHA is maximized when the frames are of uniform
length. The formula to calculate the throughput of the Pure ALOHA is S-=G*e^-
2G, the throughput is maximum when G=1/2 which is 18% of the total transmitted
data frames.
After the pure ALOHA in 1970, Roberts introduced an another method to improve
the capacity of the Pure ALOHA which is called Slotted ALOHA. He proposed to
divide the time into discrete intervals called time slots. Each time slot corresponds
to the length of the frame.
In contrast to the Pure ALOHA, Slotted ALOHA does not allow to transmit the
data whenever the station has the data to be send. The Slotted ALOHA makes the
station to wait till the next time slot begins and allow each data frame to be
transmitted in the new time slot.
Synchronizati
on can be achieved in Slotted ALOHA with the help of a special station that emits
a pip at the beginning of every time slot as a clock does. The formula to calculate
the throughput of the Slotted ALOHA is S=G*e^-G, the throughput is maximum
when G=1 which is 37% of the total transmitted data frames. In Slotted ALOHA,
37% of the time slot is empty, 37% successes and 26% collision.
Note :- diagram make from Greek from Greek . and example take from
youtube video .
3 > How data link layer provide error control and flow control ? Explain with
examples .
Overview
Data Link Layer is responsible for reliable point-to-point data transfer over a physical
medium. To implement this data link layer provides three functions :
Line Discipline:
Line discipline is the functionality used to establish coordination between link systems. It
decides which device sends data and when.
Flow Control:
Flow control is an essential function that coordinates the amount of data the sender can
send before waiting for acknowledgment from the receiver.
Error Control:
Error control is functionality used to detect erroneous transmissions in data frames and
retransmit them.
Flow control is a set of procedures that restrict the amount of data a sender should send
before it waits for some acknowledgment from the receiver.
The device on the receiving end has a limited amount of memory (to store incoming data)
and limited speed (to process incoming data). The receiver might get overwhelmed if the rate
at which the sender sends data is faster or the amount of data sent is more than its capacity.
Buffers are blocks in the memory that store data until it is processed. If the buffer is
overloaded and there is more incoming data, then the receiver will start losing frames.
The flow control mechanism was devised to avoid this loss and wastage of frames.
Following this mechanism, the receiver, as per its capacity, sends an acknowledgment to send
fewer frames or temporarily halt the transmission until it can receive again.
Thus, flow control is the method of controlling the rate of transmission of data to a value that
the receiver can handle.
Stop-and-wait Protocol
Stop-and-wait protocol works under the assumption that the communication channel
is noiseless and transmissions are error-free.
Working:
The sliding window protocol is the flow control protocol for noisy channels that allows the
sender to send multiple frames even before acknowledgments are received. It is called
a Sliding window because the sender slides its window upon receiving the acknowledgments
for the sent frames.
Working:
The sender and receiver have a “window” of frames. A window is a space that consists of
multiple bytes. The size of the window on the receiver side is always 1.
Each frame is sequentially numbered from 0 to n - 1, where n is the window size at the
sender side.
The sender sends as many frames as would fit in a window.
After receiving the desired number of frames, the receiver sends an acknowledgment. The
acknowledgment (ACK) includes the number of the next expected frame.
Example:
1. The sender sends the frames 0 and 1 from the first window (because the window size
is 2).
2. The receiver after receiving the sent frames, sends an acknowledgment for frame 2 (as
frame 2 is the next expected frame).
3. The sender then sends frames 2 and 3. Since frame 2 is lost on the way, the receiver
sends back a “NAK” signal (a non-acknowledgment) to inform the sender that
frame 2 has been lost. So, the sender retransmits frame 2.
Error Control is a combination of both error detection and error correction. It ensures that
the data received at the receiver end is the same as the one sent by the sender.
Error detection is the process by which the receiver informs the sender about any erroneous
frame (damaged or lost) sent during transmission.
Error control is a vital function of the data link layer that detects errors in transmitted
frames and retransmits all the erroneous frames. Error discovery and amendment deal with
data frames damaged or lost in transit and the acknowledgment frames lost during
transmission. The method used in noisy channels to control these errors
is ARQ or Automatic Repeat Request.
Categories of Error Control
Stop-and-wait ARQ
In the case of stop-and-wait ARQ after the frame is sent, the sender maintains a timeout
counter.
If acknowledgment of the frame comes in time, the sender transmits the next frame in the
queue.
Else, the sender retransmits the frame and starts the timeout counter.
In case the receiver receives a negative acknowledgment, the sender retransmits the frame.
To deal with the retransmission of lost or damaged frames, a few changes are made to the
sliding window mechanism used in flow control.
Go-Back-N ARQ :
In Go-Back-N ARQ, if the sent frames are suspected or damaged, all the frames are re-
transmitted from the lost packet to the last packet transmitted.
Selective repeat ARQ/ Selective Reject ARQ is a type of Sliding Window ARQ in which
only the suspected or damaged frames are re-transmitted.
1. Flow Control :
It is an important function of the Data Link Layer. It refers to a set of procedures that
tells the sender how much data it can transmit before waiting for acknowledgment
from the receiver.
Purpose of Flow Control :
Any receiving device has a limited speed at which it can process incoming data and
also a limited amount of memory to store incoming data. If the source is sending the
data at a faster rate than the capacity of the receiver, there is a possibility of the
receiver being swamped. The receiver will keep losing some of the frames simply
because they are arriving too quickly and the buffer is also getting filled up.
This will generate waste frames on the network. Therefore, the receiving device
must have some mechanism to inform the sender to send fewer frames or stop
transmission temporarily. In this way, flow control will control the rate of frame
transmission to a value that can be handled by the receiver.
Example – Stop & Wait Protocol
2. Error Control :
The error control function of the data link layer detects the errors in transmitted
frames and re-transmits all the erroneous frames.
Purpose of Error Control :
The function of error control function of the data link layer helps in dealing with
data frames that are damaged in transit, data frames lost in transit and acknowledged
frames that are lost in transmission. The method used for error control is called
Automatic Repeat Request (ARQ) which is used for the noisy channel.
Example – Stop & Wait ARQ and Sliding Window ARQ
Difference between Flow Control and Error Control :
It is the simplest flow control method in which the sender will send the packet and
then wait for the acknowledgement by the receiver that it has received the packet then
it will send the next packet.
Stop and wait protocol is very easy to implement.
Total time taken to send is,
Efficiency
= useful time / total cycle time
= Tt / (Tt+2Tp)
= 1 / (1+2a) [a = Tp/Tt]
Note: Stop and wait is better for less distance. Hence it is a good protocol for LAN.
Stop and wait is favorable for bigger packets.
What if the data packet is lost in between ?
1. According to sender, receiver is busy but actually data is lost.
2. Receiver will assume, no packet has been sent by sender.
3. Both will be waiting for each other and there will be a deadlock.
Need for timeout timer:
A timer is applied and the receiver will wait till the timeout timer for the data after
that it will confirm that the data has been lost.
What if the data packet has been lost ?
After timeout timer expires, sender will assume that the data is lost but actually the
acknowledgement is lost. By assuming this it will send the data packet again but
according to receiver it is a new data packet, hence it will give rise to duplicate packet
problem.
To eliminate duplicate packet problem sequence number is added to the data packet.
So using packet numbers it can easily determine the duplicate packets.
What if there is a delay in receiving acknowledgement ?
Characteristics
Useful Terms:
Receiver:
Rule 1) Send acknowledgement after receiving and consuming a data packet.
Rule 2) After consuming packet acknowledgement need to be sent (Flow Control)
Problems :
1. Lost Data
2. Lost Acknowledgement:
1. Time Out:
Minimum Number Of Bits For Sender window (Very Important For GATE)
As we have seen above,
Maximum window size = 1 + 2*a where a = Tp/Tt
Advantages:
Disadvantages:
Complexity: The sliding window protocol can be complex to implement and can
require a lot of memory and processing power to operate efficiently.
Delay: The protocol can introduce a delay in the transmission of data, as each packet
must be acknowledged before the next packet can be transmitted. This delay can
increase the overall latency of the network.
Limited Bandwidth Utilization: The sliding window protocol may not be able to
utilize the full available bandwidth of the network, particularly in high-speed
networks, due to the overhead of the protocol.
Window Size Limitations: The maximum size of the sliding window can be limited
by the size of the receiver’s buffer or the available network resources, which can
affect the overall performance of the protocol.
Error is a condition when the receiver’s information does not match the sender’s
information. During transmission, digital signals suffer from noise that can introduce
errors in the binary bits traveling from sender to receiver. That means a 0 bit may
change to 1 or a 1 bit may change to 0.
Data (Implemented either at the Data link layer or Transport Layer of the OSI Model)
may get scrambled by noise or get corrupted whenever a message is transmitted. To
prevent such errors, error-detection codes are added as extra data to digital messages.
This helps in detecting any errors that may have occurred during message
transmission.
Types of Errors
Single-Bit Error
A single-bit error refers to a type of data transmission error that occurs when one bit
(i.e., a single binary digit) of a transmitted data unit is altered during transmission,
resulting in an incorrect or corrupted data unit.
Single-Bit Error
Multiple-Bit Error
A multiple-bit error is an error type that arises when more than one bit in a data
transmission is affected. Although multiple-bit errors are relatively rare when
compared to single-bit errors, they can still occur, particularly in high-noise or high-
interference digital environments.
Multiple-Bit Error
Burst Error
When several consecutive bits are flipped mistakenly in digital transmission, it creates
a burst error. This error causes a sequence of consecutive incorrect values.
Burst Error
Two-dimensional 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.
Checksum
Checksum error detection is a method used to identify errors in transmitted data. The
process involves dividing the data into equally sized segments and using a 1’s
complement to calculate the sum of these segments. The calculated sum is then sent
along with the data to the receiver. At the receiver’s end, the same process is repeated
and if all zeroes are obtained in the sum, it means that the data is correct.
Checksum – Operation at Sender’s Side
Firstly, the data is divided into k segments each of m bits.
On 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.
Checksum – Operation at Receiver’s Side
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.
Disadvantages
If one or more bits of a segment are damaged and the corresponding bit or
bits of opposite value in a second segment are also damaged.