+ All Categories
Home > Documents > Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the...

Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the...

Date post: 10-Mar-2020
Category:
Upload: others
View: 4 times
Download: 0 times
Share this document with a friend
110
Module 3 Error Detection and Correction: Introduction Block coding Cyclic codes Checksum Forward error correction Data link control: DLC services Data link layer protocols HDLC, and Point to Point protocol (Framing, Transition phases only).
Transcript
Page 1: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Module 3Error Detection and Correction: IntroductionBlock codingCyclic codesChecksumForward error correctionData link control: DLC servicesData link layer protocolsHDLC, and Point to Point protocol (Framing, Transition phases only).

Page 2: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

1) Describe different types of errors.2) Compare

a) error detection vs error correctionb) Forward error correction vs retransmission

3) Explain error detection and error correction with respect to block coding4) What is the hamming distance ? Find the minimum hamming distance of

the coding scheme shown in the both the tableTable 4.1 Table 4.2

Page 3: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

5) Draw a CRC encoder and Decoder for CRC code with C(7,4) .Also explain how CRC design works with an example and advantages of cyclic code.

6) Define Internet checksum? List the steps undertaken by sender and receiver for error detection with an example.

7) Write the frame format for point to point protocol (PPP)and explain transition phase for point to point protocol(PPP).

8) Define HDLC and its categories.Explain different frame types in HDLC and control fields in HDLC frame format.

Page 4: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.4

Data can be corrupted during transmission.

Some applications require that errors be detected and corrected.

Note

Page 5: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.5

INTRODUCTIONINTRODUCTION

Types of ErrorsRedundancyDetection Versus CorrectionForward Error Correction Versus RetransmissionCodingModular Arithmetic

Topics discussed in this section:Topics discussed in this section:

Page 6: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Types of errors

• Whenever bits flow from one point to another, they are subject to unpredictable changes because of interference.

• This interference can change the shape of the signal.• There are two types of errors1) Single bit error2) Burst error

Page 7: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Single bit error

•In a single bit error, only 1 bit in the data unit haschanged i.e from 0 to 1 and1 to 0.•In the fig 00000010 wassent, meaning start oftext but 00001010 wasreceived , meaning linefeed.•Single bit error are in serialdata transmission. Noisehave duration of about1Micro sec which is veryrare.

Page 8: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Burst error

•A burst error means that 2 or more bits in the data unit have changed i.efrom 0 to 1 and 1 to 0.•In the fig 0100010001000011 was sent, but 0101110101100011 was received.•The duration of noise is normally longer than the duration of 1 bit , which means noise affects the data

Page 9: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Redundancy•To detect or correct errors , we need to send extra (redundant ) bits with data.•These redundant bits are added by sender and removed by receiver.•Their presence allows the receiver to detect or correct corrupted bits.

Page 10: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Detection Versus Correction

•In error detection we are looking only to see if any error has occurred.•The answer is simple yes or no.•We are not interested in the number of errors.

• Error correction is more difficult than detection.

• Here we need to know the exact number of bits that are corrupted and more importantly , their location in the message.

• The number of errors and size of message is important factors

Page 11: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Forward Error Correction Versus Retransmission

•There are two methods for error correction.• Forward error correction is the process in which the receiver tries to guess message by using redundant bits .• This is possible , if the number of errors is small.

• Retransmission is a technique in which the receiver detects the occurrence of an error and asks the sender to resend the message .• Resending is repeated , until receiver believes error free.(usually not all errors can be detected)

Page 12: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Coding•Redundancy is achieved through various coding schemes.•The sender adds redundant bits through a process that creates a relationship between the redundant bits and actual bits.•The ratio of redundant bits to the data bits and robustness of the process are important factors•Coding scheme is divided into two categories1) Block coding2) Convolution coding

Page 13: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Modular arithmetic•In modular arithmetic we use only the integers in the range 0 to N-1.•For ex if the modulus is 12 we use only the integers 0 to 11 inclusive.•An example of modulo arithmetic is our clock system, substituting number 12 for 0.•If we start our job at 11 A.M and job takes 5hr, job is finished at 16:00•If we are in military , we can say job finished at 4 p.m(i.e 16/12=4)

