computer networks ms. mrinmoyee mukherjee assistant professor st. francis institute of technology,...

32
COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

Upload: karen-long

Post on 13-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

COMPUTER NETWORKS

Ms. Mrinmoyee MukherjeeAssistant Professor

St. Francis Institute of Technology,Mount Poinsur, S.V.P Road, Borivli

(west),Mumbai- 400103

Page 2: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

DATA LINK LAYER

Page 3: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

1. Transfer data from the network layer of one machine to the network layer of another machine

2. Converts the raw bit streams of physical layer into groups of bits called as ‘FRAMES’

MAIN TASK OF DLL

Page 4: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

??Why do we require any kind of control

1. Frame Synchronization- The beginning and end of data block should be recognizable

2. Flow Control-The sender should not send frames at a rate faster than the receiver can receive and process them

3. Error Control- Any bit error introduced by the transmission system should be corrected

4. Addressing- On a multipoint link, the identity of the sender and receiver must be specified

5. Reliable delivery between adjacent nodes

The services can be provided through-

a. Unacknowledged Connectionless Service

b. Acknowledged Connectionless Service

c. Acknowledged Connection-oriented Service

SERVICES PROVIDED BY DLL

Page 5: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

SERVICES PROVIDED BY DLL

Placement of the data link protocol.

Page 6: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

FRAMING BY DLL

Translates the physical layer raw bit stream into discrete units called frames.

?? How can the receiver detect frame boundary…i.e the start and end of a frame

There are basically three methods of framing1. Length Character Count2. Bit Stuffing3. Byte Stuffing (Character Stuffing Protocol)

Page 7: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

LENGTH COUNT

Page 8: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

BIT STUFFING.. (FIG1)

Page 9: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

BIT STUFFING (FIG 2)

Page 10: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

BYTE STUFFING (FIG 2)

Page 11: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

TYPES OF ERROR

(A) Single bit error

(B) Burst Errors

ERROR DETECTION AND CORRECTION

Page 12: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

ERROR DETECTION vs CORRECTION

Detection- 1.We are only interested in looking if any error has occurred or not. The simple answer to this question is YES/NO2.We are not even interested in knowing the number of corrupted bits

Correction-1. We need to know the exact no of bits that are corrupted.2. The number of errors and size of message are important

factors.3. We also need to know the location of corrupted bits.

Page 13: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

ERROR DETECTION vs CORRECTION

Errors in the received frames are detected by means of –

1. Parity Check and CRC (Cyclic Redundancy Check). 2. In both scenario, few extra bits are sent along with actual data to confirm that bits received at other end are same as they were sent. If the checks at receiver’s end fails, the bits are corrupted.

In digital world, error correction can be done in two ways-

1. Backward Error Correction:  When the receiver detects an error in the data received, it requests back the sender to retransmit the data unit.2. Forward Error Correction:  When the receiver detects some error in the data received, it uses an error-correcting code, which helps it to auto-recover and correct some kinds of errors.

Page 14: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

LINEAR BLOCK CODES

1. In BLOCK CODES , message is divided into blocks of ‘k bits’ called as data words.2. ‘r ‘ redundant bits are added to it to get n=r+k3. With k bits it is possible to get datawords4. With n bits it is possible to get codewords5. Since n>k , the number of possible code-words is always larger than the no of possible data-words.6. The block coding process is one-to-one- the same data-word is always encoded as the same code-word7. This means that we have - ) code-words that are not used.8. We call this code-words invalid or illegal.9. The trick in error detection is the existence of these code-words.10.If the receiver receives an invalid code word, it indicates that the data

was corrupted during transmission

Page 15: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

10.

Almost all block codes used today belong to a subset called linear block codes. A linear block code is a code in which the exclusive OR (addition modulo-2) of two valid code-words creates another valid codeword.

Page 16: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

BLOCK CODES-

How can errors be detected using block codes-1. If the receiver has a list of valid code-words.2. The original code-word has changed to an invalid one.

Page 17: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

CENTRAL CONCEPTS-Hamming Distance

