SlideShare a Scribd company logo
Error Detection and Correction, Data
link control
Module-3
1
Data can be corrupted during transmission.
For reliable communication, errors must be detected and
corrected.
Types of Error
Single-Bit Error
Burst Error
2
In a single-bit error, only one bit of a given data unit is
changed from 1 to 0 or from 0 to 1.
3
A burst error means that 2 or more bits in the
data unit have changed from 1 to 0 or from 0 to 1.
A burst error does not necessarily mean that the
errors occur in consecutive bits. The length of the burst is
measured from the first corrupted bit to the last corrupted
bit
4
Redundancy
To detect or correct errors we need to send
redundant bits with data.
These redundant bits are added by sender and
removed by receiver.
Error detection uses the concept of redundancy,
which means adding extra bits for detecting errors at the
destination.
5
Redundancy
6
Detection Vs Correction
Error Detection: Process of observing whether error
has occurred or not. We are not even interested in the
number of errors
Correction: The correction of errors is more difficult
than the detection. Finding exact number of bits that
are corrupted and their location. The number of errors
and size of the message are important
7
Forward Error correction
And Retransmission
There are two methods of error correction
Forward error correction: It is the process in which the
receiver tries to guess the message by using redundant
bits.
Correction by retransmission: It is a technique in
which the receiver detects the occurrence of an error and
asks the sender to resend the message.
8
Coding
Redundancy is achieved through various coding
scheme.
The sender adds redundant bits through a process
that creates a relationship b/w the redundant bits and
the actual data bits
The receiver checks the relationship b/w two sets
of bits to detect or correct the errors
Block coding and Convolution coding
9
Structure of encoder and decoder
10
Modular Arithmetic
• Only limited range of integers are used.
• Upper limit N is used-Modulus.
• Allowed integers are 0 to N-1
• In addition and subtraction – carry is ignored
• This operation is similar to XOR operation.
1 0 1 0
1 1 0 0
XOR 0 1 1 0
11
Block Coding
• Message is divided into blocks, each of k bits called
data words.
• r –redundant bits are added to each block to make
length n=k+r
• The resulting n-bit blocks are called code words.
12
Error Detection
Conditions:
• The receiver has list of valid code words
• The original code word has changed to an invalid code words.
• In detection , the receiver needs to know only that the received
code word is invalid
13
Example
• Data words Code words
00 000
01 011
10 101
11 110
Assume sender encodes the data words 01 as 011 and
sends it to receiver, receiver received data 111. find
out error
14
Consider the following cases
1. The receiver receives 011. it is valid codeword. The
receiver extracts the data word 01 from it
2. The code word is corrupted during transmission and
111 is received. This is not a valid code word and it is
discarded
3. The code word is corrupted during transmission and
000 is received. This is a valid code word. The
receiver incorrectly extracts the data word 00
15
• An error-detecting code can detect only the
types of errors for which it is designed; other
types of errors may remain undetected.
16
Error Correction
• The receiver needs to find the original code word sent.
• We need more redundant bits for error correction than
for error detection
17
Table for error correction
Data words Codeword
00 00000
01 01011
10 10101
11 11110
The data word is 01. the sender create the code word
01011. the code word is corrupted during transmission and
01001 is received.
First, the receiver finds that the received code word is not
in the table. This means error has occurred.
18
The receiver uses the following strategy to guess the
correct data word
1. Compare the received code word with the first code word in
the table , the receiver decides that the first code word is not
the one that was sent because there are two different bits
2. By the same reasoning, the original code word can not be the
third or fourth in the table
3. The original code word must be the second one in the table
because this is the only one that differs from the received code
word by 1 bit. The receiver replaces 01001 with 01011 and
consult the table to find the data word 01
19
Hamming Distance
• Hamming distance between two words is the number
of difference between corresponding bits.
• It can easily be found by applying XOR operation on
the two words and count the number of 1s in the
result.
• Example: d(000,011) is 2
20
Minimum Hamming Distance
• It is the smallest hamming distance between all possible pairs in a
set of words.
Find minimum hamming distance between code words:
00 000
01 011
10 101
11 110
d(000,011)=2; d(000,011)=2;
d(000,101)=2; d(000,110)=2
d(011,110)=2; d(101,110)=2
d min is 2
21
10.4 Detection methods
22
Simple Parity Check Code
In this scheme , a k-bit data word is changed to an n-
bit code word where n=k+1.
This extra bit is called parity bit.
The parity bit selected to make the total number of 1‘s
in the codeword even.
A simple parity check code is a single bit error
detecting code in which n=k+1 with dmin=2
23
Simple parity check code –Encoder
• The encoder uses a generator that takes a copy of a 4-
bit data word(a0,a1,a2,a3). It generates a parity bit r0
• Data word bits and the parity bit creates 5-bit
codeword
• The parity bit that is added makes the number of 1s
in the codeword even
• r0=a3+a2+a1+a1 Modulo 2
24
Encoder and Decoder for simple parity check code
25
Simple parity check code –decoder
• The receiver receives a 5-bit word
• The checker performs addition on all 5 bits received.
The result is called syndrome-just 1 bit.
• The syndrome is 0 when the number of 1s in the
received codeword is even ;otherwise it is 1.
• s0=b3+b2+b1+b0+q0 modulo 2
26
Assume the sender sends the dataword 1011. the code word
created from this data word is 10111, which is sent to the
receiver.
1. No error occurs, the received code word is 10111. the syndrome is
0. the data word is created
2. One single bit error changes a1. the received code word is 10011. the
syndrome is 1. no data word is created
3. One single bit error changes r0. the received code word is 10110. the
syndrome is 1. no data word is created
4. An error changes r0 and a second error changes a3. the received code
word is 00110. the syndrome is 0. the data word 0011 is created at the
receiver
5. Three bits a3, a2, a1 are changed by errors. The received code word is
01011. the syndrome is 1. the data word not created.
A simple parity check code can detect an odd number of errors
27
Calculation of row and column
parities
28
Single bit error
29
One
Two errors affects two parities
30
Three errors
31
Four Errors
32
Hamming Codes
• Minimum distance is 3. Expressed as C(n,k); where n=2m-1
• Data words : a3,a2,a1,a0 and Code words : a3,a2,a1,a0,r2,r1,ro
• r0=a2+a1+a0; r1=a3+a2+a1; r3=a1+a0+a3
• Checker in the decoder creates a 3-bit syndrome (s2s1s0); where
s0=b2+b1+b0+q0;s1=b3+b2+b1+q1;s3=b1+b0+b3+q2
Syndrome 000 001 010 011 100 101 110 111
Error None q0 q1 b2 q2 b0 b3 b1
33
Structure of Encoder and Decoder Hamming code
34
• r0=a2+a1+a0 modulo-2
• r1=a3+a2+a1 modulo-2
• r2=a1+a0+a3 modulo-2
• s0=b2+b1+b0+q0 modulo-2
• s1=b3+b2+b1+q1 modulo-2
• s2=b1+b0+b3+q2 modulo-2
35
Let us trace the path of three data word from the sender
to the destination
1. The data word 0100 becomes the code word 0100011. the
code word 0100011 is received. The syndrome is 000, the
final dataword is 0100
2. The data word 0111becomes the codeword 0011001 is
received. The syndrome is 011. according to table b2 is in
error. After flipping b2, the final data word is 0111
3. The dataword 1101 becomes the code word 1101000. the
code word 0001000 is received. The syndrome is 101, which
means that b0 is in error. After flipping b0, we get 0000, the
wrong data word. This shows that our code can not correct
two errors
36
Cyclic Codes
• In this scheme, if a code word is cyclically shifted, the
result is another codeword
• b1=a0;b2=a1;b3=a2;b4=a3;b5=a4;b6=a5;b0=a6.
37
CRC generator and checker
38
CRC
39
Design
40
Binary division in a CRC generator
41
Two cases – with /without Error
42
A polynomial and its representation
43
Table 10.1 Standard polynomials
Name Polynomial Application
CRC-8 x8 + x2 + x + 1 ATM header
CRC-10 x10 + x9 + x5 + x4 + x 2 + 1 ATM AAL
ITU-16 x16 + x12 + x5 + 1 HDLC
ITU-32
x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10
+ x8 + x7 + x5 + x4 + x2 + x + 1
LANs
44
Checksum
45
The sender follows these steps:
•The message is divided into 16-bit words.
•The value of the checksum word is set to 0
•All words including the checksum are added using ones
complement addition
•The sum is complemented and becomes the checksum.
•The checksum is sent with the data.
Internet checksum
the internet has been using a 16-bit checksum. The
sender calculates the checksum by following these steps.
46
The receiver follows these steps:
•The message (including checksum) is divided into 16-
bit words.
•All words are added using one’s complement addition
•The sum is complemented and becomes the new
checksum.
•If the value of checksum is zero, the data are accepted:
otherwise, rejected.
47
Example 7
Suppose the following block of 16 bits is to be sent using a
checksum of 8 bits.
10101001 00111001
The numbers are added using one’s complement
10101001
00111001
------------
Sum 11100010
Checksum 00011101
The pattern sent is 10101001 00111001 00011101
48
Example 8
Now suppose the receiver receives the pattern sent in Example
7 and there is no error.
10101001 00111001 00011101
When the receiver adds the three sections, it will get all 1s,
which, after complementing, is all 0s and shows that there is no
error.
10101001
00111001
00011101
Sum 11111111
Complement 00000000 means that the pattern is OK.
49
Example 9
Now suppose there is a burst error of length 5 that affects 4
bits.
10101111 11111001 00011101
When the receiver adds the three sections, it gets
10101111
11111001
00011101
Partial Sum 1 11000101
Carry 1
Sum 11000110
Complement 00111001 the pattern is corrupted.
50
Let us calculate the checksum for a text of 8 characters
(“Forouzan”). The text needs to be divided into 2-byte (16-
bit) words. For example, F is represented as 0x46 and o is
represented as 0x6F.
51
Figure 10.25 Example 10.23
52
Data Link Control
53
Data link control
Functions:
> Framing
> Flow control
> Error control
> Smooth and reliable transmission of frames
54
• To implement these set of data link protocols
are needed
• Protocols are set of rules that need to be
implemented in software and run by the two
nodes involved in data exchange at the data
link layer.
55
Framing
• Data transmission in physical layer means moving bits in
the form of a signal
• The data link layer needs to pack bits into frames.
• Each frames must be distinguishable
• Framing separates a message from one source to a
destination or from other messages to other destinations,
by adding a sender address and a destination address.
56
Frame types: Fixed size, Variable size
Fixed size
• No need for defining boundaries
• Size itself is the delimiter:
• Ex: ATM network frame
Variable size
• Need to define the end of the frame and the beginning of
the next.
57
Character Oriented protocols
• Data to be carried are 8-bit characters from a coding
system-ASCII
• The header normally carries the source and
destination addresses and other information
• The trailer carries error detection or error correction
redundant bits, are also multiple of 8-bits.
• 1-byte Flag is added at the beginning and end of a
frame. 58
Character-oriented protocol, stuffing, un-stuffing
59
The flag type
• Byte stuffing strategy is used
– A special byte is added to the data section of the
frame when there is a character with the same
pattern as flag.
– This byte is called escape character (ESC)
– Whenever the receiver encounters the ESC
character; it removes it from data section and treats
the next character as data
60
Bit-oriented protocols
• The data section of a frame is a sequence of bits to be
interpreted by the upper layer as text, graphic, audio,
video, etc.
• In addition to header, delimiter is used to separate one
frame from the other
• Usually the pattern flag 01111110 used as the
delimiter.
61
• If the flag pattern appears in the data, we need to
inform the receiver that this is not the end of the
frame
• We do this by stuffing 1 single bit to prevent the
pattern from looking like a flag. The strategy is called
bit stuffing
• In bit stuffing, if a 0 and five consecutive 1 bits are
encountered, an extra 0 is added. This extra stuffed
bit is removed from the data by the receiver
62
Flow and error control
• Flow control refers to a set of procedures used to
restrict the amount of data that the sender can send
before waiting for acknowledgment.
• Error control in the data link layer is based on
automatic repeat request, which is the retransmission
of data.
63
• Connectionless Protocol
• In a connectionless protocol, frames are sent from one node to
the next without any relationship between the frames; each
frame is independent.
• The frames are not numbered and there is no sense of ordering.
• Most of the data-link protocols for LANs are connectionless
protocols.
• Connection-Oriented Protocol
• In a connection-oriented protocol, a logical connection should
first be established between the two nodes (setup phase).
• the frames are numbered and sent in order.
• Ex: wired in LANs, Point to point protocols , Wireless LANs and
wired WANs
64
Protocols
• Noiseless Channel:
– Simplest,
– Stop and Wait
• Noisy Channel:
– Stop and Wait ARQ,
– Go-Back N ARQ,
– Selective Repeat ARQ
* ARQ: Automatic Repeat Request
65
Assumptions, Terminologies
• Data frames travel from one node(sender) to another
node (receiver)
• Some special frames are used: Acknowledgement and
Negative Acknowledgement frames
• These flow in the opposite direction for flow and
error control purposes
• Data flow in only one direction
• Piggybacking: ACK and NAK is included in the data
frames.
66
Noiseless channels-Simplest Protocol
• It has no flow control or error control.
• It is a Uni-directional protocol.
• At sender side: gets data, makes frame, sends
• At receiver side: receives data, extracts data,
delivers data to N/W layer
67
• The sender cannot send until its network layer has a data
to send
• The receiver cannot deliver until a frame arrives.
• Introduce the idea of events in the protocol
• The procedure at the sender site is constantly running: no
action until there is a request from network layer
• The procedure at the receiver site is constantly running:
no action until notification from physical layer
68
Simplest protocol
69
70
Stop and Wait protocol
• Frames must be stored when receives frames faster its
processing capacity.
• There should be some method to slowdown the speed of
sender.
• There must be feedback from the receiver to the sender.
• Sender sends one frame, stops until it receives
confirmation, and then sends next frame.
71
Stop and wait protocol
72
Flow diagram of Simplest protocol
73
Noisy Channels-Stop and Wait Automatic Repeat Request
• It adds a simple error control mechanism to the Stop-and –Wait
protocol.
• It needs to add redundancy bits to data frame. When frames
arrives at the receiver site, it is checked and if it is corrupted, it is
silently discarded
• The corrupted and lost frames need to be resent in this protocol.
• Frames needs to be numbered-using sequence number. Sequence
number must be known size to keep frame size minimum.
74
Sequence number
• The protocol specifies that frames need to be
numbered.
• A field is added to the data frame to hold the
sequence number of that frame
• We want to minimize the frame size, the smallest
range that provides unambiguous communication
• We want x and x+1 sequence numbers
75
• Sequence numbers must be suitable for both data and
acknowledgement frames. It also prevents retaining of
duplicate frames.
• Numbered acknowledgments are needed if an
acknowledgment is delayed and the next frame is lost.
• Acknowledgement frame always announces next
sequences to be received from sender.
• In Stop-and –Wait ARQ, the acknowledgement number
always announces in modulo 2 arithmetic the sequence
number of the next frame expected.
76
77
78
HDLC
High Level Data Link Control (HDLC):
– It is bit-oriented protocol for communication over
point-to-point and multipoint links.
79
Configuration and Transfer Modes
• HDLC provides two common transfer modes that
can be used in different configurations:
– Normal Response Mode (NRM): the station
configuration is unbalanced. We have one
primary station and multiple secondary
stations. A primary station can send
commands, a secondary station can only
respond
– Asynchronous Balanced Mode(ABM): the
configuration is balanced. 80
NRM
NRM is used for both point-to-point and multiple point links.
81
ABM
The link is point-to-point and each station can function as
a primary and a secondary.
82
Frames
• HDLC defines three types of frames:
– Information frames (I-frames)
– Supervisory frames (S-frames)
– Unnumbered frames(u-frames)
Each type of frame serves as an envelope for the
transmission of a different type of message
I-Frame: used to transport user data and control
information relating to user data
S-Frame: used only to transport control information
U-Frame: Reserved for system management
83
HDLC frame types
84
Fields
• Flag field:
– 8-bit sequence, with bit pattern 01111110
– Identifies beginning and end of a frame
– Serves as a synchronization pattern for the receiver
• Address field:
– Contains address of the secondary station
– If primary created the frame: contains to address
– If secondary created the frame: contains from address
– It can be one byte or several byte long depending on
network
– If the address field is only 1 byte, the last bit is always a
1. if the address is more than 1 byte, all bytes but the
last one will end with 0: only the last will end with 1
85
• Control field:
– 1 or 2 byte segment of the frame used for flow and
error control
• Information field:
– Contains the user’s data from network layer or
management information
• FCS: (Frame check sequence)
– Used for error detection
– Can contain either a 2- or 4 byte ITU –T CRC.
86
Control field
• The control field determines the type of
frame and define its functionality
87
Control field for I-frame
• Bit 1: defines the type. If it is 0 then I
• Bit 2-4: called N(S) defines the sequence number of the
frame
• Bit 5: Dual purpose bit P: Poll(0), Final (1)
– Poll frame sent by primary, Final the frame sent by
secondary.
• Bit 6-8: called N(R) corresponds to the
Acknowledgement number
88
Control field for S-frame
• S-frames are used for flow and error control.
This frame does not have information fields. If
the first 2 bits of the control field is 10, this
means the frame is an S-frame.
• The last 3-bits called N(R), corresponds to the
acknowledgement number or NAK
• The 2-bits called code is used to define the type
of S-frame itself
89
• Receive ready(RR): the code subfields is 00, it is an RR
S-frame. This frame acknowledges the receipt of a safe
group of frames. The value of N(R) fields defines the
ACK number
• Receive not ready(RNR): the code subfields is 10, it is
an RNR S-frame. This frame acknowledges the receipt
of a frame or group of frames and it announces that the
receiver is busy and can not receive more frame. The
value of N(R) fields defines the ACK number
90
• Reject (REJ): the code subfields is 01, it is a REJ S-
frame. This is a NAK frame. It is a NAK that can be used
in Go-Back-N ARQ to improve the efficiency of the
process by informing the sender, before the sender time
expires. The value of N(R) fields defines the NCK
number
• Selective reject(SREJ): the code subfields is 11, it is an
SREJ S-frame. This is a NAK frame used in selective
reject instead of selective repeat ARQ. The value of N(R)
fields defines the NCK number
91
Control field for U-frames
Unnumbered frames are used to exchange
session management and control
information b/w connected devices.
U-frame codes are divided into two sections: a
two bit prefix before the P/F bit and a 3-bit
suffix after the P/F bit
92
Table 11.1 U-frame control command and response
Command/response Meaning
SNRM Set normal response mode
SNRME Set normal response mode (extended)
SABM Set asynchronous balanced mode
SABME Set asynchronous balanced mode (extended)
UP Unnumbered poll
UI Unnumbered information
UA Unnumbered acknowledgment
RD Request disconnect
DISC Disconnect
DM Disconnect mode
RIM Request information mode
SIM Set initialization mode
RSET Reset
XID Exchange ID
FRMR Frame reject
93
Point to Point Protocol
• Services:
– Defines the format of the frame to be exchanged between devices
– Defines how two devices can negotiate the establishment of the link
and exchange of data
– Defines how network layer data are encapsulated in the data link layer
– Defines how two devices can authenticate each other
– Provides multiple network layer services supporting a variety of
network layer protocols
– Provides connections over multiple links
– Provides network address configuration
• Missing :
– Does not provide flow control
– Very simple mechanism for error control
– Does not provide a sophisticated addressing mechanism
94
Framing
• Flag: Starts and ends with a 1-byte flag 01111110
• Address: Constant and set to 11111111
• Control: Set to constant value; 11000000
• Protocol: Defines what is being carried in the data field
• Payload field: Carries either user data or other information
• FCS: 2 or 4 byte standard CRC.
95
Transition phases
96
• Dead: In the dead phase the link is not being used
• Establish: Connection goes into this state when one of the
nodes starts the communication
• Authenticate: For authentication purpose; optional
• Network: Negotiation takes place in this phase.
• Open: Data transfer takes place
• Terminate: Connection is terminated in this phase.
97