Page 14: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.14

1010--2 BLOCK CODING2 BLOCK CODING

InIn blockblock coding,coding, wewe dividedivide ourour messagemessage intointo blocks,blocks,eacheach ofof kk bits,bits, calledcalled datawordsdatawords.. WeWe addadd rr redundantredundantbitsbits toto eacheach blockblock toto makemake thethe lengthlength nn == kk ++ rr.. TheTheresultingresulting nn--bitbit blocksblocks areare calledcalled codewordscodewords..

Error DetectionError CorrectionHamming DistanceMinimum Hamming Distance

Topics discussed in this section:Topics discussed in this section:

Page 15: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.15

Figure 10.5 Datawords and codewords in block coding

Page 16: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Error Detection• The sender creates codewords

out of data words by using generator .

• Each codeword sent to the receiver may change during transmission.

• If the received codeword is same as one of the valid codeword ,the word is accepted.

• If the received codeword is not valid, it is discarded.

• If codeword is corrupted during transmission,but received word still matches, the error remains undetected.

• It detects single error, but two or more errors remains undetected

Page 17: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.17

Let us assume that k = 2 and n = 3. Table 10.1 shows thelist of datawords and codewords. Later, we will see howto derive a codeword from a dataword.

Example 10.2

Page 18: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.18

Assume the sender encodes the dataword 01 as 011 andsends it to the receiver. Consider the following cases:

1. The receiver receives 011. It is a valid codeword. Thereceiver extracts the dataword 01 from it.

2. The codeword is corrupted during transmission, and111 is received. This is not a valid codeword and isdiscarded.

3. The codeword is corrupted during transmission, and000 is received. This is a valid codeword. The receiverincorrectly extracts the dataword 00. Two corruptedbits have made the error undetectable.

Example 10.2 (continued)

Page 19: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Error Correction• Error correction is much more

difficult than error detection.• In error correction receiver

needs to find original codeword sent.

• We need more redundant bits for error correction than error detection.

Page 20: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.20

Let us add more redundant bits to Example 10.2 to see ifthe receiver can correct an error without knowing whatwas actually sent. We add 3 redundant bits to the 2-bitdataword to make 5-bit codewords. Table 10.2 shows thedatawords and codewords. Assume the dataword is 01.The sender creates the codeword 01011. The codeword iscorrupted during transmission, and 01001 is received. First,the receiver finds that the received codeword is not in thetable. This means an error has occurred. The receiver,assuming that there is only 1 bit corrupted, uses thefollowing strategy to guess the correct dataword.

Example 10.3

Page 21: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.21

1. Comparing the received codeword with the firstcodeword in the table (01001 versus 00000), thereceiver decides that the first codeword is not the onethat was sent because there are two different bits.

2. By the same reasoning, the original codeword cannot bethe third or fourth one in the table.

3. The original codeword must be the second one in thetable because this is the only one that differs from thereceived codeword by 1 bit. The receiver replaces 01001with 01011 and consults the table to find the dataword01.

Example 10.3 (continued)

Page 22: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.22

Table 10.2 A code for error correction (Example 10.3)

Page 23: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

The Hamming distance between two words is the number of differences

between corresponding bits.

Note

Page 24: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Let us find the Hamming distance between two pairs ofwords.

1. The Hamming distance d(000, 011) is 2 because

Example 10.4

2. The Hamming distance d(10101, 11110) is 3 because

Page 25: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

The minimum Hamming distance is the smallest Hamming distance between

all possible pairs in a set of words.

Note

Page 26: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Find the minimum Hamming distance of the codingscheme in Table 10.1.

SolutionWe first find all Hamming distances.

Example 10.5

The dmin in this case is 2.

Page 27: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Find the minimum Hamming distance of the codingscheme in Table 10.2.

SolutionWe first find all the Hamming distances.

The dmin in this case is 3.

Example 10.6

Page 28: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