1. The HAMMING DISTANCE between the two words (of the same size) is the number of differences between the corresponding bits.

2. The hamming distance between the two words x and y is : d=(x,y)

Page 18: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

CENTRAL CONCEPTS-Hamming Distance

1. If the hamming distance between the sent and received code-word is not zero, the code-word has been corrupted during transmission.2. The hamming distance can easily be found if we apply XOR operations on the two words and count the number of 1s in the result

Page 19: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

CENTRAL CONCEPTS-Minimum Hamming Distance

1. The minimum hamming distance is the smallest hamming distance between all possible pairs in a set of words. It is denoted by

Page 20: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

CENTRAL CONCEPTS-Relationships

1. A coding scheme is denoted as C (n, k) and must have a 2. To guarantee detection up to ‘s ‘ errors, the minimum hamming distance in the block code must be =s+1 3. To guarantee correction up to ‘t ‘ errors, the minimum hamming distance in the block code must be =2t+1 4. In a Linear Block Code, the minimum hamming distance is the no of 1s in the non-zero valid code-word with the smallest number of 1s. In the above example =3

DATAWORD CODEWORD

00 00000

01 01011

10 10101

11 11110

Page 21: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

Type-1:Simple Parity Check Code

1. A simple parity check code is a single bit error detecting code in which n=k+1 and =2

2. The single bit appended to the data-word to get the code-word is called the ‘Parity Bit’.

3. The value of the parity bit is selected such that the number of 1’s in the code-word is ‘even’

4. This code can only detect a single bit error. It cannot correct errors

Page 22: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

Simple Parity Check Code

Page 23: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

Simple Parity Check Code-Encoding and Decoding

1. Encoding is done by using modulo-2 addition on all the 4 bits of the data word to get the parity bit

2. = a3+a2+a1+a0 (modulo-2)3. In decoding the modulo-2 addition is done on the entire code-word

(including the parity)4. The resultant bit is called ‘syndrome’5. If s=0 means that there are even number of ones i.e. The code-word is

correct6. S=1, it means that there are odd number of 1s i.e the code-word has an

error7. If two bits are changed error may not be detected8. Simple parity check code can detect odd number of errors

Page 24: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

10.

Table 10.3 Simple parity-check code C(5, 4)

Page 25: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

10.

Let us look at some transmission scenarios. Assume the sender sends the dataword 1011. The codeword created from this dataword is 10111, which is sent to the receiver. We examine five cases:

1. No error occurs; the received codeword is 10111. The syndrome is 0. The dataword 1011 is created.2. One single-bit error changes a1 . The received codeword is 10011. The syndrome is 1. No dataword is created.3. One single-bit error changes r0 . The received codeword is 10110. The syndrome is 1. No dataword is created.

Example

Page 26: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

10.

4. An error changes r0 and a second error changes a3 . The received codeword is 00110. The syndrome is 0. The dataword 0011 is created at the receiver. Note that here the dataword is wrongly created due to the syndrome value. 5. Three bits—a3, a2, and a1—are changed by errors. The received codeword is 01011. The syndrome is 1. The dataword is not created. This shows that the simple parity check, guaranteed to detect one single error, can also find any odd number of errors.

Example (continued)

Page 27: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

Type-2:2-D Parity Check Code

Page 28: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103
Page 29: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103
Page 30: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

CHECKSUM METHOD (SENDER)

Page 31: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

CYCLIC REDUNDANCY CHECK

1. One of the most powerful and commonly used error detecting codes.

2. Given a m bit block of bit sequence, the sender generates an n bit sequence, known as Frame Check sequence (FCS), so that the resulting frame consisting of m+n bits is exactly divisible by some predetermined number.

3. The receiver divides the incoming frame, by that number and if there is no remainder, assumes that there was no error.

(show small example on board)

Page 32: COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai- 400103

CRC-Performance

1. CRC can detect all single bit errors

2. CRC can detect all double-bit errors (more than 3 ones)

3. CRC can detect any odd number of errors(X+1)

4. CRC can detect all burst errors of less than the degree of polynomial

5. CRC detects most of the larger burst errors with high probability