More Related Content

Similar to 15CS46 - Data communication or computer networks 1_Module-3.ppt (20)

PPT
Ch10
Malik obeisat
 
PPTX
Error detection and correction
Abdul Razaq
 
PPT
Error Detection and Correction
TechiNerd
 
PDF
Error Detection: Computer Networks Chapter 10.pdf
i222510
 
PDF
07 Data Link LayerError Control.pdf
baysahcmjames2kblax
 
PDF
Computer Networks/Computer Engineering.pdf
abdnazar2003
 
PPTX
Lecture8_Error Detection and Correction 232.pptx
MahabubAlam97
 
PPTX
computer networks Module 4.pptx for MCA students
ssuser898779
 
PDF
ch010.pdf111111111111111111111111111111111111111111
subhadipmalakar981
 
PPT
10 Error Detection_and_Correction
Ahmar Hashmi
 
PPT
Ch10
Vivek Kumar
 
PPT
ch10_2_v1.ppt
dlakmlkfma
 
PPT
ch10_2_v1.ppt
dlakmlkfma
 
PPT
5(1)crc-chechsum-hamming.ppt
prashant513130
 
PPT
ch10_2_v1.ppt
dlakmlkfma
 
PPT
hamming code detailed
IKhait
 
PPT
Ch10 2 v1
Dr. Kavita Sharma
 
