1. Home
cyber security

Learn Cyber Security Tutorial Concepts - From Beginner to Pro

Explore essential cyber security tutorials to safeguard your digital assets and protect data.

  • 28 Lessons
  • 5 Hours
right-top-arrow
6

Go-Back-N ARQ

Updated on 23/08/2024470 Views

Flow control protocols play an important role in ensuring smooth and efficient data transmission over computer networks. Go Back N ARQ (Automatic Repeat Request) is a type of protocol that does exactly this.

However, as its name suggests, it offers this additional core mechanism: when a frame is lost or corrupted, the sender "goes back" to the start of the unacknowledged frame and retransmits the entire window of 'N' frames.

For instance, let us consider a window size of 4. The sender transmits frames 1, 2, 3, and 4. If frame 3 is lost, the receiver won't send an ACK for frame 3 or later frames. The sender, upon timeout, will retransmit frames 3, 4, and onwards.

This is extremely useful for us network engineers in terms of ensuring reliable data transmission. I believe that as a network engineer or a cyber security professional, knowing about ARQ control protocols such as the Go Back N ARQ and Selective Repeat ARQ is essential. Let’s learn more about the Go Back N ARQ protocol.

What are Flow Control Protocols?

Imagine we are downloading a large file from the internet. Without flow control protocols, we might experience lags or interruptions as our device struggles to handle the incoming data stream. According to me, these protocols act like traffic coordinators, regulating the data flow between sending and receiving devices to prevent data overload.

In essence, they establish a communication channel between the sender and receiver, where the receiver can signal the sender to adjust the transmission rate based on its processing capacity. This ensures that data is delivered efficiently and avoids overwhelming the receiver with excessive data packets

Why are Flow Control Protocols Important?

Data transmission can be like a highway, sometimes congested, sometimes clear. Flow control protocols prevent gridlock on the data highway. Without them, receivers could be bombarded with more data than they can handle, leading to errors and delays. These protocols ensure smooth, efficient data exchange.

What is Go Back N ARQ Protocol in Computer Networks?

Go Back N ARQ in computer networks is a type of sliding window protocol used for reliable data transmission in computer networks. It ensures that data packets are delivered in the correct order and without errors. 

What are sliding window protocols? Sliding window protocols are a more advanced error correction technique that improves efficiency over Stop-and-Wait ARQ. They permit the transmission of multiple frames within a window before waiting for acknowledgments. This approach significantly enhances bandwidth utilization.

Sliding window protocols introduce the concept of a window, a buffer that holds a specific number of frames the sender can transmit before waiting for ACKs. The window size determines how many frames can be outstanding at a time.

Note: I believe that knowing about Stop-and-Wait ARQ is essential for understanding Go Back N ARQ. Stop-and-Wait ARQ (Automatic Repeat Request) is a basic error correction protocol employed in data transmission. It operates by transmitting a single frame at a time and waiting for an acknowledgment (ACK) from the receiver before sending the next frame. This approach ensures reliable data delivery but can be inefficient for high-bandwidth channels.

Before I explain Go Back N ARQ protocol, let us quckly check out the essential components of this protocol:

Frames and Packets

Data is broken down into smaller units called frames for transmission over a network. Each frame consists of data and control information, such as sequence numbers for error detection. Packets are groups of frames encapsulated together for physical transmission on a network.

Window Sizes (Sender Window and Receiver Window)

  • Sender window: This is a buffer at the sender's side that holds a specific number (N) of frames that can be transmitted before waiting for acknowledgments (ACKs) from the receiver.
  • Receiver window: This is a buffer at the receiver's side that can hold a specific number of frames. It ensures the receiver is not overwhelmed with data and can process frames in the correct order.

How Go Back N ARQ Works

In Go Back N ARQ, the sender window size (N) is typically larger than the receiver window size (which is usually 1). This allows the sender to transmit multiple frames continuously without waiting for an ACK after each frame.