1010--4 CYCLIC CODES4 CYCLIC CODES

CyclicCyclic codescodes areare specialspecial linearlinear blockblock codescodes withwith oneoneextraextra propertyproperty.. InIn aa cycliccyclic code,code, ifif aa codewordcodeword isiscyclicallycyclically shiftedshifted (rotated),(rotated), thethe resultresult isis anotheranothercodewordcodeword..

Page 29: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Table 10.6 A CRC code with C(7, 4)

Page 30: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Figure 10.14 CRC encoder and decoder

Page 31: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• In the encoder the data word has k bits(4 here); the codeword has n bits (7 here).

• The size of dataword is augmented by adding n-k(3 here) 0s to the right hand side of the word.

• n bit result is fed to the generator. The generator uses divisor size n-k+1( 4 here).

• The generator divides augmented dataword by the divisor(modulo 2 division).

• The quotient of the division is discarded, the remainder is appended to dataword to create codeword

• The decoder receives corrupted codeword.

• A copy of all n bits is fed to the checker which is replica of generator.

• The remainder produced by checker is a syndrome of n-k( 3 bits) which is fed to decision logic analyzer.

• If syndrome bits are all 0s, the 4 leftmost bits of the codeword are accepted, otherwise 4 bits are discarded

Page 32: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Figure 10.15 Division in CRC encoder

Page 33: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Figure 10.16 Division in the CRC decoder for two cases

Page 34: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Polynomial• A pattern of 0s and 1s can be represented as a polynomial with

coefficient of 0 and 1.• The power of term represents shows the position of bit; coefficient

shows the value of bit.Degree of polynomialThe degree of polynomial is the highest power in the polynomialEx: X6 + X + 1 is 6Adding and Subtracting polynomialAddition and subtraction are same, adding or subtracting is done by

combining terms and deleting pairs of identical termsEx X5 + X4 + X2 and X6 + X4 + X2 Gives just X6 + X5

Multiplying or Dividing termsWe add powers for multiplying: X3 x X4 is X7

We subtract powers for division X5 / X2 = X3

Page 35: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Figure 10.21 A polynomial to represent a binary word

Page 36: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Figure 10.22 CRC division using polynomials

Page 37: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

The divisor in a cyclic code is normally called the generator polynomial

or simply the generator.

Note

Page 38: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Cyclic Code Analysis• We can analyze a cyclic code to find its capabilities by using

polynomial. We define the following where f(x) is a polynomial with binary coefficients.

• Dataword:d(x) Codeword:c(x)• Generator:g(x) Syndrome:s(x)• Error:e(x)

Page 39: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

In a cyclic code,If s(x) ≠ 0, one or more bits is corrupted.If s(x) = 0, either

a. No bit is corrupted. orb. Some bits are corrupted, but the

decoder failed to detect them.

Note

Page 40: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• The relationship among the sent codeword, error, received codeword is Received codeword= c(x) + e(x)

• In other words the received codeword is sum of sent codeword and the error. The receiver divides the received codeword by g(x) to get the syndrome.

Received codeword = c(x) + e(x)g(x) g(x) g(x)

Advantages of cyclic codes1) Easily implemented in hardware and software.2) Cyclic codes are faster when implemented in hardware.3) It give good performance in detecting single bit errors, double

errors an odd number of errors and burst errors.

Page 41: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Table 10.7 Standard polynomials

Page 42: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

CHECKSUM• It is one of the error detection method.• It is used in the Internet by several protocols.

Page 43: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

Suppose our data is a list of five 4-bit numbers that wewant to send to a destination. In addition to sending thesenumbers, we send the sum of the numbers. For example, ifthe set of numbers is (7, 11, 12, 0, 6), we send (7, 11, 12, 0,6, 36), where 36 is the sum of the original numbers. Thereceiver adds the five numbers and compares the resultwith the sum. If the two are the same, the receiverassumes no error, accepts the five numbers, and discardsthe sum. Otherwise, there is an error somewhere and thedata are not accepted.

Example 10.18

Page 44: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