PPT
ch10_2_v1.ppt
DrDeepakBhatia
 
PPT
ch10 Error Detection and Correction.pptttt
gurpreetk8199
 
PPTX
Wireless digital communication and coding techniques new
Clyde Lettsome
 
Error detection and correction
Abdul Razaq
 
Error Detection and Correction
TechiNerd
 
Error Detection: Computer Networks Chapter 10.pdf
i222510
 
07 Data Link LayerError Control.pdf
baysahcmjames2kblax
 
Computer Networks/Computer Engineering.pdf
abdnazar2003
 
Lecture8_Error Detection and Correction 232.pptx
MahabubAlam97
 
computer networks Module 4.pptx for MCA students
ssuser898779
 
ch010.pdf111111111111111111111111111111111111111111
subhadipmalakar981
 
10 Error Detection_and_Correction
Ahmar Hashmi
 
ch10_2_v1.ppt
dlakmlkfma
 
ch10_2_v1.ppt
dlakmlkfma
 
5(1)crc-chechsum-hamming.ppt
prashant513130
 
ch10_2_v1.ppt
dlakmlkfma
 
hamming code detailed
IKhait
 
ch10_2_v1.ppt
DrDeepakBhatia
 
ch10 Error Detection and Correction.pptttt
gurpreetk8199
 
