“Go-Back-N Protocol and “Selective Repeat Protocol” are the sliding window protocols. The sliding window protocol is primarily an error control protocol, i.e. it is a method of error detection and error correction.
The basic difference between go-back-n protocol and selective repeat protocol is that the “go-back-n protocol” retransmits all the frames that lie after the frame which is damaged or lost. The “selective repeat protocol” retransmits only that frame which is damaged or lost.
Content: Go-Back-N Vs Selective Repeat
|Basis for Comparison||Go-Back-N||Selective Repeat|
|Basic||Retransmits all the frames that sent after the frame which suspects to be damaged or lost.||Retransmits only those frames that are suspected to lost or damaged.|
|Bandwidth Utilization||If error rate is high, it wastes a lot of bandwidth.||Comparatively less bandwidth is wasted in retransmitting.|
|Complexity||Less complicated.||More complex as it require to apply extra logic and sorting and storage, at sender and receiver.|
|Window size||N-1||<= (N+1)/2|
|Sorting||Sorting is neither required at sender side nor at receiver side.||Receiver must be able to sort as it has to maintain the sequence of the frames.|
|Storing||Receiver do not store the frames received after the damaged frame until the damaged frame is retransmitted.||Receiver stores the frames received after the damaged frame in the buffer until the damaged frame is replaced.|
|Searching||No searching of frame is required neither on sender side nor on receiver||The sender must be able to search and select only the requested frame.|
|ACK Numbers||NAK number refer to the next expected frame number.||NAK number refer to the frame lost.|
|Use||It more often used.||It is less in practice because of its complexity.
Definition of Go-Back-N
Go-Back-N protocol is a sliding window protocol. It is a mechanism to detect and control the error in datalink layer. During transmission of frames between sender and receiver, if a frame is damaged, lost, or an acknowledgement is lost then the action performed by sender and receiver is explained in the following content.
If a receiver receives a damaged frame or if an error occurs while receiving a frame then, the receiver sends the NAK ( negative acknowledgement) for that frame along with that frame number, that it expects to be retransmitted. After sending NAK, the receiver discards all the frames that it receives, after a damaged frame.
The receiver does not send any ACK (acknowledgement) for the discarded frames. After the sender receives the NAK for the damaged frame, it retransmits all the frames onwards the frame number referred by NAK.
The receiver checks the number on each frame, it receives. If a frame number is skipped in a sequence, then the receiver easily detects the loss of a frame as the newly received frame is received out of sequence. The receiver sends the NAK for the lost frame and then the receiver discards all the frames received after a lost frame.
The receiver does not send any ACK (acknowledgement) for that discarded frames. After the sender receives the NAK for the lost frame, it retransmits the lost frame referred by NAK and also retransmits all the frames which it has sent after the lost frame.
If the sender does not receive any ACK or if the ACK is lost or damaged in between the transmission. The sender waits for the time to run out and as the time run-outs, the sender retransmits all the frames for which it has not received the ACK. The sender identifies the loss of ACK with the help of a timer.
The ACK number, like NAK (negative acknowledgement) number, shows the number of the frame, that receiver expects to be the next in sequence. The window size of the receiver is 1 as the data link layer only require the frame which it has to send next to the network layer. The sender window size is equal to ‘w’. If the error rate is high, a lot of bandwidth is lost wasted.
Definition of Selective Repeat
Selective repeat is also the sliding window protocol which detects or corrects the error occurred in the datalink layer. The selective repeat protocol retransmits only that frame which is damaged or lost. In selective repeat protocol, the retransmitted framed is received out of sequence. The selective repeat protocol can perform the following actions
- The receiver is capable of sorting the frame in a proper sequence, as it receives the retransmitted frame whose sequence is out of order of the receiving frame.
- The sender must be capable of searching the frame for which the NAK has been received.
- The receiver must contain the buffer to store all the previously received frame on hold till the retransmitted frame is sorted and placed in a proper sequence.
- The ACK number, like NAK number, refers to the frame which is lost or damaged.
- It requires the less window size as compared to go-back-n protocol.
If a receiver receives a damaged frame, it sends the NAK for the frame in which error or damage is detected. The NAK number, like in go-back-n also indicates the acknowledgement of the previously received frames and error in the current frame.
The receiver keeps receiving the new frames while waiting for the damaged frame to be replaced. The frames that are received after the damaged frame are not be acknowledged until the damaged frame has been replaced.
As in a selective repeat protocol, a frame can be received out of order and further they are sorted to maintain a proper sequence of the frames. While sorting, if a frame number is skipped, the receiver recognizes that a frame is lost and it sends NAK for that frame to the sender.
After receiving NAK for the lost frame the sender searches that frame in its window and retransmits that frame. If the last transmitted frame is lost then the receiver does not respond and this silence is a negative acknowledgement for the sender.
If the sender does not receive any ACK or the ACK is lost or damaged in between the transmission. The sender waits for the time to run out and as the time run-outs, the sender retransmits all the frames for which it has not received the ACK. The sender identifies the loss of ACK with the help of a timer.
Key Differences Between Go-Back-N and Selective Repeat
- Go-Back-N protocol is design to retransmit all the frames that are arrived after the damaged or a lost frame. On the other hand, Selective Repeat protocol retransmits only that frame that is damaged or lost.
- If the error rate is high i.e. more frames are being damaged and then retransmitting all the frames that arrived after a damaged frame waste the lots of bandwidth. On the other hand, selective repeat protocol re-transmits only damaged frame hence, minimum bandwidth is wasted.
- All the frames after the damaged frame are discarded and the retransmitted frames arrive in a sequence from a damaged frame onwards, so, there is less headache of sorting the frames hence it is less complex. On the other hand, only damaged or suspected frame is retransmitted so, extra logic has to be applied for sorting hence, it is more complicated.
- Go-Back-N has a window size of N-1 and selective repeat have a window size <=(N+1)/2.
- Neither sender nor receiver needs the sorting algorithm in Go-Back-N whereas, the receiver must be able to sort the as it has to maintain the sequence.
- In Go-Back-N receiver discards all the frames after the damaged frame hence, it doesn’t need to store any frames. Selective repeat protocol does not discard the frames arrived after the damaged frame instead it stores those frames till the damaged frame arrives successfully and is sorted in a proper sequence.
- In selective repeat, NAK frame refers to the damaged frame number and in Go-Back-N, NAK frame refers to the next frame expected.
- Generally, the Go-Back-N is more in use due to its less complex nature instead of Selective Repeat protocol.
The selective repeat is a more efficient protocol as it does not waste bandwidth for the frames which are properly received but, its complexity and expense favours the use of the go-back-n protocol.