CS475 – Networks Assignments Lecture 5 Chapter 2: Direct Link Networks

advertisement
CS475 – Networks
Lecture 5
Chapter 2: Direct Link Networks
Assignments
• Reading for Lecture 6: Sections 2.6 – 2.8
• Homework 2: 2.1, 2.4, 2.6, 2.14, 2.18, 2.31, 2.35. Due Thursday, Sept. 15
2.4 Error Detection
Bit errors in a frame will occur. How do we detect (and then
(or both) frames contains an error. This is inefficient (and not
recover) from them? We look at error detection first.
that reliable).
We detect errors by adding redundant information. We could
We will look at the two-dimensional parity, ________________,
transmit duplicate frames. If the frames differ on reception, one and cyclic redundancy check (CRC) error detection methods.
2.4.1 Two-Dimensional Parity
Two-dimensional parity is often used with 7-bit codes
(___________). It requires the addition of a parity byte (and 1
parity bit per word).
Two-dimensional parity catches all 1, 2, and 3 bit errors (and
most 4 bit errors).
Fig 2.14: 2D Parity (Even Parity)
PC serial port hardware can be configured to transmit and
receive using 1-D parity.
The settings must be identical on both ends of the link.
Windows Serial Port Properties Window
09/08/2011
Page 1 of 6
2.4.2 Checksums
Checksums are not used at the link layer, but are used at the higher layers in the TCP/IP stack. The checksum algorithm is easy to
implement in software.
In the ___________________ checksum algorithm, data is treated as 16-bit integers. The integers are added using ones
complement arithmetic. The ones complement of the sum is sent as the checksum.
In ones complement addition any carry out of the most significant bit is added back in at the least significant position.
Example: Compute the 8-bit check sum of 11000011, 10101010, 01110111 using the Internet checksum algorithm.
11000011
 10101010
Checksum is
 01110111
