You are on page 1of 2

3.

4 – Principles of Reliable Data Transfer


It’s the responsibility of a reliable data transfer protocol to implement the service
abstraction of providing a reliable data transfer.
Which can be hard because the layers bellow it might be unreliable.
We will use the terminology “packet” rather than transport-layer “segment”.
We will only discuss unidirectional data transfer, that is data transfer from the sending to the
receiving side. Not bidirectional data transfer (full-duplex)

3.4.1 – Building a Reliable Data transfer protocol Rdt2.1   


Rdt1.0
The simplest case: the underlying channel is completely reliable.
Separate finite-state machines (FSM) for the sender and receiver
Defines the operation of the sender
Defines the operation of the receiver

The arrows in the FSM description indicate the transition of the protocol from one state
to another. The fixed version of Rdt2.0
The event causing the transition is shown above the horizontal line labeling the Twice as many states as this protocol state must reflect whether the packet currently
transition, and the actions taken when the event occurs are shown below the horizontal being sent or expected should have a sequence number of 0 or 1.
line. Uses both positive and negative acknowledgements from the receiver to the sender.
When no action is taken on an event, or no event occurs and an actions is taken, well When an out-of-order packet is received, the receiver send a positive acknowledgment
use the symbol below or above the horizontal, repectively, to explicitly denote the lack of for the packet it has received. When a corrupt packet is received, the receiver send a
an action or even. The initial state of the FSM is indicated by the dashed arrow. negative acknowledgment.
The sender side:
Accepts data from the upper layer via the function rdt_send(data)
Via make_pkt(data) that creates a packet containing the data via the function
The receiving side:
Receives a packet from the underlying channel via the function rdt_rcv(packet)
Removes the data vi Extract(packet, data)
Passes the data up to the upper layer via the function deliver_data(data)
Because the channel is perfectly reliable there is no need for the receiver side to provide
any feedback to the sender since nothing can go wrong.

Rdt2.2 

We can accomplish the same effect as NAK if, instead of sending NAK, we send an ACK
for the last correctly received packet.
We want the sender to be allowed to send multiple packets without waiting for Timers are again used to protect against lost packets. However each packet must
acknowledgments. This is known as pipelining: now have its own logical timer, sine only a single packet will be transmitted on
The range of sequence numbers must be increased, since each in-transit packet must timeout.
have a unique sequence number and there may be multiple, in-transit, unacknowledged ACK received:
packets. If an ACK is received then the SR will mark it as received (if its in the window). If the
The sender and the receiver sides of the protocols may have a buffer more than one sequence number is equal to send_base then the window base will move forward to
packet. Minimally, the sender will have to buffer packets that have been transmitted but the next unacknowledged packet. If it moves into a range with an untransmitted
not yet acknowledged. Buffering of correctly received packets may also be needed at packet it will send it.
the receiver, as discussed bellow. SR receiver events and actions:
The range of sequence numbers needed and the buffering requirements will depend on Packet with sequence number in [rcv_base, rcv_base+N-1] is correctly received:
the manner in which a data transfer protocol responds to lost, corrupted, and overly It falls under the window and an ACK is sent back. If the packet wasn’t previously
delayed packets. Two basic approaches toward pipelined error recovery can be received it will get buffered. If the sequence number was equal to the base of the
identified: Go-Back-N and selective repeat receive window then this packet and any previously buffered and consecutively
number packets are delivered to the upper system. The window is then moved
forward by the number of packets sent to the upper system.
3.4.3 – Go-Back-N (GBN) Packet with sequence number in [rcv_base-N, rcv_base-1] ] is correctly received:
An ACK must be generated even though this is a packet that the receiver has
The sender is allowed to transmit multiple packets without waiting for an acknowledgment, previously acknowledged.
but its constrained to have no more than some maximum allowable number, N, of Otherwise:
unacknowledged packets in the pipeline. Ignore the packet
We define base to be the sequence number of the oldest unacknowledged packet It is important that the sender sends ACKs to duplicate packets because if there is no ACK
and nextseqnum to be the smallest unused sequence number, then four intervals in the for packet send_base propagation from the receiver to the sender, the sender will eventually
range of sequence numbers can be identified. retransmit packet send_base, even though it is clear that the receiver has already received
Sequence numbers in the interval [0,base-1] corresponds to packets that have already it. If the receiver were not to acknowledge this packet, the sender’s windows would never
been transmitted and acknowledged. move forward.
The interval [base,nextseqnum-1] corresponds to packets that have been sent but not This is important because the sender and receiver window will not always coincide.
yet acknowledged . The lack of synchronization between the sender and receiver window has important
Sequence numbers in the interval [nextseqnum, base+N-1] can be used for packets that consequences:
can be sent immediately, should data arrive from the upper layer. Suppose the window is size is 3.
Sequence numbers greater than or equal to Base+N cannot be used until an Lets say packet 0-2 are received by the receiver, the window is now on the 4th, 5th and
unacknowledged packet currently in the pipeline has been acknowledged. 6th packet with the sequence numbers 3, 0, 1
This range of permissible sequence numbers for transmitted but not yet acknowledged Scenario 1:
packets can be viewed as a window of size N (window size/sliding-window size) The ACKs for first three packets are lost and the sender retransmits these packets.
As the protocol operates this window slides forward over the sequence number space. The receiver thus next receives a packet with sequence number 0, a copy of the
The reason we have a limit is because of flow control(TCP congestion control) first packet sent.
A packet’s sequence number is carried in a fixed-length field in the packet header Scenario 2:
If K is the number of bits in the packet sequence number field the range of sequence The ACKs for the first three packets are all delivered correctly. The sender thus
number is thus $$[0.2^k-1]$$ moves its window forward and sends the fourth, fifth and sixth packets, witch
With a finite range of sequence numbers, all arithmetic involving sequence numbers sequence number 3, 0, 1 respectively. The packet with sequence number 3 is lost,
must then be done using modulo $$2^k$$ arithmetic. but the packet with sequence number 0 arrives, a packet containing new data.
We refer to an FSM where the sender and receiver side are ACK-based, NAK-free, GBN These two scenarios are identical for the receiver. There’s no way to distinguish the
protocol as an extended FSM because we have added variables transmission of the first packet from an original transmission of the fifth packet.
for base and nextseqnum and added operations of these variables and conditional actions That is why the window size must be less than or equal to half the size of the
involving these variables. sequence numberspace for SR protocols.
The GBN sender must respond to three types of events: We assumed that packets cannot be reordered within the channel between the sender and
Invocation from above receiver. However it can happen when the channel is a network and not physical cables.
When rdt_send() is called from above, the sender first checks to see if the window is One manifestation of packet reordering is that old copies of a packet with a sequence or
full. acknowledgment number of x can appear, even though neither the sender’s nor the
If it isn’t full then a packet is created and send, and variables are appropriately receiver’s window contains x.
updated. A channel can be thought of as essentially buffering packets and spontaneously emitting
If it full then the sender simply returns the data back to the upper layer, an implicit these packet at any point in time. Which is a problem as sequence numbers may be
indication that the window is full reused.

You might also like