DataComm-chapter 4
DataComm-chapter 4
FACULTY OF ENGINEERING,
CYBERJAYA
YEAR 2008
CHAPTER 4 : Reliable Data Communications
Table Of Contents
Error Detection
● If transmission lines are in electrically noisy
environment such as PSTN (Public switched
telephone network), the electrical signal
representing the transmitted bit stream may be
changed (corrupted) [affected by EMI, distortion,
thermal noise etc]
Error Detection
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Error Detection
Error Detection
●
Disadvantages of FEC
i The number of additional bits required to achieve
reliable forward error control increase rapidly with the
number of information bits
ii It is also algorithmically more complex than
feedback error control method
●
Feedback error control is therefore the predominant
method used in most of the data communication and
networking systems
● The most common feedback error detection methods
are:
i Parity bit
ii Block (sum) check character (BCC)
iii Cyclic redundancy check (CRC)
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Type of errors
1) Random single errors
2) Burst errors : string of bit errors
• Different techniques detect different types of
errors
• Number of bits used for error detection –
determines burst lengths detected
Figure 1 Single-bit
CHAPTER 4 : Reliable Data Communications
Error detection and correction
BLOCK CODING
13
CHAPTER 4 : Reliable Data Communications
Error detection and correction
14
CHAPTER 4 : Reliable Data Communications
Error detection and correction
15
Example
17
CHAPTER 4 : Reliable Data Communications
Error detection and correction
18
CHAPTER 4 : Reliable Data Communications
Error detection and correction
19
Example
20
21
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
22
Example
23
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
24
Example
Note
27
Example
28
Example
29
CHAPTER 4 : Reliable Data Communications
Error detection and correction
30
CHAPTER 4 : Reliable Data Communications
Error detection and correction
31
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
32
Example
Solution
This code guarantees the detection of up to three errors
(s = 3), but it can correct up to one error. In other words,
if this code is used for error correction, part of its capability is
wasted. Error correction codes need to have an odd minimum
distance (3, 5, 7, . . . ).
33
CHAPTER 4 : Reliable Data Communications
Error detection and correction
34
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
35
Example
36
Example 11
37
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
38
CHAPTER 4 : Reliable Data Communications
Error detection and correction
39
CHAPTER 4 : Reliable Data Communications
Error detection and correction
40
Example
41
Example 12
42
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
43
CHAPTER 4 : Reliable Data Communications
Error detection and correction
44
CHAPTER 4 : Reliable Data Communications
Error detection and correction
45
CHAPTER 4 : Reliable Data Communications
Error detection and correction
46
CHAPTER 4 : Reliable Data Communications
Error detection and correction
47
CHAPTER 4 : Reliable Data Communications
Error detection and correction
48
CHAPTER 4 : Reliable Data Communications
Error detection and correction
49
Example
50
Example
Solution
We need to make k = n − m greater than or equal to 7, or 2m
− 1 − m ≥ 7.
1. If we set m = 3, the result is n = 23 − 1 and k = 7 − 3,
or 4, which is not acceptable.
2. If we set m = 4, then n = 24 − 1 = 15 and k = 15 − 4 =
11, which satisfies the condition. So the code is
C(15, 11)
51
CHAPTER 4 : Reliable Data Communications
Error detection and correction
52
CHAPTER 4 : Reliable Data Communications
Error detection and correction
CYCLIC CODES
Cyclic codes are special linear block codes with one
extra property. In a cyclic code, if a codeword is
cyclically shifted (rotated), the result is another
codeword.
53
CHAPTER 4 : Reliable Data Communications
Error detection and correction
54
CHAPTER 4 : Reliable Data Communications
Error detection and correction
55
CHAPTER 4 : Reliable Data Communications
Error detection and correction
56
CHAPTER 4 : Reliable Data Communications
Error detection and correction
57
CHAPTER 4 : Reliable Data Communications
Error detection and correction
58
CHAPTER 4 : Reliable Data Communications
Error detection and correction
59
CHAPTER 4 : Reliable Data Communications
Error detection and correction
60
CHAPTER 4 : Reliable Data Communications
Error detection and correction
61
CHAPTER 4 : Reliable Data Communications
Error detection and correction
62
CHAPTER 4 : Reliable Data Communications
Error detection and correction
63
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
64
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
In a cyclic code,
If s(x) ≠ 0, one or more bits is corrupted.
If s(x) = 0, either
a. No bit is corrupted. or
b. Some bits are corrupted, but the
decoder failed to detect them.
65
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
66
Example
Solution
a. No xi can be divisible by x + 1. Any single-bit error can
be caught.
b. If i is equal to or greater than 3, xi is divisible by g(x).
All single-bit errors in positions 1 to 3 are caught.
c. All values of i make xi divisible by g(x). No single-bit
error can be caught. This g(x) is useless.
67
CHAPTER 4 : Reliable Data Communications
Error detection and correction
68
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
69
Example
Solution
a. This is a very poor choice for a generator. Any two
errors next to each other cannot be detected.
b. This generator cannot detect two errors that are four
positions apart.
c. This is a good choice for this purpose.
d. This polynomial cannot divide xt + 1 if t is less than
32,768. A codeword with two isolated errors up to
32,768 bits apart can be detected by this generator.
70
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
71
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
72
Example
Solution
a. This generator can detect all burst errors with a length
less than or equal to 6 bits; 3 out of 100 burst errors
with length 7 will slip by; 16 out of 1000 burst errors of
length 8 or more will slip by.
73
Example 17
74
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
75
CHAPTER 4 : Reliable Data Communications
Error detection and correction
76
CHAPTER 4 : Reliable Data Communications
Error detection and correction
CHECKSUM
The last error detection method we discuss here is
called the checksum. The checksum is used in the
Internet by several protocols although not at the
data link layer. However, we briefly discuss it here to
complete our discussion on error checking
77
Example
78
Example
79
Example
Solution
The number 21 in binary is 10101 (it needs five bits). We can
wrap the leftmost bit and add it to the four rightmost bits. We
have (0101 + 1) = 0110 or 6.
80
Example
Solution
In one’s complement arithmetic, the negative or complement of
a number is found by inverting all bits. Positive 6 is 0110;
negative 6 is 1001. If we consider only unsigned numbers, this
is 9. In other words, the complement of 6 is 9. Another way to
find the complement of a number in one’s complement
arithmetic is to subtract the number from 2n − 1 (16 − 1 in this
case).
81
Example
83
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Figure 24 Example
84
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
Sender site:
1. The message is divided into 16-bit words.
2. The value of the checksum word is set to 0.
3. All words including the checksum are
added using one’s complement addition.
4. The sum is complemented and becomes the
checksum.
5. The checksum is sent with the data.
85
CHAPTER 4 : Reliable Data Communications
Error detection and correction
Note
Receiver site:
1. The message (including checksum) is
divided into 16-bit words.
2. All words are added using one’s
complement addition.
3. The sum is complemented and becomes the
new checksum.
4. If the value of checksum is 0, the message
is accepted; otherwise, it is rejected.
86
Example
Figure 25 Example
88
ECP 2056 :
DATACOMMUNICATIONS AND COMPUTER
NETWORKING
FACULTY OF ENGINEERING,
CYBERJAYA
YEAR 2008
CHAPTER 4 : Reliable Data Communications
Table Of Contents
FRAMIN
G
The data link layer needs to pack bits into frames,
so that each frame is distinguishable from another.
Our postal system practices a type of framing. The
simple act of inserting a letter into an envelope
separates one piece of information from another;
the envelope serves as the delimiter.
91
CHAPTER 4 : Reliable Data Communications
92
CHAPTER 4 : Reliable Data Communications
93
CHAPTER 4 : Reliable Data Communications
Note
94
CHAPTER 4 : Reliable Data Communications
95
CHAPTER 4 : Reliable Data Communications
Note
96
CHAPTER 4 : Reliable Data Communications
97
CHAPTER 4 : Reliable Data Communications
98
CHAPTER 4 : Reliable Data Communications
99
CHAPTER 4 : Reliable Data Communications
PROTOCOLS
Now let us see how the data link layer can combine
framing, flow control, and error control to achieve
the delivery of data from one node to another.
The protocols are normally implemented in software
by using one of the common programming
languages.
To make our discussions language-free, we have
written in pseudocode a version of each protocol
that concentrates mostly on the procedure instead
of delving into the details of language rules.
100
CHAPTER 4 : Reliable Data Communications
Flow controls
• Flow control refers to a set of procedures used
to restrict the amount of data that the sender
can send before waiting for acknowledgment.
• It ensures the sending entity does not
overwhelm the receiving entity.This is to
prevent buffer overflow
CHAPTER 4 : Reliable Data Communications
Error Control
• Error control in the data link layer is based on
automatic repeat request, which is the
retransmission of data.
• Mechanism to detect and correct errors occur in
the transmission of frames.
• The possibility of 2 types of errors:
1) Lost frames: A frame fails to arrives at the other side
2) Damaged frames: A recognizable frame does arrive, but
some of the bits are in error (have been altered during
transmission)
CHAPTER 4 : Reliable Data Communications
104
CHAPTER 4 : Reliable Data Communications
NOISELESS CHANNELS
Let us first assume we have an ideal channel in
which no frames are lost, duplicated, or corrupted.
We introduce two protocols for this type of channel.
105
CHAPTER 4 : Reliable Data Communications
106
Example
107
108
Example
109
Figure 9 Flow diagram for Example 11.2
CHAPTER 4 : Reliable Data Communications
NOISY CHANNELS
Although the Stop-and-Wait Protocol gives us an
idea of how to add flow control to its predecessor,
noiseless channels are nonexistent. We discuss
three protocols in this section that use error control.
110
CHAPTER 4 : Reliable Data Communications
Stop-and-Wait ARQ
• This is the simplest flow and error control mechanism.
• In case of retransmission, the sending device keeps a copy of
the last frame transmitted, until it receives an
acknowledgment for that frame.
• For identification purposes, both data and acknowledgment
frames are alternately numbered 0 or 1. This numbering allows
identification and avoid duplications.
• The sender starts a timer when it sends a frame. If
acknowledgment is not received within allotted
time(Timeout), the frame is resend.
• Only positive acknowledgment is sent by receiver as an
indication of frame received. The acknowledgment frame
comes with number that defines the next expected frame.
CHAPTER 4 : Reliable Data Communications
112
Figure 10 Design of the Stop-and-Wait ARQ Protocol
113
Example
114
Figure 11
Flow diagram
for Example 3
Example
116
Example
Solution
The bandwidth-delay product is still 20,000 bits. The system can
send up to 15 frames or 15,000 bits during a round trip. This
means the utilization is 15,000/20,000, or 75 percent. Of course,
if there are damaged frames, the utilization percentage is much
less because frames have to be resent.
117
CHAPTER 4 : Reliable Data Communications
118
CHAPTER 4 : Reliable Data Communications
119
CHAPTER 4 : Reliable Data Communications
120
CHAPTER 4 : Reliable Data Communications
121
Figure 14 Design of Go-Back-N
122
Figure 15 Window size for Go-Back-N
123
Example
125
Example
126
Example 7
127
Figure 17 Flow diagram for Example 11.7
128
CHAPTER 4 : Reliable Data Communications
Note
129
CHAPTER 4 : Reliable Data Communications
130
Figure 20 Design of Selective Repeat
131
Figure 21 Selective Repeat ARQ, window
132
CHAPTER 4 : Reliable Data Communications
133
Example
134
Example 8
135
Example 8
136
Example 8
The next point is about the ACKs. Notice that only two
ACKs are sent here. The first one acknowledges only the
first frame; the second one acknowledges three frames.
In Selective Repeat, ACKs are sent when data are
delivered to the network layer. If the data belonging to n
frames are delivered in one shot, only one ACK is sent
for all of them.
137
Figure 23 Flow diagram for Example 11.8
138
Figure 24 Design of piggybacking in Go-Back-N
139
HDLC
140
Figure 25 Normal response
141
Figure 26 Asynchronous balanced
142
Figure 27 HDLC
143
Figure 28 Control field format for the different frame
144
Table 1 U-frame control command and response
145