Stop and Wait ARQ

advertisement
EKT 331
COMMUNICATION NETWORKS
TUTORIAL 3
Chapter 5
1. Suppose that two peer-to-peer processes provide a service that involves the transfer of discrete
messages. Suppose that the peer processes are allowed to exchange PDUs that have a maximum
size of M bytes including H bytes of header. Suppose that a PDU is not allowed to carry
information from more than one message.
Solutions follow questions:
a. Develop an approach that allows the peer processes to exchange messages of arbitrary
size.
b. What essential control information needs to be exchanged between the peer processes?
c. Now suppose that the message transfer service provided by the peer processes is shared
by several message source-destination pairs. Is additional control information required,
and if so, where should it be placed?
2. Suppose that two peer-to-peer processes provide a service that involves the transfer of a stream
of bytes. Suppose that the peer processes are allowed to exchange PDUs that have a maximum
size of M bytes, including H bytes of header.
a. Develop an approach that allows the peer processes to transfer the stream of bytes in a
manner that uses the transmission line efficiently. What control information is required in
each PDU?
b. Suppose that the bytes in the stream arrive sporadically. What is a reasonable way to
balance efficiency and delay at the transmitter? What control information is required in
each PDU?
c. Suppose that the bytes arrive at a constant rate and that no byte is to be delayed by
more that T seconds. Does this have an impact on the efficiency?
d. Suppose that the bytes arrive at a variable rate and that no byte is to be delayed by
more than T seconds. Is there a way to meet this requirement?
3. Suppose that two peer-to-peer processes provide a service that involves the transfer of a stream
of bytes. Develop an approach that allows the stream transfer service to be shared by several pairs
of users in the following cases:
The protocol that provides the service must be able to multiplex information from different user
pairs for transfer. A basic design decision is whether the PDUs should carry information from
multiple users or be constrained to carry information from a single user. The latter approach is
simpler in that only a single user needs to be identified per PDU. The latter approach is
complicated by the need to identify several users (actually multiplexing IDs) per PDU.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
a. The bytes from each user pair arrive at the same constant rate.
b. The bytes from the user pairs arrive sporadically and at different rates.
6. Compare the operation of Stop-and-Wait ARQ with bidirectional Go-Back-N ARQ with a
window size of 1. Sketch out a sequence of frame exchanges using each of these protocols and
observe how the protocols react to the loss of an information frame and to the loss of an
acknowledgment frame.
7. Explain the differences between PPP and HDLC.
8. Using 5-bit sequence numbers, what is the maximum size of the send and received windows
for each of the following protocols?
(i) Stop- and-Wait ARQ (Automatic Repeat Request)
(ii) Go-Back-N ARQ
(iii) Selective-Repeat ARQ
9. A system uses the Stop-and Wait ARQ Protocol. If each packet carries 1000 bits of data.
Determine how long does it take to send 1 million bits of data if the distance between the sender
and receiver is 5000 Km and the propagation speed is 2 x 108m/s. Ignore transmission, waiting,
and processing delays. Assume no data or control frame is lost or damaged.
Nos of frame to be sent is 1000 frames. We ignore the overhead due to the header and trailer.
10. Repeat exercise 4 using the Go- Back-N ARQ Protocol with a window size of 7. Ignore the
overhead due to the header and trailer.
11. Repeat exercise 4 using the selective repeat ARQ Protocol with a window size of 4. Ignore
the overhead due to the header and trailer.
Chapter 6
1. Explain why collision is an issue in a random access protocol but not in controlled access or
channelizing protocol.
2. Differentiate Aloha and Slotted Aloha in a random access control protocol.
3. What is the difference between a unicast ,multicast, and broadcast address?
4. What are the advantages of dividing an Ethernet LAN with a bridge?
5. Why there is no need for CSMA/CD on a full-duplex Ethernet LAN?
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
6. A wireless LAN has mobile stations communicating with a base station. Suppose that the
channel available has W Hz of bandwidth and suppose that the inbound traffic from the mobiles
to the base is K times smaller than the outbound traffic from the base to the workstations. Two
methods are considered for dealing with the inbound/outbound communications. In frequencydivision duplexing the channel is divided into two frequency bands, one for inbound and one for
outbound communications. In time-division duplexing all transmissions use the full channel but
the transmissions are time-division multiplexed for inbound and outbound traffic.
a. Compare the advantages and disadvantages of the two methods in terms of flexibility,
efficiency, complexity, and performance.
7. Use HDLC and Ethernet to identify three similarities and three differences between medium
access control and data link control protocols. Is HDLC operating as a LAN when it is used in
normal response mode and multipoint configuration?
8. Consider a network with one primary and 2 secondary stations uses polling. The size of a data
frames is 1500 bytes. The size of the poll, ACK, and NAK frames are 20 bytes each. Each station
has 5 frames to send. Determine the exchanged total bytes if there is no limitation on the number
of frames a station can send in response to a poll.
9. Repeat exercise 1 if each station can send only one frame in response to a poll.
10. Use IEEE 802.3 and 802.11 to discuss three differences between wired and wireless LANs.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
Extra Notes
Statistical multiplexing is a type of communication link sharing, very similar to
Dynamic bandwidth allocation (DBA). In statistical multiplexing, a communication
channel is divided into an arbitrary number of variable bit-rate digital channels or data
streams. The link sharing is adapted to the instantaneous traffic demands of the data
streams that are transferred over each channel. This is an alternative to creating a fixed
sharing of a link, such as in general time division multiplexing and frequency division
multiplexing. When performed correctly, statistical multiplexing can provide a link
utilization improvement, called the statistical multiplexing gain.
Statistical multiplexing is facilitated through packet mode or packet oriented
communication, which amongst others is utilized in packet switched computer networks.
Each stream is divided into packets that normally are delivered asynchronously in a firstcome first-serve fashion. Alternatively, the packets may be delivered according to some
scheduling discipline for fair queuing or differentiated and/or guaranteed Quality of
service.
Statistical multiplexing of an analog channel, for example a wireless channel, is also
facilitated through the following schemes:


Random frequency-hopping orthogonal frequency division multiple access (RFHOFDMA)
Code-division multiple access (CDMA), where different amount of spreading
codes or spreading factors can be assigned to different users.
Statistical multiplexing normally implies "on-demand" service rather than one that
preallocates resources for each data stream. Statistical multiplexing schemes do not
control user data transmissions
Comparison with static TDM
Time domain statistical multiplexing (packet mode communication) is similar to timedivision multiplexing (TDM), except that, rather than assigning a data stream to the same
recurrent time slot in every TDM frame, each data stream is assigned time slots (of fixed
length) or data frames (of variable lengths) that often appear to be scheduled in a
randomized order, and experience varying delay (while the delay is fixed in TDM).
Statistical multiplexing allows the bandwidth to be divided arbitrarily among a variable
number of channels (while the number of channels and the channel data rate are fixed in
TDM).
Statistical multiplexing ensures that slots will not be wasted (whereas TDM can waste
slots). The transmission capacity of the link will be shared by only those users who have
packets.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
Static TDM and other circuit switching is carried out at the physical layer in the OSI
model and TCP/IP model, while statistical multiplexing is carried out at the data link
layer and above.
Channel identification
In statistical multiplexing, each packet or frame contains a channel/data stream
identification number, or (in the case of datagram communication) complete destination
address information.
Usage
Examples of statistical multiplexing are:

The MPEG transport stream for digital TV transmission. Statistical multiplexing
is used to allow several video, audio and data streams of different data rates to be
transmitted over a bandwidth-limited channel (see #Statistical multiplexer). The
packets have constant lengths. The channel number is denoted Program ID (PID).

The UDP and TCP protocols, where data streams from several application
processes are multiplexed together. The packets may have varying lengths. The
port numbers constitute channel identification numbers (and also address
information).

The X.25 and Frame relay packet-switching protocols, where the packets have
varying lengths, and the channel number is denoted Virtual Connection Identifier
(VCI). The international collection of X.25 providers, using the X.25 protocol
suite was colloquially known as "the Packet switched network" in the 1980s and
into the beginning of the 1990s.

The Asynchronous Transfer Mode packet-switched protocol, where the packets
have fixed length. The channel identification number consists of a Virtual
Connection Identifier (VCI) and a Virtual Path Identifier (VPI).
Statistical multiplexer
In for example digital audio and video broadcasting, a statistical multiplexer is a content
aggregating device that allows broadcasters to provide the greatest number of audio or
video services for a given bandwidth by sharing a pool of fixed bandwidth among
multiple services or streams of varying bitrates. The multiplexer allocates to each service
the bandwidth required for its real-time needs so that services with complex scenes
receive more bandwidth than services with less complex ones. This bandwidth sharing
technique produces the best video quality at the lowest possible aggregate bandwidth.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
Reliability
Reliable delivery has been succinctly defined as "Data is accepted at one end of a link in
the same order as was transmitted at the other end, without loss and without duplicates."
This implies four constraints:
(i) No loss (at least one copy of each PDU is sent)
(ii) No duplication (no more than one copy of each PDU is sent)
(iii) FIFO delivery (the PDUs are forwarded in the original order)
(iv) A PDU must be delivered within a reasonable period
For a communications protocol to support reliability, requires that the protocol identifies
each individual PDUs that is transmitted. The protocol implements an error recovery
procedure (e.g. Stop and Wait ).
There is very little data which is so important that it must be sent no matter how late. If
the links in the network are therefore liable may lead to loss of packets, a reliable
protocol should be used. When the under-lying network is very reliable (as in an Ethernet
LAN), best effort protocols may be sufficient.
Reliability may be provided at various levels of the OSI reference model. Examples of
reliable communications protocols are:



Link Layer - (e.g. HDLC ABM)
Transport Layer - TCP
Application Layer (e.g. TFTP)
Layered protocols usually also employ timers at each level, governing this interval. The
service provided by a protocol layer may be unreliable for various reasons including:
Stop and Wait ARQ
Stop and Wait transmission is the simplest reliability technique and is adequate for a very
simple communications protocol. A stop and wait protocol transmits a Protocol Data Unit
(PDU) of information and then waits for a response. The receiver receives each PDU and
sends an Acknowledgement (ACK) PDU if a data PDU is received correctly, and a
Negative Acknowledgement (NACK) PDU if the data was not received. In practice, the
receiver may not be able to reliably identify whether a PDU has been received, and the
transmitter will usually also need to implement a timer to recover from the condition
where the receiver does not respond.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
Under normal transmission the sender will receive an ACK for the data and then
commence transmission of the next data block. For a long delay link, the sender may
have to wait an appreciable time for this response. While it is waiting the sender is said to
be in the "idle" state and is unable to send further data.
Stop and Wait ARQ - Waiting for Acknowledgment (ACK) from the remote node.
The blue arrows show the sequence of data PDUs being sent across the link from the
sender (top to the receiver (bottom). A Stop and Wait protocol relies on two way
transmission (full duplex or half duplex) to allow the receiver at the remote node to return
PDUs acknowledging the successful transmission. The acknowledgements are shown in
green in the diagram, and flow back to the original sender. A small processing delay may
be introduced between reception of the last byte of a Data PDU and generation of the
corresponding ACK.
When PDUs are lost, the receiver will not normally be able to identify the loss (most
receivers will not receive anything, not even an indication that something has been
corrupted). The transmitter must then rely upon a timer to detect the lack of a response.
Stop and Wait ARQ - Retransmission due to timer expiry
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
In the diagram, the second PDU of Data is corrupted during transmission. The receiver
discards the corrupted data (by noting that it is followed by an invalid data checksum).
The sender is unaware of this loss, but starts a timer after sending each PDU. Normally
an ACK PDU is received before this the timer expires. In this case no ACK is received,
and the timer counts down to zero and triggers retransmission of the same PDU by the
sender. The sender always starts a timer following transmission, but in the second
transmission receives an ACK PDU before the timer expires, finally indicating that the
data has now been received by the remote node.
The state diagram (also showing the operation of NACK) is shown below:
State Diagram for a simple stop and wait protocol
(Green for ACK, Blue for Data, Red for NACK)
Go-Back-N Error Recovery
Go-Back-N error recovery is a procedure which is implemented in some communications
protocols to provide reliability. Go-Back-N ARQ (is one of a number of error recovery
procedures to detect and retransmit I-frames which have been corrupted due to errors in
the physical link (c.f. saw, polling, selective repeat).
Features required for Go-Back-N ARQ

To support Go-Back-N ARQ, a protocol must number each PDU which is sent.
(PDUs are normally numbered using modulo arithmetic, which allows the same
number to be re-used after a suitably long period of time. The time period is
selected to ensure the same PDU number is never used again for a different PDU,
until the first PDU has "left the network" (e.g. it may have been acknowledged)).
Shahadah Ahmad
EKT 331


COMMUNICATION NETWORKS
The local node must also keep a buffer of all PDUs which have been sent, but
have not yet been acknowledged.
The receiver at the remote node keeps a record of the highest numbered PDU
which has been correctly received. This number corresponds to the last
acknowledgement PDU which it may have sent.
Recovery of lost PDUs using Go-Back-N.
The recovery of a corrupted PDU proceeds in three stages:

First, the corrupted PDU is discarded at the remote node's receiver.

Second, the remote node requests retransmission of the missing PDU using a
control PDU (sometimes called a NACK or REJECT). The receiver discards all
PDUs which do not have the number of the requested PDU.
The final stage consists of retransmission of the lost PDU(s).

Retransmission using Go-Back-N
A remote node may request retransmission of corrupted PDUs by initiating Go-Back-N
error recovery by sending a control PDU indicating the last successfully received PDU.
This allows the remote node to instruct the sending node where to begin retransmission of
PDUs. The remote node does not store any out-of-sequence PDUs and therefore must
discard all received PDUs until one is received with the expected sequence number.
Upon receipt of a Go-Back-N control PDU (by the local node), the transmitter windsback the sequence of PDUs pending transmission to the indicated PDU in its buffer of
unacknowledged PDUs. The transmitter then retransmits (Goes Back-to-N) the requested
PDU followed by all successive PDUs. This is sometimes known as "wind back" of the
transmitter.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
Example of Go-Back-N. The sender in this example transmits four PDUs (1-4) and the
first one (1) of these is not successfully received. The receiver notes that it was expecting
a PDU numbered 1 and actually receives a PDU numbered 2. It therefore deduces that
(1) was lost. It requests retransmission of the missing PDU by sending a Go-Back-N
request (in this case N=1), and discards all received PDUs with a number greater than
1.The sender receives the Go-Back-N request and retransmits the missing PDU (1),
followed by all subsequently sent PDUs (2-4) which the receiver the correctly receives
and acknowledges.
If the retransmission is not successful, the protocol relies upon a protocol timer in the
local node to detect that no acknowledgment was received. The lost PDUs may then be
recovered by Polling.
Selective Repeat Error Recovery
Selective Repeat error recovery is a procedure which is implemented in some
communications protocols to provide reliability. It is the most complex of a set of
procedures which may provide error recovery, it is however the most efficient scheme.
Selective repeat is employed by the TCP transport protocol.
Features required for Selective Repeat ARQ



To support Go-Back-N ARQ, a protocol must number each PDU which is sent.
(PDUs are normally numbered using modulo arithmetic, which allows the same
number to be re-used after a suitably long period of time. The time period is
selected to ensure the same PDU number is never used again for a different PDU,
until the first PDU has "left the network" (e.g. it may have been acknowledged)).
The local node must also keep a buffer of all PDUs which have been sent, but
have not yet been acknowledged.
The receiver at the remote node keeps a record of the highest numbered PDU
which has been correctly received. This number corresponds to the last
acknowledgement PDU which it may have sent.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
The above features are also required for Go-Back-N, however for selective repeat, the
receiver must also maintain a buffer of frames which have been received, but not
acknowledged.
Recovery of lost PDUs using Selective Repeat ARQ
The recovery of a corrupted PDU proceeds in four stages:




First, the corrupted PDU is discarded at the remote node's receiver.
Second, the remote node requests retransmission of the missing PDU using a
control PDU (sometimes called a Selective Reject). The receiver then stores all
out-of-sequence PDUs in the receive buffer until the requested PDU has been
retransmitted.
The sender receives the retransmission request and then transmits the lost PDU(s).
The receiver forwards the retransmitted PDU, and all subsequent in-sequence
PDUs which are held in the receive buffer.
Retransmission using Selective Repeat
A remote node may request retransmission of corrupted PDUs by initiating Selective
Repeat error recovery by sending a control PDU indicating the missing PDU. This allows
the remote node to instruct the sending node where to retransmit the PDU which has not
been received. The remote stores any out-of-sequence PDUs (i.e. which do not have the
expected sequence number) until the retransmission is complete.
Upon receipt of a Selective Repeat control PDU (by the local node), the transmitter sends
a single PDU from its buffer of unacknowledged PDUs. The transmitter then continues
normal transmission of new PDUs until the PDUs are acknowledged or another selective
repeat request is received.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
Operation of Selective Repeat. The sender transmits four PDUs (1-4). The first PDU (1)
is corrupted and not received. The receiver detects this when it receives PDU(2), which it
stores in the receive buffer and requests a selective repeat of PDU(1). The sender
responds to the request by sending PDU(1), and then continues sending PDUs (5-7). The
receiver stores all subsequent out-of-sequence PDUs (3-4), until it receives PDU(1)
correctly. The received PDU (1) and all stored PDUs (2-4) are then forwarded, followed
by (5-7) as each of these is received in turn.
If the retransmission is not successful, the protocol relies upon a protocol timer in the
local node to detect that no acknowledgment was received. The lost PDUs may then be
recovered by Polling.
Comparison of ARQ Methods
The table below provides a comparison of the various ARQ methods described. (W is the
window size, or number of PDUs which may be in transit at any one time).
ARQ Method
Stop-and-Wait
Sender Buffer
1 PDU
Polling
W PDUs
Go-Back-N
W PDUs
Selective
Repeat
W PDUs
Receiver Buffer Control PDUs
1 PDU
ACK
ACK, Poll,
1 PDU
Response
ACK, Go1 PDU
Back-N
ACK, Selective
W PDUs
Repeat
Polling
Polling is a technique where by a master station identifies the status of the slave stations
by asking each in turn for a status report. In many cases, communications links consist of
just two nodes - so there is just one master station and one slave station.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
Polling may be used to provide a communications protocol which supports reliability.
The operation of polling for error recovery is explained below:
During normal operation, a steady flow of PDUs are transmitted by the sending node to
the corresponding receiver. This receiver returns information (acknowledgments) to the
transmitter to synchronise the operation of the protocols (or to indicate that a receiver is
'not ready' to receive data).
If a receiver fails to receive an acknowledgment for the PDUs it has transmitted, or when
it has sent a PDU which requires the remote node to perform a specific action and this
action has not been performed, it may commence a process known as "Polling".
Polling is triggered when the sender/transmitter detects that it has not received an
acknowledgment for a PDU which it has sent previously. It commences with the
transmission of a control PDU indicating the current state, and requesting the remote
node state (see figure).
Polling to Determine the Remote Node State
When the remote node receives this PDU, it replies by transmitting a response PDU
indicating its current state. This process, if completed successfully, allows the local node
to synchronise its send state information with the remote node's receive state information.
(The synchronisation is performed in the direction of transmission of the poll PDU). This
allows the transmitter to detect any frames which have not been successfully received and
retransmit them.
Shahadah Ahmad
EKT 331
COMMUNICATION NETWORKS
Example of Polling. The sender in this example transmits three PDUs (1-3) and none of
these are successfully received. After a period of time, it notes that no acknowledgment
PDU has been received (through expiry of a timer) and commences to poll the remote
node. The remote node responds indicating the last PDU correctly received. The sender
is therefore able to retransmit the missing PDUs (1-3), which the receiver then
acknowledges.
Polling is used in HDLC which supports the Checkpoint procedure.
Shahadah Ahmad
Download