Sample Solution for Exercise Communication Networks I

Transcription

Sample Solution for Exercise Communication Networks I
Sample Solution for Exercise
Communication Networks I
Prof. Dr.-Ing. Ralf Steinmetz
Multimedia Communications Lab
Institut für Datentechnik
Fachbereich Elektrotechnik und Informationstechnik
Fachbereich Informatik (Zweitmitglied)
Published at:
06.05.2013
Submission due: 16.05.2013, 12:00am
Exercise Communication Networks I - Summer Term 2013
Page 1 of 9
Problem 1 - Multiple Choice
a) What is the purpose of a checksum, such as CRC (Cyclic Redundancy Code)?
A) Add redundancy to a frame for error detection.
B) Flow control protocol.
C) Extension of HDLC (High-Level Data Link Control).
D) Find redundant code in cyclic routers.
E) Determine the routes in cyclic networks with redundant codepoints.
Solution: Answer A
b) In which layer is CRC used for error detection?
A) Physical Layer
B) Correction Layer
C) Data Link Layer
D) Network Layer
E) Transport Layer
Solution: Answer C
c) Which is an extension to the original sliding window algorithm?
A) Driving
B) Sequence number
C) Acknowledgment
D) Window size
E) Negative Acknowledgment
Solution: Answer E
Exercise Communication Networks I - Summer Term 2013
Page 2 of 9
Problem 2 - Data link layer
a) Which are the services of the data link layer?
Solution: reliable, efficient data transfer between adjacent stations
b) Which are the functions of the data link layer?
Solution:
- data transmission as frames
- error control and correction
- flow control of the frames
- configuration management
c) A data link layer protocol defines 01111110 as a block delimiter and uses the bit-stuffing procedure. How is
the following bit stream modified and handed over to the physical layer?
001101111100001111110111111111110
Solution: 01111110
0011011111000001111101011111011111010 01111110
d) A character oriented data link layer protocol uses the character string “ex” to indicate the beginning of a
frame and “er” to indicate the end of a frame. “e” is the DLE. How is the following character stream modified
and handed over to the physical layer?
Fritz Brause is an extremely great singer
Solution: exFritz Brausee is an eextreemeely greeat singeerer
Bit stuffing and byte stuffing realize lightly different principles: by bit stuffing the occurence of the delimiter pattern
is avoided by inserting zeros into the data stream; by byte stuffing the inserted DLE (e in our case) denotes that the next
DLE is not a control field.
Exercise Communication Networks I - Summer Term 2013
Page 3 of 9
e) The following code is given:
A) 000000
B) 000111
C) 111000
D) 111111
I) What is the hamming distance of this code?
II) Which errors can be detected?
III) Which errors can be corrected?
Solution:
- hamming distance: 3
- error detection of 2-bit-errors
- error correction of 1-bit-errors
IV) Which data has been transmitted by the following stream?
101000 000000 010101 000001 111000 111101
Solution: C A (B) A C D
In the 3r d block is a 2-bit-error. In general, this code does not support reliable correction of 2-bit errors. However,
in this case B is the most probable option, since all other words have higher distances to the received block 010101.
Exercise Communication Networks I - Summer Term 2013
Page 4 of 9
f) The bit stream 0011001111001 is coded by the Cyclic Redundancy Code (CRC) method. The generator
polynomial x 4 + x + 1 is used. What is the transmitted frame?
Additionally to the examples of the polynomical division in the lecture slides (see Chapter Data Link Layer Section 3.4)
there are numerous examples on the Internet (for the case you are not familiar with the polynomial division). Here are
one of them:
- http://www.lammertbies.nl/comm/info/crc-calculation.html
Solution: Transmitted Frame: 00110011110010100
The degree of G(X ) is 4. So we add 4 0-bits to the end of the source frame. Let’s call the result A(X ): A(X ) =
00110011110010000
Now, we divide A(X ) by G(X ) using modulo 2 division and determine the remainder:
0
0
1
1
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
1
1
1
1
1
0
1
1
0
1
0
1
1
1
1
1
0
0
0
0
0
0
0
0
Exercise Communication Networks I - Summer Term 2013
1
1
0
1
1
0
0
0
0
0
0
1
1
1
0
1
1
0
1
0
1
1
0
0
1
1
0
1
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
1
1
0
1
0
1
0
0
0
0
0
0
0
0
Page 5 of 9
g) When we use “Cyclic Redundancy Code”(CRC) with generator polynomial G(X ) = x 4 + x 2 + 1 to add an error
correction to the frame 1010110101, what will be transmitted?
Solution: 10101101010000
The degree of G(X ) is 4. So we add 4 0-bits to the end of the source frame.
Let’s call the result A(X ): A(X ) = 10101101010000
Now, we divide A(X ) by G(X ) using modulo 2 division:
10101101010000 / 10101 = 1000010000
-10101|||||||||
======v||||||||
00001||||||||
-00000||||||||
======v|||||||
00010|||||||
-00000|||||||
======v||||||
00101||||||
-00000||||||
======v|||||
01010|||||
-00000|||||
======v||||
10101||||
-10101||||
======v|||
00000|||
-00000|||
======v||
00000||
-00000||
======v|
00000|
-00000|
======v
00000
-00000
======
0 (<- remainder)
In the final step we subtract the remainder (zero) from A(X ) using modulo 2 subtraction: A(X ) − 0 = 10101101010000
So the transmitted frame is 10101101010000.
Exercise Communication Networks I - Summer Term 2013
Page 6 of 9
Problem 3 - Sliding Window
The Sliding-Window Protocol with window size 3, sequence numbers 0 − 5, including Acknowledgement, (Ack1 =
Acknowledgement of Frame 1 and all previous not yet acknowledged Frames) and for error treatment Selective-repeat is
used.
a) Complete the entries for the Sender and Receiver Windows in the following table (B = free Buffer space, L/U =
Lower/Upper Bound) and the sequence numbers used for the transmitted Frames and Acknowledgements.
Hint: The column Action shows the last action the Sender/Receiver has done. For example the Sender has sent
the Frame 0 (F0) at Time 1 and the Receiver has received Frame 0 at Time 2. Thus the values of the
Upper/Lower bound and the Window must match with the Action column. At Time 3 the Sender/Receiver
sends a Frame/ACK at the same time. What happens if ACK 2 is lost (Time 8)?
Time
B
Sender Window
L
U
0
1
2
3
4
5
6
7
3
2
2
1
1
2
1
1
0
0
0
0
0
1
1
1
0
1
1
2
2
2
3
3
8
1
1
3
9
10
0
0
1
1
4
4
11
0
1
4
12
13
14
15
16
17
18
0
0
3
2
2
2
3
1
1
4
4
4
4
5
4
4
4
5
5
5
5
Action
Sender
Receiver
F0
F 1
F0
ACK 0
F 1
ACK 0
F 2
F 2
ACK 2
(lost)
F 3
timeout
F 1
(retransmit)
F 3
F 1
ACK 3
ACK 3
F 4
F 4
ACK 4
ACK 4
Exercise Communication Networks I - Summer Term 2013
Receiver Window
L
U
B
0
0
1
1
2
2
2
3
3
3
3
4
4
4
4
4
3
3
2
3
2
2
2
1
3
0
3
3
4
0
0
3
2
4
0
2
4
4
4
4
5
5
5
0
1
1
1
1
2
2
2
3
3
3
2
3
3
Page 7 of 9
Problem 4 - Sliding Window
a) The Sliding-Window Protocol with window size 3, sequence numbers 0 − 5, separate Acknowledgement and
error treatment Selective-Repeat is used. The clock like circles are used to indicate the Sender and Receiver
Windows (LB = Lower Bound and UB = Upper Bound). Complete the following diagram.
S ender
LB
UB
LB
0
R eciever
F (0)
UB
A (.....)
F (1)
F (2)
A (.....)
F (0) (retransm ission)
A (.....)
A (.....)
Tim eout
F (.....)
A (.....)
F (3)
A (.....)
Exercise Communication Networks I - Summer Term 2013
Page 8 of 9
Solution:
S ender
LB
UB
LB
0
R eciever
F (0)
UB
A (0)
F (1)
F (2)
A (1)
F (0) (retransm ission)
A (2)
A (0)
Tim eout
F (2)
A (2)
F (3)
A (3)
Comment to A(0) after the retransmission: The receiver discards the frame (because it has it already), but sends an
acknowlegdement back. It is not possible that this is the F(0) of the next batch.
b) Compare the error treatment methods “Go-Back-N” and “Selective-Repeat”? What does the decision, which
one is to be used, depend upon?
Solution: “Go-Back-N” is much simpler to implement, since “Selective-Repeat” needs more complex algorithms (e.g. for
buffer management). In most networks the ratio of “probability of a correct transmission” to “Number of bits on the line”
respectively to the “end-to-end-delay” is large enough so the smaller protocol overhead of “Go-Back-N” is utilized. If this
ratio decreases, the needed buffer and and/or the delay rises, so that “Selective-Repeat” becomes interesting.
c) What does the start_ack_timer do?
Solution: It ensures that an acknowledgement is sent timely when no data is to be sent that could piggyback the
acknowledgement.
Exercise Communication Networks I - Summer Term 2013
Page 9 of 9