What Is The Purpose Of The Tcp Sliding Window?
A sliding window protocol is a characteristic of parcel-based data transmission protocols. Sliding window protocols are used where reliable in-order delivery of packets is required, such as in the data link layer (OSI layer 2) as well as in the Transmission Command Protocol (TCP). They are also used to improve efficiency when the channel may include high latency.
Packet-based systems are based on the idea of sending a batch of data, the package, along with additional information that allows the receiver to ensure information technology was received correctly, perhaps a checksum. The paradigm is like to a window sliding sideways to allow entry of fresh packets and reject the ones that accept already been acknowledged. When the receiver verifies the data, information technology sends an acquittance signal, or "ACK", dorsum to the sender to indicate it can send the next packet. In a uncomplicated automated repeat request protocol (ARQ), the sender stops later on every packet and waits for the receiver to ACK. This ensures packets arrive in the right order, equally simply 1 may be sent at a time.
The time that it takes for the ACK signal to be received may correspond a meaning amount of time compared to the time needed to ship the package. In this case, the overall throughput may be much lower than theoretically possible. To address this, sliding window protocols allow a selected number of packets, the window, to be sent without having to wait for an ACK. Each packet receives a sequence number, and the ACKs send dorsum that number. The protocol keeps track of which packets have been ACKed, and when they are received, sends more packets. In this way, the window slides forth the stream of packets making up the transfer.
Sliding windows are a key part of many protocols. It is a key part of the TCP protocol, which inherently allows packets to get in out of order, and is likewise establish in many file transfer protocols similar UUCP-g and ZMODEM equally a way of improving efficiency compared to non-windowed protocols like XMODEM. Meet as well SEAlink.
Bones concept [edit]
Conceptually, each portion of the transmission (packets in most data link layers, but bytes in TCP) is assigned a unique consecutive sequence number, and the receiver uses the numbers to place received packets in the right order, discarding duplicate packets and identifying missing ones. The problem with this is that there is no limit on the size of the sequence number that tin be required.
By placing limits on the number of packets that can be transmitted or received at any given fourth dimension, a sliding window protocol allows an unlimited number of packets to exist communicated using fixed-size sequence numbers. The term "window" on the transmitter side represents the logical boundary of the total number of packets nevertheless to be best-selling by the receiver. The receiver informs the transmitter in each acknowledgment package the current maximum receiver buffer size (window boundary). The TCP header uses a 16 chip field to report the receiver window size to the sender. Therefore, the largest window that can be used is 216 = 64 kilobytes.
In slow-outset mode, the transmitter starts with low packet count and increases the number of packets in each transmission after receiving acknowledgment packets from receiver. For every ack parcel received, the window slides by one bundle (logically) to transmit ane new packet. When the window threshold is reached, the transmitter sends ane package for one ack packet received.
If the window limit is x packets then in deadening start mode the transmitter may get-go transmitting i packet followed past two packets (before transmitting ii packets, i parcel ack has to be received), followed by three packets and then on until 10 packets. But after reaching 10 packets, further transmissions are restricted to 1 parcel transmitted for i ack packet received. In a simulation this appears as if the window is moving by one package distance for every ack bundle received. On the receiver side as well the window moves 1 packet for every parcel received.
The sliding window method ensures that traffic congestion on the network is avoided. The application layer will nevertheless exist offering data for transmission to TCP without worrying nigh the network traffic congestion issues as the TCP on sender and receiver side implement sliding windows of packet buffer. The window size may vary dynamically depending on network traffic.
For the highest possible throughput, it is important that the transmitter is non forced to end sending past the sliding window protocol before than one round-trip filibuster time (RTT). The limit on the amount of information that it tin can ship before stopping to wait for an acquittance should be larger than the bandwidth-delay production of the communications link. If it is not, the protocol will limit the constructive bandwidth of the link.
Motivation [edit]
In any communication protocol based on automatic repeat request for error control, the receiver must admit received packets. If the transmitter does not receive an acknowledgment within a reasonable time, information technology re-sends the data.
A transmitter that does non get an acquittance cannot know if the receiver actually received the bundle; it may be that information technology was lost or damaged in transmission. If the error detection machinery reveals abuse, the bundle will exist ignored past the receiver and a negative or duplicate acknowledgement will be sent past the receiver. The receiver may too exist configured to not ship whatsoever acknowledgement at all. Similarly, the receiver is usually uncertain about whether its acknowledgements are being received. It may be that an acknowledgment was sent, just was lost or corrupted in the manual medium. In this case, the receiver must acknowledge the retransmission to forbid the information being continually resent, only must otherwise ignore it.
Protocol operation [edit]
The transmitter and receiver each have a electric current sequence number nt and northwardr , respectively. They each too have a window size wt and westwardr . The window sizes may vary, simply in simpler implementations they are fixed. The window size must exist greater than zero for any progress to exist made.
As typically implemented, northwardt is the next packet to exist transmitted, i.e. the sequence number of the outset packet non still transmitted. Too, nr is the kickoff packet not yet received. Both numbers are monotonically increasing with time; they only ever increase.
The receiver may as well keep rail of the highest sequence number notwithstanding received; the variable ndue south is one more than than the sequence number of the highest sequence number received. For simple receivers that only accept packets in society (wr = 1), this is the same as nr , but can be greater if wr > 1. Note the distinction: all packets beneath nr have been received, no packets above norths take been received, and between nr and ns , some packets take been received.
When the receiver receives a parcel, it updates its variables accordingly and transmits an acquittance with the new nr . The transmitter keeps track of the highest acknowledgment it has received na . The transmitter knows that all packets upwards to, but not including due northa accept been received, just is uncertain about packets between northa and ndue south ; i.due east. na ≤ northwardr ≤ northwards .
The sequence numbers always obey the dominion that due northa ≤ nr ≤ due norths ≤ due northt ≤ na + westt . That is:
- northa ≤ nr : The highest acknowledgement received by the transmitter cannot be higher than the highest northwardr acknowledged past the receiver.
- nr ≤ northwards : The span of fully received packets cannot extend across the end of the partially received packets.
- due northsouth ≤ northt : The highest packet received cannot exist higher than the highest bundle sent.
- northt ≤ due northa + wt : The highest packet sent is limited by the highest acknowledgement received and the transmit window size.
Transmitter operation [edit]
Whenever the transmitter has data to send, it may transmit up to wt packets ahead of the latest acknowledgment na . That is, it may transmit bundle number nt as long as due northt < northwarda +wt .
In the absence of a communication error, the transmitter soon receives an acknowledgment for all the packets it has sent, leaving northwarda equal to nt . If this does not happen after a reasonable delay, the transmitter must retransmit the packets between due northa and nt .
Techniques for defining "reasonable delay" can exist extremely elaborate, but they only affect efficiency; the basic reliability of the sliding window protocol does not depend on the details.
Receiver performance [edit]
Every fourth dimension a packet numbered x is received, the receiver checks to come across if information technology falls in the receive window, nr ≤ x < northr +westr . (The simplest receivers merely take to keep rail of 1 value nr =ns .) If information technology falls within the window, the receiver accepts it. If it is numbered nr , the receive sequence number is increased by 1, and possibly more if further consecutive packets were previously received and stored. If x > nr , the packet is stored until all preceding packets have been received.[1] If ten≥ns , the latter is updated to northwardsouthward =x+1.
If the packet'due south number is non within the receive window, the receiver discards it and does not modify nr or ns .
Whether the packet was accepted or non, the receiver transmits an acknowledgment containing the current nr . (The acknowledgment may besides include data nearly boosted packets received betwixt nr or ns , merely that merely helps efficiency.)
Note that there is no point having the receive window due westr larger than the transmit window wt , considering in that location is no demand to worry about receiving a packet that will never exist transmitted; the useful range is 1 ≤ wr ≤ wt .
Sequence number range required [edit]
Sequence numbers modulo four, with wr =1. Initially, nt =northwardr =0
So far, the protocol has been described equally if sequence numbers are of unlimited size, ever-increasing. Notwithstanding, rather than transmitting the full sequence number 10 in messages, information technology is possible to transmit only x modNorthward, for some finite N. (N is commonly a power of two.)
For example, the transmitter will only receive acknowledgments in the range na to northwardt , inclusive. Since it guarantees that due northt −na ≤wt , in that location are at nearly wt +1 possible sequence numbers that could arrive at any given fourth dimension. Thus, the transmitter can unambiguously decode the sequence number as long equally N >westwardt .
A stronger constraint is imposed by the receiver. The operation of the protocol depends on the receiver beingness able to reliably distinguish new packets (which should exist accepted and processed) from retransmissions of former packets (which should be discarded, and the last acknowledgment retransmitted). This can be done given knowledge of the transmitter's window size. Later on receiving a packet numbered x, the receiver knows that x <northwarda +wt , so na >x−wt . Thus, packets numbered x−westwardt volition never over again exist retransmitted.
The lowest sequence number we volition ever receive in future is norths −wt
The receiver too knows that the transmitter'south na cannot be higher than the highest acknowledgment ever sent, which is nr . And then the highest sequence number nosotros could possibly see is nr +wt ≤northsouthward +westt .
Thus, there are iiwt unlike sequence numbers that the receiver can receive at whatsoever in one case. It might therefore seem that nosotros must take North ≥ 2wt . Notwithstanding, the actual limit is lower.
The boosted insight is that the receiver does not need to distinguish between sequence numbers that are too depression (less than nr ) or that are too loftier (greater than or equal to nsouthward +wr ). In either case, the receiver ignores the package except to retransmit an acquittance. Thus, it is only necessary that N ≥wt +wr . As it is common to accept wr <due westt (east.g. see Go-Dorsum-North below), this can permit larger westwardt within a fixed N.
Examples [edit]
The simplest sliding window: stop-and-await [edit]
Although ordinarily distinguished from the sliding-window protocol, the end-and-wait ARQ protocol is really the simplest possible implementation of information technology. The transmit window is ane parcel, and the receive window is 1 packet. Thus, N = 2 possible sequence numbers (conveniently represented by a single bit) are required.
Ambiguity example [edit]
The transmitter alternately sends packets marked "odd" and "fifty-fifty". The acknowledgments as well say "odd" and "even". Suppose that the transmitter, having sent an odd packet, did not wait for an odd acquittance, and instead immediately sent the following fifty-fifty packet. It might and so receive an acknowledgment saying "expecting an odd packet next". This would get out the transmitter in a quandary: has the receiver received both of the packets, or neither?
Go-Dorsum-Due north [edit]
Go-Dorsum-N ARQ is the sliding window protocol with westwardt >1, but a fixed westwardr =1. The receiver refuses to accept any packet simply the next ane in sequence. If a package is lost in transit, following packets are ignored until the missing parcel is retransmitted, a minimum loss of 1 circular trip fourth dimension. For this reason, it is inefficient on links that endure frequent package loss.
Ambiguity example [edit]
Suppose that we are using a iii-scrap sequence number, such as is typical for HDLC. This gives N=23=8. Since wr =1, we must limit wt ≤7. This is because, after transmitting seven packets, at that place are eight possible results: Anywhere from 0 to 7 packets could have been received successfully. This is viii possibilities, and the transmitter needs enough information in the acknowledgment to distinguish them all.
If the transmitter sent viii packets without waiting for acknowledgment, it could find itself in a quandary similar to the stop-and-wait case: does the acquittance hateful that all 8 packets were received successfully, or none of them?
Selective repeat [edit]
The nigh general case of the sliding window protocol is Selective Repeat ARQ. This requires a much more capable receiver, which can accept packets with sequence numbers higher than the current northr and store them until the gap is filled in.
The reward, notwithstanding, is that information technology is not necessary to discard post-obit correct information for 1 round-trip time before the transmitter tin can be informed that a retransmission is required. This is therefore preferred for links with depression reliability and/or a high bandwidth-delay product.
The window size westwardr demand only exist larger than the number of consecutive lost packets that can be tolerated. Thus, small values are popular; westr =two is common.
Ambiguity example [edit]
The extremely popular HDLC protocol uses a three-bit sequence number, and has optional provision for selective echo. Nonetheless, if selective repeat is to be used, the requirement that nt +nr ≤ 8 must be maintained; if wr is increased to 2, wt must be decreased to 6.
Suppose that westr =2, but an unmodified transmitter is used with wt =7, as is typically used with the become-back-N variant of HDLC. Farther suppose that the receiver begins with nr =ns =0.
Now suppose that the receiver sees the following series of packets (all modulo 8):
- 0 ane 2 3 4 5 half-dozen (pause) 0
Because wr =2, the receiver volition accept and store the final packet 0 (thinking it is packet 8 in the series), while requesting a retransmission of packet seven. However, it is too possible that the transmitter failed to receive any acknowledgments and has retransmitted packet 0. In this latter example, the receiver would accept the wrong packet as packet 8.
The solution is for the transmitter to limit westwardt ≤6. With this brake, the receiver knows that if all acknowledgments were lost, the transmitter would have stopped after package v. When it receives packet 6, the receiver can infer that the transmitter received the acknowledgment for bundle 0 (the transmitter's na ≥one), and thus the post-obit packet numbered 0 must be packet eight.
Extensions [edit]
In that location are many ways that the protocol tin be extended:
- The above examples assumed that packets are never reordered in transmission; they may be lost in transit (fault detection makes corruption equivalent to loss), only will never announced out of order. The protocol can be extended to support parcel reordering, as long equally the distance can be bounded; the sequence number modulus North must be expanded past the maximum misordering distance.
- It is possible to not acknowledge every package, as long as an acquittance is sent somewhen if there is a pause. For example, TCP normally acknowledges every 2d packet.
- It is mutual to inform the transmitter immediately if a gap in the parcel sequence is detected. HDLC has a special REJ (reject) packet for this.
- The transmit and receive window sizes may be inverse during communication, as long as their sum remains within the limit of Northward. Ordinarily, they are each assigned maximum values that respect that limit, but the working value at whatever given time may be less than the maximum. In particular:
- It is common to reduce the transmit window size to slow down manual to friction match the link's speed, avoiding saturation or congestion.
- One common simplification of selective-repeat is and so chosen SREJ-REJ ARQ. This operates with westr =ii and buffers packets following a gap, but only allows a single lost packet; while waiting for that packet, due westr =1 and if a second packet is lost, no more than packets are buffered. This gives most of the performance do good of the full selective-repeat protocol, with a simpler implementation.
See also [edit]
- Federal Standard 1037C
- Compound TCP
- Serial number arithmetic
- TCP Fast Open
References [edit]
- ^ Peterson, Larry L. & Davie, Bruce South. "[1]", Morgan Kaufmann, 2000. ISBN ane-55860-577-0
- Comer, Douglas E. "Internetworking with TCP/IP, Volume 1: Principles, Protocols, and Compages", Prentice Hall, 1995. ISBN 0-13-216987-8
External links [edit]
- RFC 1323 - TCP Extensions for High Performance
- TCP window scaling and broken routers, 2004
- Sliding Window Demo (Wink required)
What Is The Purpose Of The Tcp Sliding Window?,
Source: https://en.wikipedia.org/wiki/Sliding_window_protocol
Posted by: musialanated1978.blogspot.com

0 Response to "What Is The Purpose Of The Tcp Sliding Window?"
Post a Comment