Let us learn step-by-step how Go Back N ARQ works:

  • The sender transmits a window of N frames.
  • The sender keeps track of the transmitted frames using sequence numbers.
  • The receiver acknowledges (ACKs) received frames.
  • If an ACK is not received within a timeout period, the sender assumes a frame is corrupt and retransmits the entire window starting from the unacknowledged frame (the one that timed out).
  • The receiver discards duplicate frames (those received after a timeout and retransmission).

Go Back N ARQ employs a mechanism (retransmission mechanism) to handle corrupted or lost frames. Here's how it works:

  • The sender transmits a window of N frames.
  • The receiver acknowledges (ACKs) received frames.
  • If the sender doesn't receive an ACK for a frame within a timeout period, it times out and retransmits the entire window starting from the timed-out frame. This is because Go Back N ARQ assumes that subsequent frames in the window might also be corrupt due to the error.

However, according to me, this retransmission approach can be inefficient, as even if only one frame is corrupt, all subsequent frames in the window are resent. This is a trade-off for simplicity in Go Back N ARQ.

Here is a Go Back N ARQ diagram to help you understand better:

You can enroll in the Master of Science in Computer Science program (with cybersecurity specialization) by upGrad and Liverpool John Moores University to learn all about network security and network engineering.

Advantages of Go Back N ARQ

Here are the advantages of Go Back N ARQ:

  • Simple to implement: The protocol's logic is relatively straightforward, making it easier to implement compared to more complex ARQ variations.
  • Effective error control: It provides reliable data transmission by ensuring that all frames are received in order and without errors.
  • Pipelining: By allowing multiple frames to be in transit at once, Go Back N improves transmission efficiency over simpler Stop-and-Wait protocols.

Disadvantages of Go Back N ARQ

Now, here are the disadvantages of Go Back N ARQ:

  • Inefficient retransmissions: If only a single frame is lost or corrupted, the entire window must be retransmitted, leading to unnecessary bandwidth usage.
  • Potential for duplicates: The receiver needs to handle duplicate frames, as retransmissions might introduce them into the stream.
  • Susceptible to channel noise: Noisy channels with a high error rate can significantly reduce Go Back N ARQ's performance due to frequent retransmissions.

Real-World Applications of Go Back N ARQ

Despite its limitations, Go Back N ARQ finds applications in scenarios where:

  • Simplicity is prioritized: Settings where ease of implementation is favored over maximum efficiency can benefit from Go Back N.
  • Reliable transmission is essential: Applications requiring guaranteed data delivery in reliable connections may use Go Back N's error-correction mechanisms.
  • Channels have moderate noise: Go Back N can function adequately in environments where the error rate isn't excessively high.

Note: In high-bandwidth, very noisy channels, I would say that more sophisticated ARQ protocols like Selective Repeat ARQ often provide better performance.

Go Back N ARQ Code in C

Here is a conceptual outline and key snippets of C code to demonstrate core Go Back N ARQ concepts.

1. Structures

  • Frame: A structure to represent a data frame:

Code:

typedef struct {

    int seq_no;      // Sequence number

    char data[DATA_SIZE]; // Payload

} Frame;

2. Sender Functions

Syntax:

  • send_frame(Frame frame): Transmits the frame over the simulated network channel.
  • wait_for_ack(int seq_no): Waits for an acknowledgment with a timeout mechanism.
  • send_window(Frame buffer[], int start_seq, int window_size): Transmits a window of frames starting from a specific sequence number.

3. Receiver Functions

Syntax:

  • receive_frame(): Receives a frame from the simulated network channel.
  • send_ack(int seq_no): Sends an acknowledgment for the specified frame.

4. Main Logic

  • Sender

Code:

int base = 0;  // Base of the sender window

int nextseqnum = 0; // Next available sequence number.

while (more_frames_to_send) {

    // Check if window is full

    if (nextseqnum < base + window_size) {

        Frame frame = create_frame(nextseqnum);

        send_frame(frame);

        nextseqnum++; 

    }

    // Handle acknowledgments and timeouts

    int ack_received = wait_for_ack(base);

    if (ack_received >= base) {

        base = ack_received + 1; // Slide window forward 

    } else { 

        // Timeout occurred - retransmit window

        send_window(frame_buffer, base, window_size);

    }

}

  • Receiver

