Skip to main content

Sliding Window Protocol

What is Sliding Window Flow Control?

Sliding Window Flow Control is a mechanism that controls the flow of data between a sender and a receiver. It prevents the sender from overwhelming the receiver with too much data at once and ensures that data is transmitted efficiently.


Key Concepts

  1. Window Size:

    • The "window" represents the amount of data (in bytes or packets) that the sender can send before requiring an acknowledgment (ACK) from the receiver.
    • Both the sender and receiver agree on the window size beforehand.
  2. Acknowledgments (ACKs):

    • The receiver sends an acknowledgment to confirm the successful receipt of data.
    • The sender uses these acknowledgments to decide how much more data to send.
  3. Sliding Mechanism:

    • As the receiver acknowledges packets, the sender’s window "slides" forward, allowing it to send additional packets.

How It Works

  1. Initial Transmission:

    • The sender transmits packets up to the window size limit.
    • For example, if the window size is 4 packets, the sender sends packets 1, 2, 3, and 4.
  2. Waiting for Acknowledgments:

    • The sender waits for ACKs from the receiver.
    • If the receiver acknowledges packet 1, the window slides forward, allowing the sender to send packet 5.
  3. Retransmission:

    • If a packet is lost or corrupted, the receiver does not acknowledge it.
    • The sender retransmits the lost packet once it detects the missing acknowledgment.

Types of Sliding Window Protocols

  1. Go-Back-N (GBN):

    • If a packet is lost, the sender retransmits the lost packet and all subsequent packets in the window, even if some were already received correctly.
  2. Selective Repeat (SR):

    • The sender retransmits only the lost or corrupted packets.
    • This method is more efficient but requires the receiver to store out-of-order packets.

Advantages of Sliding Window Protocols

  • Efficiency: Sliding Window allows multiple packets to be in transit simultaneously, maximizing the use of available bandwidth.

  • Error Handling: Mechanisms like Go-Back-N and Selective Repeat ensure reliable communication.

  • Flow Control: Prevents the receiver's buffer from being overwhelmed by regulating the rate of data transfer.

Comments

Popular posts from this blog

Server/Client Communication-python

The basic mechanisms of client-server setup are: A client app send a request to a server app.  The server app returns a reply.  Some of the basic data communications between client and server are: File transfer - sends name and gets a file.  Web page - sends url and gets a page.  Echo - sends a message and gets it back.  Client server communication uses socket.              To connect to another machine, we need a socket connection. What's a connection?  A relationship between two machines, where two pieces of software know about each other. Those two pieces of software know how to communicate with each other. In other words, they know how to send bits to each other. A socket connection means the two machines have information about each other, including network location (IP address) and TCP port. (If we can use anology, IP address is the phone number and the TCP port is the extension).  A so...

Banker's Algorithm

Banker's algorithm is a deadlock avoidance algorithm. It is named so because this algorithm is used in banking systems to determine whether a loan can be granted or not. Consider there are n account holders in a bank and the sum of the money in all of their accounts is S. Everytime a loan has to be granted by the bank, it subtracts the loan amount from the total money the bank has. Then it checks if that difference is greater than S. It is done because, only then, the bank would have enough money even if all the n account holders draw all their money at once. Banker's algorithm works in a similar way in computers. Whenever a new process is created, it must exactly specify the maximum instances of each resource type that it needs. Let us assume that there are n processes and m resource types. Some data structures are used to implement the banker's algorithm. They are: Available: It is an array of length m . It represents the number of available resourc...

Inter Process Communication-Message Queue

Interprocess communication (IPC) is a set of programming interfaces that allow a programmer to coordinate activities among different program processes that can run concurrently in an operating system. This allows a program to handle many user requests at the same time. Since even a single user request may result in multiple processes running in the operating system on the user's behalf, the processes need to communicate with each other. The IPC interfaces make this possible. Each IPC method has its own advantages and limitations so it is not unusual for a single program to use all of the IPC methods . Message Based Communication Messages are a very general form of communication. Messages can be used to send and receive formatted data streams between arbitrary processes. Messages may have types. This helps in message interpretation. The type may specify appropriate permissions for processes. Usually at the receiver end, messages are put in a queue. Messages may also be fo...