We can make the job of the receiver easier if we send thenegative (complement) of the sum, called the checksum.In this case, we send (7, 11, 12, 0, 6, −36). The receiver canadd all the numbers received (including the checksum). Ifthe result is 0, it assumes no error; otherwise, there is anerror.

Example 10.19

Page 45: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

How can we represent the number 21 in one’scomplement arithmetic using only four bits?

SolutionThe number 21 in binary is 10101 (it needs five bits). We can wrap the leftmost bitand add it to the four rightmost bits. We have (0101 + 1) = 0110 or 6.

Example 10.20

Page 46: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

How can we represent the number −6 in one’scomplement arithmetic using only four bits?

SolutionIn one’s complement arithmetic, the negative or complement of a number is found byinverting all bits. Positive 6 is 0110; negative 6 is 1001. If we consider only unsignednumbers, this is 9. In other words, the complement of 6 is 9.

Example 10.21

Page 47: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 48: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

INTERNET CHECKSUM

• 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 thechecksum.• 5. The checksum is sent with the data.

Page 49: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

10.

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.

Note

Page 50: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Data Link Control• Framing• Error and Flow control• Protocols

Page 51: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

FRAMING • Data transmission in the physical layer means moving bits in the

form of a signal from the source to the destination.• The data link layer, on the other hand, needs to pack bits into

frames, so that each frame is distinguishable from another.• Although the whole message could be packed in one frame, that is

not normally done.• When a message is carried in one very large frame, even a single-bit

error would require the retransmission of the whole message.• Frames can be of fixed or variable size.• In fixed-size framing, there is no need for defining the boundaries

of the frames. (ATM)• Variable-Size Framing, In variable-size framing, we need a way to

define the end of the frame and the beginning of the next. Two typesto represent frame.

• Character-Oriented Protocols• Bit-Oriented Protocols

Page 52: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Character-Oriented Protocols • To separate one frame from the next, an 8-bit (1-byte) flag is added

at the beginning and the end of a frame.

• Any pattern used for the flag could also be part of the information.

• The data section is stuffed with an extra byte. This byte is usually

called the escape character (ESC).

• In byte stuffing (or character stuffing), a special byte is added to the

data section of the frame when there is a character with the same

pattern as the flag.

• Whenever the receiver encounters the ESC character, it removes it

from the data section and treats the next character as data, not a

delimiting flag.

Page 53: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 54: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Bit-Oriented Protocols

• Most protocols use a special 8-bit pattern flag 01111110 as the

delimiter to define the beginning and the end of the frame, as

shown in Figure

Page 55: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• This flag can create the same type of problem we saw in the byte-

oriented protocols.

• Bit stuffing is the process of adding one extra 0 whenever five

consecutive 1s occur.

• So that the receiver does not mistake the pattern 01111110 for a flag.

Page 56: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 57: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 58: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

FLOW AND ERROR CONTROL • Data communication requires at least two devices working

together, one to send and the other to receive.• Even such a basic arrangement requires a great deal of

coordination for an intelligible exchange to occur.• The most important responsibilities of the data link layer are flow

control and error control. Collectively, these functions are knownas data link control.

Page 59: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Flow Control • In most protocols, flow control is a set of procedures that tells the

sender how much data it can transmit before it must wait for an

acknowledgment from the receiver.

• Any receiving device has a limited speed & limited amount of

memory to store incoming data.

• The flow of data must not be allowed to overwhelm the receiver.

• Each receiving device has a block of memory, called a buffer,

reserved for storing incoming data until they are processed.

• If the buffer begins to fill up, the receiver must be able to tell the

sender to halt transmission until it is once again able to receive

Page 60: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Error Control• Error control is both error detection and error correction.• In the data link layer, the term error control refers primarily to

methods of error detection and retransmission.• Any time an error is detected in an exchange, specified frames are

retransmitted. This process is called automatic repeat request(ARQ).

Page 61: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

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 onenode to another.

• To make our discussions language-free, we have written inpseudocode.