Code:

int expected_seqnum = 0;

while (true) {

    Frame frame = receive_frame();

    if (frame.seq_no == expected_seqnum) {

        // Process the frame

        send_ack(expected_seqnum);

        expected_seqnum++;

    } else {

        // Duplicate or out-of-order, discard

    }

}

Important Considerations

A full, working implementation will be significantly more complex to handle network simulations, error handling, buffer management, and edge cases. Here are some important considerations:

  • Network simulation: You'll need to implement ways to simulate packet loss and delay.
  • Error handling: Incorporate error-checking and handling mechanisms.
  • Timers: Implement timeout mechanisms in the wait_for_ack() function.

Wrapping Up

According to me, Go Back N ARQ offers a trade-off between simplicity and efficiency in error correction for data transmission. Its sliding window mechanism improves upon the basic Stop-and-Wait ARQ protocol, enhancing data flow. However, we know that its approach of retransmitting the entire window upon errors can lead to unnecessary overhead in certain network conditions.

I believe that for high-performance or very noisy networks, Selective Repeat ARQ often provides a more optimized solution. Understanding the strengths and limitations of Go Back N ARQ, alongside other flow control protocols, is crucial when designing reliable network communication systems.

You can enroll in upGrad’s Advanced Certificate Program in Cyber Security to learn advanced network security and network engineering concepts.

Frequently Asked Questions

What is the formula for Go Back N?

There's no single formula, but the key concept is the window size (N). Sender's window size <= Receiver's window size + 1 (to ensure frames aren't mistaken for duplicates).

What is Go Back and ARQ protocol for error-free channels?

Even error-free channels need ARQ because data can still be corrupted, not just lost. ARQ provides reliability.

Why is ARQ used?

ARQ is used to ensure error-free data transmission over unreliable channels where packets might be lost or corrupted.

What are the applications of Go Back N ARQ?

Go Back N ARQ is suitable for applications where simplicity is valued over maximum efficiency, and where the network has moderate error rates.

What is ARQ and its types?

ARQ (Automatic Repeat Request) is a protocol for error control in data transmission. The main types include Stop-and-Wait ARQ, Go Back N ARQ, and Selective Repeat ARQ.

What is the difference between selective repeat and Go Back ARQ?

Go Back N retransmits the entire window upon error, while Selective Repeat retransmits only the lost or corrupted frame, leading to higher efficiency in high-error channels.

What are the advantages of Go Back N ARQ?

Simple implementation, effective error control, and pipelining for improved transmission efficiency.

What are the disadvantages of Go Back N ARQ?

Inefficient retransmissions (whole window), potential for duplicate frames, and susceptibility to high noise on the channel.

What are the features of the Go Back N ARQ mechanism?

Sliding windows, cumulative acknowledgments, and retransmission of the entire window starting from the point of error.

What are the three types of ARQ?

Stop-and-Wait ARQ, Go Back N ARQ, and Selective Repeat ARQ.

image

mukesh

Working with upGrad as a Senior Engineering Manager with more than 10+ years of experience in Software Development and Product Management.

Get Free Career Counselling
form image
+91
*
By clicking, I accept theT&Cand
Privacy Policy
image
Join 10M+ Learners & Transform Your Career
Learn on a personalised AI-powered platform that offers best-in-class content, live sessions & mentorship from leading industry experts.
right-top-arrowleft-top-arrow

upGrad Learner Support

Talk to our experts. We’re available 24/7.

text

Indian Nationals

1800 210 2020

text

Foreign Nationals

+918045604032

Disclaimer

upGrad does not grant credit; credits are granted, accepted or transferred at the sole discretion of the relevant educational institution offering the diploma or degree. We advise you to enquire further regarding the suitability of this program for your academic, professional requirements and job prospects before enr...