 Hello and welcome to the session on one bit sliding window protocol. At the end of the session, student will be able to describe working of a one bit sliding window protocol. The bidirectional protocols that belong to a class called sliding window protocols are one bit sliding window protocol, go back and sliding window protocol, selective repeat sliding window protocol. Three bidirectional sliding window protocols with maximum sending window size and receiving window size are one bit sliding window protocol has sending window size of one and receiving window size is also one, go back and protocol has sending window size greater than one and receiving window size is one. Selective repeat protocol has sending window size greater than one and receiving window size is also greater than one. These protocols differ among themselves in terms of efficiency, complexity and buffer requirements. Before going further pause the video for some time and find the answer. Once you have done this, you may resume the video. What is the maximum sending window size and receiving window size of a one bit sliding window protocol? Option A. Sending window size greater than one. Receiving window size is equal to one. Option B. Sending window size greater than one. Receiving window size greater than one. Option C. Sending window size is equal to one. Receiving window size is equal to one. Option D. None of these. The answer is sending window size is equal to one and receiving window size is equal to one. Let us see a sliding window protocol with a window size of one. That is one bit sliding window protocol. It is also called as stop and wait protocol since the sender transmits a frame and waits for its acknowledgement before sending the next one. With this protocol the communication is full-duplex that is both machines can send and receive. Problem with stop and wait protocol is that at any moment only one frame is in transition. The sender will have to wait at least one round trip time before sending the next frame. The waiting can be long for a slow network such as satellite link. The last frame to send and frame expected can be either 0 or 1. The acknowledgement field contains the number of the last frame received without error. The protocol uses independent acknowledgement for each frame received. The protocol discards out-of-order frames. A difficult situation arises if both sides simultaneously send an initial packet. This synchronization difficulty is illustrated by figure one. In part A, the normal operation of the protocol is shown. In part B, the difficulty is illustrated. If B waits for A's first frame before sending one of its own, the sequence is as shown in figure A and every frame is accepted. However, if A and B simultaneously initiate communication, their first frames cross and the data link layer then gets into situation shown in figure B. The notation for sending frames is sequence number ACK that is acknowledgement and packet number. Consider an example, A sends 1, 0, A1. Here 1 is the sequence number, 0 is the acknowledgement for frame with sequence number 0, A1 is the packet number. An asterisk indicates a network layer accepts a packet. In figure A, each frame arrival brings a new packet for the network layer. There are no duplicates. In figure B, half of the frames contain duplicates, even though there are no transmission errors. Similar situation can occur as a result of premature timeouts, even when one side clearly starts first. In fact, if multiple premature timeouts occur, frames may be sent three or more times, wasting valuable bandwidth. Figure 2A, case 1, shows the normal operation of the protocol. Figure 2B, case 2, shows the situation if data frame gets lost. The problem here is what if a frame gets lost? The protocol retransmits the frame after timeout. As shown in case 2, after sending a frame, sender starts a timer. If the frame gets lost and transit, the sender will not get the acknowledgement. So after the timeout, frame is retransmitted. Figure 2C, case 3, shows the situation where received frame is with error. As shown in case 3, after sending a frame, sender starts a timer. The receiver recomputes the checksum after receiving the frame. If the frame is erroneous, the receiver will not send the acknowledgement. So after the timeout, sender retransmits the frame. Figure 2D, case 4, shows the situation if acknowledgement gets lost. Here the sender will re-send the frame after timeout. After sending a frame, sender starts a timer. If the receiver gets a frame without error, it sends an acknowledgement. But if the acknowledgement gets lost and transit, the sender will retransmit the frame after the timeout. It creates duplicates at the receiver. Receiver will discard the duplicates. Figure 2E, shows case 5 with early timeout. Suppose a receiver sends an acknowledgement, but if the sender doesn't get the acknowledgement within the timeout period, the sender will retransmit the frame which will create duplicates at the receiver. Receiver will discard the duplicate. Early timeout will cause a loss of bandwidth. Figure 2F, shows case 6. Here data link layer weights a fixed number of milliseconds for a packet from network layer, on which to piggyback the acknowledgement. If a new packet arrives quickly, the acknowledgement is piggybacked onto it. Otherwise, if no new packet has arrived by the end of the time period, the data link layer just sends a separate acknowledgement frame, as shown in figure 2F. Let us see the working of one bit sliding window protocol. Here next frame to send is a sequence number. Frame expected is also a sequence number. These two can be either 0 or 1. R and S are the variables of type frame. Buffer is the variable of type packet. Event is of type event type. Initially the next frame to send and frame expected are initialized to 0. From network layer buffer, here we are fetching the packet from the network layer. And we are creating a frame out of the packet. So S.info equal to buffer, S.sequence number equal to next frame to send that is 0 initially. S.ack equal to 1 minus frame expected. So in this case 1 minus 0 is 1. Now the frame is constructed here. So the constructed frame is sent to the physical layer and sender starts a timer with sequence number. Here the machine is waiting for an event. The event can be either frame arrival, checksum, error or timeout. If the event is frame arrival means the frame has arrived from the other machine, we have to accept it from the physical layer. So from physical layer we are receiving the frame. S.sequence number equal to equal to frame expected. So here if the frame which is received is the expected frame then that frame will be sent to the network layer. So to network layer r.info, here we are sending the frame to the network layer. And here we are inverting the frame expected. Because frame expected can be either 0 or 1. Sender keeps all the frames which are sent in the buffer till the acknowledgement is received because the frame may get lost while transit. So if the next frame is already sent frame and acknowledgement for that frame is received then the sender can get the next frame from the network layer and it can construct the frame and it can send it to the physical layer. So here if the acknowledgement for the frame is received then the sender stops the timer, it gets the new frame from the network layer, it increments or it inverts the next frame to send. It constructs the frame so s.info equal to buffer, s.sequence number equal to next frame to send and s.ack equal to 1 minus frame expected. The frame is constricted and it is sent to the physical layer and the sender starts the timer. Here we will see the advantages and disadvantages of one bit sliding window protocol. Advantages are it is very simple and easy to implement. The disadvantages are it is fairly slow. The sender can send at most one new packet per RTT, RTT is round trip time and inefficient utilization of bandwidth it is done in one bit sliding window protocol. In this video we have seen the working of one bit sliding window protocol. Thank you.