Stop-and-Wait Protocol and Stop-and-Wait ARQ
1. Concept of Flow Control and ARQ
Flow Control coordinates the rate of data transmission between a sender and receiver, ensuring that a fast sender does not swamp a slow receiver with more packets than its internal buffer memory can hold.
When flow control is combined with error control (retransmission on error/loss), the mechanism is called Automatic Repeat Request (ARQ).
SENDER RECEIVER
| |
|---------------- Frame 0 -------------------------->| (Buffer stored)
| |
|<--------------- ACK 1 -----------------------------| (Acknowledged)
| |
|---------------- Frame 1 -------------------------->|
| |
|<--------------- ACK 0 -----------------------------|
2. Stop-and-Wait ARQ Mechanism
In Stop-and-Wait ARQ, the sender transmits one single frame and stops all further transmissions, waiting for an acknowledgment (ACK) from the receiver before sending the next frame.
Key Operational Rules:
- 1-Bit Sequence Numbers ( and ):
- Frames are numbered alternately as Frame 0, Frame 1, Frame 0, Frame 1 (, sequence modulo ).
- Distinguishes duplicate retransmitted frames from new frames.
- Acknowledgment Numbers:
- The ACK carries the sequence number of the next expected frame.
ACK 1indicates that Frame 0 was received correctly and the receiver is now waiting for Frame 1.
- Retransmission Timer:
- When the sender transmits a frame, it starts a countdown timer.
- If a valid ACK does not return before the timer expires (Timeout), the sender automatically retransmits the same frame.
3. Error Scenarios Handled by Stop-and-Wait ARQ
Scenario A: Lost Frame Scenario B: Lost ACK Scenario C: Delayed ACK
Sender Receiver Sender Receiver Sender Receiver
| | | | | |
|-- Frame 0 ---->| |-- Frame 0 ---->| |-- Frame 0 ---->|
| X (Lost) | | | (Stored) | |
| (Timer expires)| |<-- ACK 1 - X | (Lost) | (Delayed) |
|-- Frame 0 ---->| | (Timer expires)| | (Timeout) |
| | (Received) |-- Frame 0 ---->| (Duplicate!) |-- Frame 0 ---->|
|<-- ACK 1 ------| | | Discard dup | | Discard dup
| | |<-- ACK 1 ------| Re-send ACK |<-- ACK 1 (old)-|
- Lost Frame: The timer expires at the sender; the sender retransmits the original frame.
- Damaged Frame: The receiver detects a CRC error and discards the frame silently. The sender times out and retransmits.
- Lost ACK: The sender retransmits Frame 0. The receiver receives a duplicate Frame 0, discards the duplicate to prevent duplicate data, and re-sends ACK 1.
- Delayed ACK: If an ACK arrives after timeout, the sequence number prevents the sender from confusing it with the ACK for the retransmitted frame.
4. Performance & Efficiency Analysis
The total time required to successfully transmit one frame and receive its ACK is:
(Where is Transmission Time, is Propagation Delay).
Assuming processing and ACK transmission times are negligible ():
Parameter :
The ratio of propagation delay to transmission delay is defined as:
Efficiency () and Throughput ():
5. Solved Numerical Example
- Problem: A satellite link has a distance of . Signal propagation speed is . The frame size is (). Calculate:
- Transmission time ().
- Propagation delay ().
- Efficiency of Stop-and-Wait protocol.
- Solution:
- .
- .
- .
- Efficiency:
Conclusion: Stop-and-Wait is catastrophically inefficient on links with a large Bandwidth-Delay Product (BDP) because the sender spends of its time idling, waiting for the round-trip acknowledgment. This motivates the need for Sliding Window Protocols (Go-Back-N and Selective Repeat).
6. Key Exam Questions & Takeaways
- Why does Stop-and-Wait ARQ require sequence numbers?
- Without sequence numbers, if an ACK is lost or delayed, the sender will retransmit the frame, and the receiver cannot distinguish whether the newly arrived frame is a retransmission of the previous frame or a completely new frame with identical contents.
- What is the maximum window size in Stop-and-Wait?
- Sender Window Size , Receiver Window Size .
- What is the formula for Stop-and-Wait efficiency in terms of ?
- , where .
- Why is Stop-and-Wait inefficient for satellite links?
- Satellite links have high propagation delay (), making . Since only 1 frame is allowed in transit, the link pipe remains empty almost all the time.