Wireless digital communication and coding techniques new
Clyde Lettsome
 

More from ranjan317165 (18)

PPT
universal human values L 14 Trust v4.ppt
ranjan317165
 
PPT
Universal human values self and body chapter
ranjan317165
 
PPT
L 13 universal human values Harmony in the Family v4.ppt
ranjan317165
 
PPT
L 20 Mutual Fulfilment in Nature uhv lectures v5.ppt
ranjan317165
 
PPTX
Module 4 Project management by ranjan v.pptx
ranjan317165
 
PPTX
Software Requiremnet analysis module 2.pptx
ranjan317165
 
PPTX
Introduction-to-Programming-Languages.pptx
ranjan317165
 
PPT
Information system securit lecture 1y .ppt
ranjan317165
 
PPTX
C functions with exercise to solve easily.pptx
ranjan317165
 
PPTX
C functions by ranjan call by value and reference.pptx
ranjan317165
 
PPT
L 27 Holistic Technologies v5 universal human values.ppt
ranjan317165
 
PPT
06_PumpingLemma compiler design of chapter 4.ppt
ranjan317165
 
PPT
CS540-2-lecture2 Lexical analyser of .ppt
ranjan317165
 
PPT
atc 3rd module compiler and automata.ppt
ranjan317165
 
PDF
role of lexical parser compiler design1-181124035217.pdf
ranjan317165
 
