Skip to main content

Computer Network | Flow control Methods: Stop and Wait

Some times sending data packets at higher rate to a less efficient receiver may cause for the discarding of data from the buffer and lead to data loss. Flow control methods are used to avoid this dilemma.

Stop and Wait

When the data packet from the sender reaches at the receiver it returns a success message and once the sender acknowledges the success return it will go for the the next one. This sequence of protocols are know as stop and wait method of flow control.

In theoretical questions Tq and Tprocess usually approximates as zero. Generally Transmission delay for the acknowledgement will be negligibly small (about 10-3 times) compared to transmission delay for the data,which may also can approximate to zero.

Piggybacking is a concept where data is send along with acknowledgment and other control information during bidirectional communication. So in Piggybacking acknowledgement time will become equal to that of propagation transmission time.

Cases where Tacknowledgement, Tq and Tprocess is approximated as zero, total time can be written as

Ttotal = Tt- data + 2 *Tpropagation

A better control method makes efficient communication. Here, as propagation delay become larger, the sender have to wait much longer to send next packet of data, which leads to a inefficient communication.

Efficiency η = useful time/ total cycle time

η = TtTtotal time = Tt (Tt+ 2 Tp) = 1(1+ 2 (TpTt))= 1(1+ 2a) [ a = TpTt ]

In networking throughput is the amount of bits a system is able to send in seconds.

Throughput = L(Ttotal) =(L/BW)*BW(Ttotal) = (Tt-data) * BW(Ttotal)=η* BW

Some times throughput is also called effective bandwidth or bandwidth utilization

  • The efficiency will decrease with increase in distance between sender and receiver, so stop and wait flow control method is better with LAN and less efficient for WAN.
  • As the size of data packet increases the efficiency of stop and wait flow control method becomes high, so its is better for larger packets of data.

Failures and solutions of stop and wait

The protocols of wait and stop flow control methods defined as, after sending a data packet to receiver, the sender has to wait until the acknowledgement is get back to the sender from the receiver as described above.

Case 1: Data missing

By any cause if the "data" get missed in between sender and receiver, the receiver will wait for the data and sender will wait for the acknowledgement and both of them will get into a deadlock.

To avoid the deadlock usually will go with a "time out timer", so that if the acknowledgement did not receive with in specified time out time the device will consider it as data loss and continue with next packet. This method with addition of timer is known as S&W with ARQ (stop and wait with automatic request).

Case 2: Duplicate packet problem

Suppose the data send by sender is received and receiver and it had replied with acknowledgement, but but what if during the propagation the acknowledgement it get lost?, sender will continue to send same data after specific duration declared on time out timer and it causes for the duplication of data multiple times at the receiver. This scenario is called "duplicated packet problem".

Addition of unique sequence number to the data packets, makes each packets distinguishable for receiver, hence the duplication can be eliminated.

Case 2: Delayed acknowledgement

Suppose sender had send a packet of data D1 and by some reason its acknowledgement A2 got delayed , by the way 'time out timer' triggered the resenting of same data packet (say D1') second time and you got its acknowledgement A2'. Acknowledging of A2' turned to sending of next packet of data D2 and before reaching its real acknowledgment A3 if delayed acknowledgment A2 reaches at the the sender it may misunderstand A2 as A3 and may go for sending of next packet.

In order to remove this issue, with each acknowledgment has to be named with sequential id numbers, so that it is differentiable to the sender.

So Along with Stop and wait algorithm if we use time out timer, sequential ID for data and acknowledgment all of communication problems can be resolved.

Comments

Popular posts from this blog

Operating Systems | Scheduling Algorithms : Round Robin

Round Robin Features : Most popular algorithm of all Practically implementable Implementable with basic data structures like queue Extremely lesser starvation Optimum efficiency can be set by controlling time quantum The round robin algorithm will continuously switch between processes if a process in CPU (under execution) exceeds a time limit set by OS called time quantum . Flow Chart : Scheduler allocated process to for execution. CPU starts monitoring the execution time right after from allocation. If the process completes its execution before exceeding time quantum, OS forwards the process to termination state. else, the processes gets preempted once the time quantum limit exceeded and if the process finished at this moment, OS moves the process to termination state, else it moves to ready queue and iterates over the whole process listed above. Example : Consider the following table of processes and calculate completion time, turn around time and waiting tim

Operating Systems | Concept of shared memory and critical section

While printing your document opened in Adobe Acrobat Reader, if you gave a same command for document opened in Microsoft Word! How will it be? These are the real time situations where two processes competing together for same resources due to improper process synchronization. An unstructured access approval to these resources may lead to a abnormal output or a breach in information security or even it may cause for data loss. In the above case which might be a bunch of over-written papers coming out of the printer connected to that system. Shared Memory and Critical Section Resources or memory spaces where different processes have access to read, write or update at same time are known as shared memory . And the piece of program which tries to access the shared memory is known as Critical Section . There are situations where an operating system need to handle multiple request from critical sections of various processes in a machine , in order to maintain da

Operating Systems | Lock Variable Synchronization Mechanism

To learn lock variable synchronization mechanism, you have to understand different modes of execution of instructions in an operating system. Basically there are two modes of execution in a system, User Mode and Kernel Mode. The unrestricted access to any resources in the system, for executing instructions in Kernel Mode makes resources available only for most trusted basic level functions of operating system . Direct access of hardware or memory references are not allowed in User Mode , due security concerns over higher level applications. System APIs provide a path way to reference these resources. Features of Lock Variable A software logic implemented in User Mode. A Busy waiting method of synchronization. Multiple processes can be handled by single mechanism. There are two basic section for every synchronization method, which decides the nature of that algorithm, Entry and Exit sections. Arranged as shown. Here in lo