At the receiver all words are added (including the checksum)
extra bits (16 for a message of any size), but it is relatively weak.
using ones complement arithmetic. If there are no errors the sum Experience has shown that the algorithm is sufficient as long as
will be all 1s (11111111 in the previous example).
stronger error detection (___________) is used at the link layer.
The Internet checksum algorithm uses only a small number of
2.4.3 Cyclic Redundancy Check
The CRC algorithm is based on polynomial division. The bits in
the message are treated as _______________________ of a
M(x) = 1 x3 + 0 x2 + 1 x1 + 1 = x3 + x + 1
Note that most messages are thousands of bits long and would
polynomial. For example, the four bit message 1011 represents: represent polynomials of high degree.
To calculate a CRC, the sender and receiver agree on a divisor
polynomial, C(x)
Standard divisor polynomials are known to give good results.
(________________________ uses CRC-32).
09/08/2011
Page 2 of 6
CRC
CRC-8
CRC-10
CRC-12
CRC-16
CRC-CCITT
CRC-32
C(x)
x8 + x2 + x + 1
x10 + x9 + x5 + x4 + x + 1
x12 + x11 + x3 + x2 + 1
x16 + x12 + x2 + 1
x16 + x12 + x5 + 1
x32 + x26 + x23 + x22 + x16 +
x12 + x11 + x10 + x8 + x7 +
x5 + x4 + x2 + x + 1
To compute the k-bit CRC:
In performing the division, exclusive-or is used instead of
1) Multiply M(x) by xk (add k zeros at the end of the message).
subtraction. Polynomials of equal order can always be divided.
Call this message T(x).
The result is the original message followed by the
2) Divide T(x) by C(x) and find the remainder.
________________________ in step 2).
3) Subtract the remainder from T(x).
Consider computing the 3-bit CRC for the message M(x) =
1101 ) 10011010000  Message
10011010 using C(x) = 1101.
The transmitted signal is 10011010101. If this polynomial is
divided by 1101 at the receiver, the remainder should be 0. If it
is not, then an _______________ has occurred.
Although the CRC calculation appears complex, it can be
computed in ____________________ using a shift register and
exclusive-or gates.
Fig. 2.16: CRC calc. using a shift register
Division by x3 + x2 + 1.
2.5 Reliable Transmission
A link-level protocol that wants to deliver frames reliably must
Recovery algorithms that use ACKs and timeouts are known as
recover frames that have errors. This is usually done by using
automatic repeat request (___________) algorithms. We will
some combination of acknowledgments (ACKs) and timeouts.
examine three such algorithms.
2.5.1 Stop-and-Wait
The simplest ARQ scheme is the stop-and-wait algorithm. After before transmitting the next frame. If the ACK does not arrive
transmitting one frame the sender waits for an acknowledgment after a certain interval, the sender retransmits the original frame.
09/08/2011
Page 3 of 6
If there are no errors the timeline is as shown below. (If an error If a frame is lost, the sender automatically retransmits the frame
is detected in the received frame, the receiver does not return an after the timer has ___________________.
____________. It waits for the frame to be retransmitted.
Fig. 2.17: Lost frame
Fig. 2.17: ACK received
If the ACK is lost, the sender automatically retransmits the frame If the ACK is delayed, the sender automatically retransmits the
after the timer has expired.
frame after the timer has expired.
The receiver can discard the duplicate frame, but must still send The receiver can discard the duplicate frame, but must still send
an ACK.
an ACK.
Fig. 2.17: Lost ACK
09/08/2011
Fig. 2.17: Slow ACK
Page 4 of 6
To simplify detection of _________________ frames, the frame
header includes a bit that alternates between 0 and 1.
If two consecutive 0 (or 1) frames are received, the receiver
knows that the second frame is a duplicate.
The main problem with the stop-and-wait algorithm is that it
does not use the link to its full capacity.
A 1.5 Mbps link with a 45 ms RTT has a delay x BW product of
67.5 kb (8 kB). Assuming a 1 kB frame, stop-and-wait would
Fig. 2.18: Stop and wait with 1-bit sequence number.
only allow a throughput of
1 kB x 8 b/B / 45 ms = _________________
This is only 1/8 of the link BW!
2.5.2 Sliding Window
To fully utilize the available BW we allow the sender to transmit
___________________ frames in sequence.
On the 1.5 Mbps link from the previous slide we want the sender
to transmit 8 frames and be ready to send the 9th as soon as the
ACK for the first frame is received.
Fig. 2.19: Sliding Window Timeline
The sender assigns a sequence number, SeqNum, to each frame.
The sender has to maintain three variables related to the sliding
•
A new frame is sent (and LFS _________________) only if:
window algorithm:
•
SWS, the send window ______________,
•
LAR, the seq. num. of the last acknowledgment
LFS, the seq. num. of the last frame sent
LFS – LAR ≤ SWS
received,
Fig. 2.20: Sliding window on the sender.
The receiver maintains the following three variables:
09/08/2011
Page 5 of 6
LAF – LFR ≤ RWS
•
RWS, the receive window size,
•
LAF, the sequence number of the largest ____________
frame,
•
LFR, the seq. num. of the last frame received
Fig. 2.21: Sliding window on the receiver.
The receiver maintains the following invariant:
If the SeqNum of a received frame satisfies LFR < SeqNum ≤ LAF, the frame is accepted. If all frames with seq. numbers less
than SeqNum have been ACKed then this frame is ACKed, LFR is set to SeqNum and LAF is set to LFR + RWS.
When frames are received __________________ the details are a bit more complicated. See the text for details.
2.5.3 Concurrent Logical Channels
ARPANET used a variation of stop-and-wait while still “keeping the pipe full”. It worked by using multiple logical channels and
running stop-and-wait on each channel.
The ______________________ of each frame contained a 1-bit sequence number and the number of the logical channel.
09/08/2011
Page 6 of 6
Download