PPTX
compiler introduction vtu syllabus 1st chapter.pptx
ranjan317165
 
PPT
Ppt on Design engineering which is chapter 9
ranjan317165
 
PPTX
FiniteAutomata_anim.pptx
ranjan317165
 
universal human values L 14 Trust v4.ppt
ranjan317165
 
Universal human values self and body chapter
ranjan317165
 
L 13 universal human values Harmony in the Family v4.ppt
ranjan317165
 
L 20 Mutual Fulfilment in Nature uhv lectures v5.ppt
ranjan317165
 
Module 4 Project management by ranjan v.pptx
ranjan317165
 
Software Requiremnet analysis module 2.pptx
ranjan317165
 
Introduction-to-Programming-Languages.pptx
ranjan317165
 
Information system securit lecture 1y .ppt
ranjan317165
 
C functions with exercise to solve easily.pptx
ranjan317165
 
C functions by ranjan call by value and reference.pptx
ranjan317165
 
L 27 Holistic Technologies v5 universal human values.ppt
ranjan317165
 
06_PumpingLemma compiler design of chapter 4.ppt
ranjan317165
 
CS540-2-lecture2 Lexical analyser of .ppt
ranjan317165
 
atc 3rd module compiler and automata.ppt
ranjan317165
 
role of lexical parser compiler design1-181124035217.pdf
ranjan317165
 
compiler introduction vtu syllabus 1st chapter.pptx
ranjan317165
 
Ppt on Design engineering which is chapter 9
ranjan317165
 
FiniteAutomata_anim.pptx
ranjan317165
 
Ad

Recently uploaded (20)

PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PPTX
Snet+Pro+Service+Software_SNET+Pro+2+Instructions.pptx
jenilsatikuvar1
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PPTX
UNIT DAA PPT cover all topics 2021 regulation
archu26
 
PPTX
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
PPTX
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Snet+Pro+Service+Software_SNET+Pro+2+Instructions.pptx
jenilsatikuvar1
 
Design Thinking basics for Engineers.pdf
CMR University
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
MRRS Strength and Durability of Concrete
CivilMythili
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
UNIT DAA PPT cover all topics 2021 regulation
archu26
 
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
Ad