Page 62: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 63: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Simplest protocol• Our first protocol which we call is simplest protocol,which has

no flow or error control.• It is a unidirectional protocol in which data frames are

travelling in only one direction- from the sender to receiver.• Design• The data link layer at the sender site gets data from its network

layer, makes a frame out of the data and sends it• The data link layer at receiver site receives a frame from its

physical layer , extracts data from the frame and delivers datato its network layer

• The data link layer of sender and receiver provide transmissionservices for their network layer

• The sender site cannot send a frame until its network layer hasa data packet to send.

• The receiver site cannot deliver a data packet to its networklayer until frame arrives

Page 64: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• Here we introduce idea of events in protocol.• The procedure at sender site is constantly running, but there is

no action until there is a request from network layer.• The procedure at receiver site is also constantly running, but

there is no action until notification from the physical layerarrives.

• Both procedures are constantly running.

Page 65: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Design

Page 66: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Algorithms

Page 67: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 68: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 69: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Stop and Wait Protocol• The protocol in which sender sends one frame and then waits for an

acknowledgement before proceeding are called stop and wait.

• We still have unidirectional communication for data frames, but

auxiliary ACK frames (simple tokens of acknowledgment) travel

from the other direction.

• We add flow control to our previous protocol.

• At the sender site:

1)Two events occur:a request from network layer or arrival notification

from physical layer.The responses to these events must alternate.

2) We know two arrival events cannot happen one after another because

channel is error free and does not duplicate frames.

3) We have used canSend variable that can be either true or false

Page 70: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

4) When a frame is sent the variable is set to false to indicate that a new network request cannot be sent until canSend is true.

5) When ACK is received , canSend is set to true to allow sending of next frame.

At receiver site1) The event here is arrival of data frame.2) After event occurs the data link layer receives the frame from

physical layer using ReceiveFrame() process 3) ReceiveFrame extracts data from the frame using

ExtractData() process and delivers the data to the network layer using DeliverData() process.

Page 71: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Design

Page 72: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 73: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 74: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Stop and WaitFigure 10-10

Page 75: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

NOISY CHANNELS• Stop-and-Wait Protocol gives us an idea of how to add flow

control to its predecessor.

• We need to add error control to our protocols. We discuss three

protocols in this section that use error control.

1. Stop and Wait ARQ

2. Go Back N ARQ

3. Selective Repeat ARQ

Page 76: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Stop and Wait ARQ• Our first protocol, called the Stop-and-Wait Automatic Repeat Request(Stop-and Wait ARQ), adds a simple error control mechanism to the Stop-and-Wait Protocol.• When the frame arrives at the receiver site, it is checked and if frame iscorrupted, it is silently discarded.• The detection of errors in this protocol is manifested by the silence of thereceiver.• Error correction in Stop-and-Wait ARQ is done by keeping a copy of thesent frame and retransmitting of the frame when the timer expires.• Sequence Numbers• Frames need to be numbered.• This is done by using sequence numbers. A field is added to the dataframe to hold the sequence number of that frame.

Page 77: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

•assume that the sender has sent the frame numbered x. Threethings can happen.1. The frame arrives safe and sound at the receiver site; the receiversends an acknowledgment numbered x + 1.2. The frame arrives safe and sound at the receiver site; the receiversends an acknowledgment, but the acknowledgment is corrupted orlost. The sender resends the frame(numbered x) after the time-out. Notethat the frame here is a duplicate..3. The frame is corrupted or never arrives at the receiver site; thesender resends the frame (numbered x) after the time-out.Acknowledgment numberIn Stop and Wait ARQ , the acknowledgment number alwaysannounces in modulo 2 arithmetic the sequence number of the nextframe expected.For exampleIf frame 0 has arrived safe and sound , the receivet sends an ACK framewith acknowlegment 1 .If frame 1 has arrived safe and sound , the receivet sends an ACK framewith acknowlegment 0