15CS46 - Data communication or computer networks 1_Module-3.ppt

  • 1. Error Detection and Correction, Data link control Module-3 1
  • 2. Data can be corrupted during transmission. For reliable communication, errors must be detected and corrected. Types of Error Single-Bit Error Burst Error 2
  • 3. In a single-bit error, only one bit of a given data unit is changed from 1 to 0 or from 0 to 1. 3
  • 4. A burst error means that 2 or more bits in the data unit have changed from 1 to 0 or from 0 to 1. A burst error does not necessarily mean that the errors occur in consecutive bits. The length of the burst is measured from the first corrupted bit to the last corrupted bit 4
  • 5. Redundancy To detect or correct errors we need to send redundant bits with data. These redundant bits are added by sender and removed by receiver. Error detection uses the concept of redundancy, which means adding extra bits for detecting errors at the destination. 5
  • 7. Detection Vs Correction Error Detection: Process of observing whether error has occurred or not. We are not even interested in the number of errors Correction: The correction of errors is more difficult than the detection. Finding exact number of bits that are corrupted and their location. The number of errors and size of the message are important 7
  • 8. Forward Error correction And Retransmission There are two methods of error correction Forward error correction: It is the process in which the receiver tries to guess the message by using redundant bits. Correction by retransmission: It is a technique in which the receiver detects the occurrence of an error and asks the sender to resend the message. 8
  • 9. Coding Redundancy is achieved through various coding scheme. The sender adds redundant bits through a process that creates a relationship b/w the redundant bits and the actual data bits The receiver checks the relationship b/w two sets of bits to detect or correct the errors Block coding and Convolution coding 9
  • 10. Structure of encoder and decoder 10
  • 11. Modular Arithmetic • Only limited range of integers are used. • Upper limit N is used-Modulus. • Allowed integers are 0 to N-1 • In addition and subtraction – carry is ignored • This operation is similar to XOR operation. 1 0 1 0 1 1 0 0 XOR 0 1 1 0 11
  • 12. Block Coding • Message is divided into blocks, each of k bits called data words. • r –redundant bits are added to each block to make length n=k+r • The resulting n-bit blocks are called code words. 12
  • 13. Error Detection Conditions: • The receiver has list of valid code words • The original code word has changed to an invalid code words. • In detection , the receiver needs to know only that the received code word is invalid 13
  • 14. Example • Data words Code words 00 000 01 011 10 101 11 110 Assume sender encodes the data words 01 as 011 and sends it to receiver, receiver received data 111. find out error 14
  • 15. Consider the following cases 1. The receiver receives 011. it is valid codeword. The receiver extracts the data word 01 from it 2. The code word is corrupted during transmission and 111 is received. This is not a valid code word and it is discarded 3. The code word is corrupted during transmission and 000 is received. This is a valid code word. The receiver incorrectly extracts the data word 00 15
  • 16. • An error-detecting code can detect only the types of errors for which it is designed; other types of errors may remain undetected. 16
  • 17. Error Correction • The receiver needs to find the original code word sent. • We need more redundant bits for error correction than for error detection 17
  • 18. Table for error correction Data words Codeword 00 00000 01 01011 10 10101 11 11110 The data word is 01. the sender create the code word 01011. the code word is corrupted during transmission and 01001 is received. First, the receiver finds that the received code word is not in the table. This means error has occurred. 18
  • 19. The receiver uses the following strategy to guess the correct data word 1. Compare the received code word with the first code word in the table , the receiver decides that the first code word is not the one that was sent because there are two different bits 2. By the same reasoning, the original code word can not be the third or fourth in the table 3. The original code word must be the second one in the table because this is the only one that differs from the received code word by 1 bit. The receiver replaces 01001 with 01011 and consult the table to find the data word 01 19
  • 20. Hamming Distance • Hamming distance between two words is the number of difference between corresponding bits. • It can easily be found by applying XOR operation on the two words and count the number of 1s in the result. • Example: d(000,011) is 2 20
  • 21. Minimum Hamming Distance • It is the smallest hamming distance between all possible pairs in a set of words. Find minimum hamming distance between code words: 00 000 01 011 10 101 11 110 d(000,011)=2; d(000,011)=2; d(000,101)=2; d(000,110)=2 d(011,110)=2; d(101,110)=2 d min is 2 21
  • 23. Simple Parity Check Code In this scheme , a k-bit data word is changed to an n- bit code word where n=k+1. This extra bit is called parity bit. The parity bit selected to make the total number of 1‘s in the codeword even. A simple parity check code is a single bit error detecting code in which n=k+1 with dmin=2 23
  • 24. Simple parity check code –Encoder • The encoder uses a generator that takes a copy of a 4- bit data word(a0,a1,a2,a3). It generates a parity bit r0 • Data word bits and the parity bit creates 5-bit codeword • The parity bit that is added makes the number of 1s in the codeword even • r0=a3+a2+a1+a1 Modulo 2 24
  • 25. Encoder and Decoder for simple parity check code 25
  • 26. Simple parity check code –decoder • The receiver receives a 5-bit word • The checker performs addition on all 5 bits received. The result is called syndrome-just 1 bit. • The syndrome is 0 when the number of 1s in the received codeword is even ;otherwise it is 1. • s0=b3+b2+b1+b0+q0 modulo 2 26
  • 27. Assume the sender sends the dataword 1011. the code word created from this data word is 10111, which is sent to the receiver. 1. No error occurs, the received code word is 10111. the syndrome is 0. the data word is created 2. One single bit error changes a1. the received code word is 10011. the syndrome is 1. no data word is created 3. One single bit error changes r0. the received code word is 10110. the syndrome is 1. no data word is created 4. An error changes r0 and a second error changes a3. the received code word is 00110. the syndrome is 0. the data word 0011 is created at the receiver 5. Three bits a3, a2, a1 are changed by errors. The received code word is 01011. the syndrome is 1. the data word not created. A simple parity check code can detect an odd number of errors 27
  • 28. Calculation of row and column parities 28
  • 30. Two errors affects two parities 30
  • 33. Hamming Codes • Minimum distance is 3. Expressed as C(n,k); where n=2m-1 • Data words : a3,a2,a1,a0 and Code words : a3,a2,a1,a0,r2,r1,ro • r0=a2+a1+a0; r1=a3+a2+a1; r3=a1+a0+a3 • Checker in the decoder creates a 3-bit syndrome (s2s1s0); where s0=b2+b1+b0+q0;s1=b3+b2+b1+q1;s3=b1+b0+b3+q2 Syndrome 000 001 010 011 100 101 110 111 Error None q0 q1 b2 q2 b0 b3 b1 33
  • 34. Structure of Encoder and Decoder Hamming code 34
  • 35. • r0=a2+a1+a0 modulo-2 • r1=a3+a2+a1 modulo-2 • r2=a1+a0+a3 modulo-2 • s0=b2+b1+b0+q0 modulo-2 • s1=b3+b2+b1+q1 modulo-2 • s2=b1+b0+b3+q2 modulo-2 35
  • 36. Let us trace the path of three data word from the sender to the destination 1. The data word 0100 becomes the code word 0100011. the code word 0100011 is received. The syndrome is 000, the final dataword is 0100 2. The data word 0111becomes the codeword 0011001 is received. The syndrome is 011. according to table b2 is in error. After flipping b2, the final data word is 0111 3. The dataword 1101 becomes the code word 1101000. the code word 0001000 is received. The syndrome is 101, which means that b0 is in error. After flipping b0, we get 0000, the wrong data word. This shows that our code can not correct two errors 36
  • 37. Cyclic Codes • In this scheme, if a code word is cyclically shifted, the result is another codeword • b1=a0;b2=a1;b3=a2;b4=a3;b5=a4;b6=a5;b0=a6. 37
  • 38. CRC generator and checker 38
  • 41. Binary division in a CRC generator 41
  • 42. Two cases – with /without Error 42
  • 43. A polynomial and its representation 43
  • 44. Table 10.1 Standard polynomials Name Polynomial Application CRC-8 x8 + x2 + x + 1 ATM header CRC-10 x10 + x9 + x5 + x4 + x 2 + 1 ATM AAL ITU-16 x16 + x12 + x5 + 1 HDLC ITU-32 x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 LANs 44
  • 46. The sender follows these steps: •The message is divided into 16-bit words. •The value of the checksum word is set to 0 •All words including the checksum are added using ones complement addition •The sum is complemented and becomes the checksum. •The checksum is sent with the data. Internet checksum the internet has been using a 16-bit checksum. The sender calculates the checksum by following these steps. 46
  • 47. The receiver follows these steps: •The message (including checksum) is divided into 16- bit words. •All words are added using one’s complement addition •The sum is complemented and becomes the new checksum. •If the value of checksum is zero, the data are accepted: otherwise, rejected. 47
  • 48. Example 7 Suppose the following block of 16 bits is to be sent using a checksum of 8 bits. 10101001 00111001 The numbers are added using one’s complement 10101001 00111001 ------------ Sum 11100010 Checksum 00011101 The pattern sent is 10101001 00111001 00011101 48
  • 49. Example 8 Now suppose the receiver receives the pattern sent in Example 7 and there is no error. 10101001 00111001 00011101 When the receiver adds the three sections, it will get all 1s, which, after complementing, is all 0s and shows that there is no error. 10101001 00111001 00011101 Sum 11111111 Complement 00000000 means that the pattern is OK. 49
  • 50. Example 9 Now suppose there is a burst error of length 5 that affects 4 bits. 10101111 11111001 00011101 When the receiver adds the three sections, it gets 10101111 11111001 00011101 Partial Sum 1 11000101 Carry 1 Sum 11000110 Complement 00111001 the pattern is corrupted. 50
  • 51. Let us calculate the checksum for a text of 8 characters (“Forouzan”). The text needs to be divided into 2-byte (16- bit) words. For example, F is represented as 0x46 and o is represented as 0x6F. 51
  • 54. Data link control Functions: > Framing > Flow control > Error control > Smooth and reliable transmission of frames 54
  • 55. • To implement these set of data link protocols are needed • Protocols are set of rules that need to be implemented in software and run by the two nodes involved in data exchange at the data link layer. 55
  • 56. Framing • Data transmission in physical layer means moving bits in the form of a signal • The data link layer needs to pack bits into frames. • Each frames must be distinguishable • Framing separates a message from one source to a destination or from other messages to other destinations, by adding a sender address and a destination address. 56
  • 57. Frame types: Fixed size, Variable size Fixed size • No need for defining boundaries • Size itself is the delimiter: • Ex: ATM network frame Variable size • Need to define the end of the frame and the beginning of the next. 57
  • 58. Character Oriented protocols • Data to be carried are 8-bit characters from a coding system-ASCII • The header normally carries the source and destination addresses and other information • The trailer carries error detection or error correction redundant bits, are also multiple of 8-bits. • 1-byte Flag is added at the beginning and end of a frame. 58
  • 60. The flag type • Byte stuffing strategy is used – A special byte is added to the data section of the frame when there is a character with the same pattern as flag. – This byte is called escape character (ESC) – Whenever the receiver encounters the ESC character; it removes it from data section and treats the next character as data 60
  • 61. Bit-oriented protocols • The data section of a frame is a sequence of bits to be interpreted by the upper layer as text, graphic, audio, video, etc. • In addition to header, delimiter is used to separate one frame from the other • Usually the pattern flag 01111110 used as the delimiter. 61
  • 62. • If the flag pattern appears in the data, we need to inform the receiver that this is not the end of the frame • We do this by stuffing 1 single bit to prevent the pattern from looking like a flag. The strategy is called bit stuffing • In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra 0 is added. This extra stuffed bit is removed from the data by the receiver 62
  • 63. Flow and error control • Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment. • Error control in the data link layer is based on automatic repeat request, which is the retransmission of data. 63
  • 64. • Connectionless Protocol • In a connectionless protocol, frames are sent from one node to the next without any relationship between the frames; each frame is independent. • The frames are not numbered and there is no sense of ordering. • Most of the data-link protocols for LANs are connectionless protocols. • Connection-Oriented Protocol • In a connection-oriented protocol, a logical connection should first be established between the two nodes (setup phase). • the frames are numbered and sent in order. • Ex: wired in LANs, Point to point protocols , Wireless LANs and wired WANs 64
  • 65. Protocols • Noiseless Channel: – Simplest, – Stop and Wait • Noisy Channel: – Stop and Wait ARQ, – Go-Back N ARQ, – Selective Repeat ARQ * ARQ: Automatic Repeat Request 65
  • 66. Assumptions, Terminologies • Data frames travel from one node(sender) to another node (receiver) • Some special frames are used: Acknowledgement and Negative Acknowledgement frames • These flow in the opposite direction for flow and error control purposes • Data flow in only one direction • Piggybacking: ACK and NAK is included in the data frames. 66
  • 67. Noiseless channels-Simplest Protocol • It has no flow control or error control. • It is a Uni-directional protocol. • At sender side: gets data, makes frame, sends • At receiver side: receives data, extracts data, delivers data to N/W layer 67
  • 68. • The sender cannot send until its network layer has a data to send • The receiver cannot deliver until a frame arrives. • Introduce the idea of events in the protocol • The procedure at the sender site is constantly running: no action until there is a request from network layer • The procedure at the receiver site is constantly running: no action until notification from physical layer 68
  • 70. 70
  • 71. Stop and Wait protocol • Frames must be stored when receives frames faster its processing capacity. • There should be some method to slowdown the speed of sender. • There must be feedback from the receiver to the sender. • Sender sends one frame, stops until it receives confirmation, and then sends next frame. 71
  • 72. Stop and wait protocol 72
  • 73. Flow diagram of Simplest protocol 73
  • 74. Noisy Channels-Stop and Wait Automatic Repeat Request • It adds a simple error control mechanism to the Stop-and –Wait protocol. • It needs to add redundancy bits to data frame. When frames arrives at the receiver site, it is checked and if it is corrupted, it is silently discarded • The corrupted and lost frames need to be resent in this protocol. • Frames needs to be numbered-using sequence number. Sequence number must be known size to keep frame size minimum. 74
  • 75. Sequence number • The protocol specifies that frames need to be numbered. • A field is added to the data frame to hold the sequence number of that frame • We want to minimize the frame size, the smallest range that provides unambiguous communication • We want x and x+1 sequence numbers 75
  • 76. • Sequence numbers must be suitable for both data and acknowledgement frames. It also prevents retaining of duplicate frames. • Numbered acknowledgments are needed if an acknowledgment is delayed and the next frame is lost. • Acknowledgement frame always announces next sequences to be received from sender. • In Stop-and –Wait ARQ, the acknowledgement number always announces in modulo 2 arithmetic the sequence number of the next frame expected. 76
  • 77. 77
  • 78. 78
  • 79. HDLC High Level Data Link Control (HDLC): – It is bit-oriented protocol for communication over point-to-point and multipoint links. 79
  • 80. Configuration and Transfer Modes • HDLC provides two common transfer modes that can be used in different configurations: – Normal Response Mode (NRM): the station configuration is unbalanced. We have one primary station and multiple secondary stations. A primary station can send commands, a secondary station can only respond – Asynchronous Balanced Mode(ABM): the configuration is balanced. 80
  • 81. NRM NRM is used for both point-to-point and multiple point links. 81
  • 82. ABM The link is point-to-point and each station can function as a primary and a secondary. 82
  • 83. Frames • HDLC defines three types of frames: – Information frames (I-frames) – Supervisory frames (S-frames) – Unnumbered frames(u-frames) Each type of frame serves as an envelope for the transmission of a different type of message I-Frame: used to transport user data and control information relating to user data S-Frame: used only to transport control information U-Frame: Reserved for system management 83
  • 85. Fields • Flag field: – 8-bit sequence, with bit pattern 01111110 – Identifies beginning and end of a frame – Serves as a synchronization pattern for the receiver • Address field: – Contains address of the secondary station – If primary created the frame: contains to address – If secondary created the frame: contains from address – It can be one byte or several byte long depending on network – If the address field is only 1 byte, the last bit is always a 1. if the address is more than 1 byte, all bytes but the last one will end with 0: only the last will end with 1 85
  • 86. • Control field: – 1 or 2 byte segment of the frame used for flow and error control • Information field: – Contains the user’s data from network layer or management information • FCS: (Frame check sequence) – Used for error detection – Can contain either a 2- or 4 byte ITU –T CRC. 86
  • 87. Control field • The control field determines the type of frame and define its functionality 87
  • 88. Control field for I-frame • Bit 1: defines the type. If it is 0 then I • Bit 2-4: called N(S) defines the sequence number of the frame • Bit 5: Dual purpose bit P: Poll(0), Final (1) – Poll frame sent by primary, Final the frame sent by secondary. • Bit 6-8: called N(R) corresponds to the Acknowledgement number 88
  • 89. Control field for S-frame • S-frames are used for flow and error control. This frame does not have information fields. If the first 2 bits of the control field is 10, this means the frame is an S-frame. • The last 3-bits called N(R), corresponds to the acknowledgement number or NAK • The 2-bits called code is used to define the type of S-frame itself 89
  • 90. • Receive ready(RR): the code subfields is 00, it is an RR S-frame. This frame acknowledges the receipt of a safe group of frames. The value of N(R) fields defines the ACK number • Receive not ready(RNR): the code subfields is 10, it is an RNR S-frame. This frame acknowledges the receipt of a frame or group of frames and it announces that the receiver is busy and can not receive more frame. The value of N(R) fields defines the ACK number 90
  • 91. • Reject (REJ): the code subfields is 01, it is a REJ S- frame. This is a NAK frame. It is a NAK that can be used in Go-Back-N ARQ to improve the efficiency of the process by informing the sender, before the sender time expires. The value of N(R) fields defines the NCK number • Selective reject(SREJ): the code subfields is 11, it is an SREJ S-frame. This is a NAK frame used in selective reject instead of selective repeat ARQ. The value of N(R) fields defines the NCK number 91
  • 92. Control field for U-frames Unnumbered frames are used to exchange session management and control information b/w connected devices. U-frame codes are divided into two sections: a two bit prefix before the P/F bit and a 3-bit suffix after the P/F bit 92
  • 93. Table 11.1 U-frame control command and response Command/response Meaning SNRM Set normal response mode SNRME Set normal response mode (extended) SABM Set asynchronous balanced mode SABME Set asynchronous balanced mode (extended) UP Unnumbered poll UI Unnumbered information UA Unnumbered acknowledgment RD Request disconnect DISC Disconnect DM Disconnect mode RIM Request information mode SIM Set initialization mode RSET Reset XID Exchange ID FRMR Frame reject 93
  • 94. Point to Point Protocol • Services: – Defines the format of the frame to be exchanged between devices – Defines how two devices can negotiate the establishment of the link and exchange of data – Defines how network layer data are encapsulated in the data link layer – Defines how two devices can authenticate each other – Provides multiple network layer services supporting a variety of network layer protocols – Provides connections over multiple links – Provides network address configuration • Missing : – Does not provide flow control – Very simple mechanism for error control – Does not provide a sophisticated addressing mechanism 94
  • 95. Framing • Flag: Starts and ends with a 1-byte flag 01111110 • Address: Constant and set to 11111111 • Control: Set to constant value; 11000000 • Protocol: Defines what is being carried in the data field • Payload field: Carries either user data or other information • FCS: 2 or 4 byte standard CRC. 95
  • 97. • Dead: In the dead phase the link is not being used • Establish: Connection goes into this state when one of the nodes starts the communication • Authenticate: For authentication purpose; optional • Network: Negotiation takes place in this phase. • Open: Data transfer takes place • Terminate: Connection is terminated in this phase. 97