Page 78: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Design of Stop and Wait ARQ• The sending device keeps a copy oflast frame transmitted until it receivesan acknowledgment for that frame.• Data frame uses seqno(sequencenumber) an ACK frame uses anackNo(acknowledgment).• The sender has a control variablewhich we call Sn (Sender next frameto send),that holds sequence numberfro the next frame to be sent(0 or 1)•When the frame is sent Sn isincremented (1-0 or 0-1).•Three events occur at the sender site.•The variable Sn points to slots thatmatches the sequence number of theframe that has been sent

• The Receiver has a control variable which we call Rn(Receiver next frame to send),that holds sequence number for the next frame to be expected.

• When the received the value of Rnis incremented (1-0 or 0-1).

• One events occur at the receiver site.

• The Rn points to the slot that matches the sequence number of the expected frame.

Page 79: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Design

Page 80: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 81: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 82: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Flow diagram

Page 83: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Pipelining• In networking and in other areas, a task is often begun before the

previous task has ended. This is known as pipelining.

• There is no pipelining in Stop-and-Wait ARQ because need to wait

for a frame to reach the destination and be acknowledged before the

next frame can be sent.

Page 84: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Go-Back-N ARQ• Go-Back-N uses the sliding window flow control.• In this protocol we can send several frame before receivingacknowledgment ; we keep copy of these frames until the acknowledgmentarrives.• Additional features of Go-Back-NSequence number:• Frames from sending station are numbered sequentially.• We include sequence number of each frame in the header.• Ex:If k is number of bits for sequence number then numbering canrange from 0 to 2K-1.If K=3 sequence numbers from 0 to 7.Sending sliding window:• Window is set of frames in buffer waiting for acknowledgment.•This window keeps on sliding in forward direction.Window size is fixed.•As ACK is received , the respective frame goes out of window and newframe come into window.

Page 85: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 86: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Receiver sliding window:• In receiver side size of window is always one.• The receiver is expecting to arrive frame in specific sequence.• Any frame which is received which is out of order is discarded.• The receiver slides over after receiving the expected frame.Timer:• The sender has a timer for each transmitted frame . The receiverdon’t have any timer.Acknowledgment• The receiver sends a positive acknowledgment if a frame has arrivedsafe and sound and in order.•If frame is damaged or out of order, the receiver is silent and discardsall silent frame.

Resending a frameWhen timer expires , the sender resends all outstanding frames.

Page 87: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 88: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• Size for send & receive window size•The size of the send window must be less than 2m. As an example, wechoose m =2, which means the size of the window can be 2m - 1, or 3.

•The receive window is an imaginary box of size 1 with one singlevariable Rn. The window slides when a correct frame has arrived;sliding occurs one slot at a time.

Page 89: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Selective Repeat Automatic Repeat Request•Go-Back-N ARQ simplifies the process at the receiver site but theresending uses up the bandwidth and slows down the transmission.

•For noisy links, there is another mechanism that does not resend Nframes when just one frame is damaged; only the damaged frame isresent. This mechanism is called Selective Repeat ARQ.

•It is more efficient for noisy links, but the processing at the receiver ismore complex.

• Windows

Page 90: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

•The Selective Repeat Protocol also uses two windows: a send windowand a receive window.

•However, there are differences between the windows in this protocoland the ones in Go-Back-N.

•First, the size of the send window is much smaller; it is 2m- 1.

•Second, the receive window is the same size as the send window.

•The send window maximum size can be 2m- 1 .

•For example, if m = 4, the sequence numbers go from 0 to 15, but thesize of the window is just 8

• The smaller window size means less efficiency in filling the pipe, butthe fact that there are fewer duplicate frames can compensate for this.

•In send window frames arrive out of order and can be stored until theyare delivered

Page 91: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

•The receive window in Selective Repeat is totally different from onein Go-Back-N

•the size of receive window is the same size as the send window.

•Receiver window never delivers frame out of order.

Page 92: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3
Page 93: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Selective RejectFigure 10-22

Page 94: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

High–level Data Link Control(HDLC)• It is a bit oriented protocol for communication

over point to point and multipoint links.• Configuration and Transfer Modes

HDLC

Normal Response Mode

Asynchronous mode

Page 95: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Normal Response Mode(NRM)

In NRM station is unbalanced.We have one primary station and multiple secondary station.A primary station can send commands ;Secondary station can only respond.

Page 96: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Asynchronous Balanced mode

In asynchronous balanced mode , the configuration is balanced.The link is point to point and each station can function as a primary and a secondary

Page 97: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Frames:HDLC defines three types of frame1) Information frames(I- frame)2) Supervisory frames(S- frame)3) Unnumbered frames(U-frames)Frame format

Page 98: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Figure 11-16-continued

HDLC Frame Types

Page 99: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Figure 11-16

HDLC Frame Types

Page 100: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Figure 11-16-continued

HDLC Frame Types

Page 101: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• Flag field:It is a 8 bit sequence with bit pattern 01111110 that identifies beginning and end of frame.

• Address field:It contains address of primary and secondary station, if primary station created frame, it contains to address; if secondary station created frame , it contains from address.

• Control field: It is used for flow and error control.• Information field: It contains user data from network layer• FCS field: It is used for error detection.

Page 102: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Control field format for different frame types

Page 103: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• Control field for I frame• Information frame carries data from the network layer and

includes flow and error control information.• First bit defines type, if it is 0 , means this is an I frame.• the next 3 bits called N(S), define sequence number of the

frame between 0 to 7.• The last 3 bits called N(R) correspond to acknowledgment

number• P/F it is a single bit means poll or final.Poll means frame sent by primary to secondary station.Final means frame sent by secondary to primary station.

Page 104: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• Control field for S frame• Supervisory frames are used for flow and error control• If first two bits of control field is 10 , means frame is an S

frame.• The last 3 bits called N(R) correspond to acknowledgment

number (ACK) or negative acknowledgment number(NAK)• The 2 bits called code used to define type if S frame1) Receive Ready(RR)2) Receive nor ready(RNR)3) Reject(REJ)4) Selective reject(SREJ)

Page 105: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• Control field for U frame• Unnumbered frame used to exchange session management and

control information between connected device.• Code contains much of information , which is divided into two

section 2 bit prefix before P/F bit and 3 bit suffix after P/F bit

Page 106: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Point to Point protocol• HDLC is a general protocol that can be used for both point to

point and multipoint configuration.• One of the most common protocol for point to point access is

point to point protocol• Services:• PPP defines format of the frame exchanged between devices.• PPP defines how two devices can negotiate the establishment of

the link and exchange of data.• PPP defines how network layer data are encapsulated in the data

link frame.• PPP defines how two devices can authenticate each other.• PPP provides connections over multiple links.• PPP provides network address configuartion.

Page 107: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• On other hand some of services are missing• PPP does not provide flow control.• PPP has very simple mechanism for error control.• PPP does not provide sophisticated addressing mechanism to

handle frames in multipoint configuartion.• Frame format:

Page 108: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

• Flag: It starts and ends with 1 byte flag with pattern 01111110, because PPP is byte oriented protocol.

• Address: It is a constant value and set to 11111111.• Control: It is also constant value and set to 11000000.• Protocol: It defines what is being carried in the data field :

either user data or other information.• Payload: It carries either data or other information.• FCS: Frame check sequence is a 2 byte or 4 byte standard

CRC

Page 109: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Transition phases• Dead: In the dead phase the link is not being used.• Establish: When one of the nodes starts the communication,

the connection goes into this phase.In this phase options are negotiated between the two parties

• Authenticate:The authentication phase is optional; the two nodes may decide ,during establishment phase, not to skip this phase.If result is successful, the connection goes to networking phase otherwise it goes to termination phase.

• Network: Here negotiation for the network layer protocols takes place.

• Open: Here data transfer takes place. When connection reaches this phase , the exchange of data packets can be started

• Terminate:In this phase connection is terminated.

Page 110: Module 3 - siet.secab.org 3 ppt.pdf · •In the encoder the data word has k bits(4 here); the codeword has n bits (7 here). • The size of dataword is augmented by adding n-k(3

Recommended