Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS3502: Data and Computer Networks DATA LINK LAYER - 1.

Similar presentations


Presentation on theme: "CS3502: Data and Computer Networks DATA LINK LAYER - 1."— Presentation transcript:

1 CS3502: Data and Computer Networks DATA LINK LAYER - 1

2 data link layer : objectives u thorough understanding of DL layer -- u where/how it fits into network/other layers u service it provides (to higher layers) u services it uses (from lower layer) u synchronous/asynchronous transmission u error detection and correction u describe flow control protocols: sliding window u specify/verify basic DL protocols u elementary performance analysis of DL protocols

3 data link layer u phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful. DL layer adds these, and combines bits into frames, or messages. u purpose of DL: transform unreliable physical bit stream into reliable data communications link... u PHY + DL = DATA COMMUNICATIONS u MAC layer (media access control) - takes place of DL layer in LANs (together with LLC)

4 data link layer : functions u framing and frame synchronization u frames marked by sync/async technique u error control u flow control u addressing u control information, data on same link (unlike EIA232) u link management (3 phases)

5 data link layer : framing u bits must be grouped into frames or messages u frames marked by synchronous transmission: frame starts, ends with a special flag pattern u Meathods u Character Count u Start + End Characters u Flags u Physical Layer Code Violation u Finite state machine for Bit stuff flag 011110

6 data link layer : framing u allows bits to be grouped into fields, subgroups; two main types are data and control bits. u several types of control bits; some for u error detection and/or correction u addressing u flow control u other control type information

7 data link layer : error control u 3 basic techniques in this course (more complex techniques exist) u parity checking u very simple and easy error detection u CRC - cyclic redundancy check u more complex, but very effective and efficient u Hamming code u limited error correction; based on complex combinations of parity checks

8 data link layer : parity checking u to a group of data bits add a single extra bit, known as the parity bit. This bit is chosen to make the total number of 1s in the group even (or odd). Called even (odd) parity checking. u example: data bits 0011001; add parity bit 1 --- >00110011. u exercise: construct a FSM to (1) output correct parity bit (2) read a string and decide parity

9 data link layer : parity checking u what is the problem with simple parity checking as described? (show how to fool it) X X X P u LRC - double parity checks improve this X X X X P P P P P P u show how to fool this error check u improves error probability by factor of 10 2 - 10 4

10 data link layer : error probabilities let P B = Prob [single bit error]; then (1 - P B ) = Prob [no error] for group of Nb bits, define P 1 : Prob[no errors] P 2 : Prob[undetected error] P 3 : Prob[detected error] By definition, P 1 + P 2 + P 3 = 1

11 data link layer : error probabilities u examples in a 10 bit word, what is P[only bit 3 wrong]? P[exactly 1 error]? P[exactly 3 errors]? P[at most 3 errors]? P[3 errors or more]? P[3 bit burst error, with other 7 bits correct]?

12 data link layer : error probabilities Case 1: no error detection Then what are these 3 probabilities for Case 1? P 1 = Pr [no error] = P 2 = Pr [undetected error] = P 3 = Pr [detected error] = example

13 data link layer : error probabilities Case 2: error detection using parity bit u for even parity, even # errors goes undetected; so P 2 is Pr(even # of errors) P 1 = (1 - P B ) Nb P 2 =  Nb C 2a P b 2a (1-P b ) Nb-2a P 3 = 1- P 2 - P 1 hint: what is Pr(1 error)? Pr(2 errors)?... k errors? a=1 Nb/2

14 data link layer : error probabilities u frame probabilities, parity checking u given a frame, sent as a sequence of words/bytes, each with a parity check. What are Pf 1, Pf 2, and Pf 3 ? Pf 1 = probability of no error in the whole frame Pf 2 = probability of an undetected error and no detected error anywhere else in the frame Pf 3 = probability of an detected error

15 u Nb = no.bits/word; Nc = no.words/frame. Pf 1 = P 1 Nc where: P 1 is the probability of no error in a word Pf 2 =  Nc C i P 2 i [ (1-P b ) Nb ] Nc -i where: P 2 is the probability of undetected error in a word P b is the probability there is an error in a bit Pf 3 = 1 - Pf 1 - Pf 2 data link layer : error probabilities i=1 Nc

16 error checking : CRC u stronger error check needed u idea: insert a group of bits in the frame, which serve as as more powerful check. u added bits ( frame check sequence, FCS ) cause the resulting frame to be exactly divisible by a predetermined number. u modulo-2 arithmetic used; binary addition with no carries u examples

17 error checking : CRC let M denote data message, k bits long to M, add F, the FCS, which is n bits long resulting transmitted frame is T, T = 2 n M + F = M | F is evenly divisible by some pattern P, a sequence of ( n + 1) bits. Q: how is F calculated from M and P ?

18 error checking : CRC u F is n bits, pattern P is (n + 1) bits u 1st, last bits of P must be 1 u FCS F computed from M, P: F = remainder R, when dividing 2 n M / P = Q + R note: this “division” is modulo-2, no carries example : let M = 110011; k = 6; n = 3; p = 1001. Find F and T. (answer next page)

19 error checking : CRC u quotient Q = 110101; remainder R = 101; so T = 110011101. u check: divide T by P, R should be 0. u example : M = 1010001101; P = 110101. Find F, T. Then check it.

20 error checking : CRC u CRC summary u all single and double bit errors u all odd numbers of errors u all burst errors smaller than n u most larger burst errors u If error detected, frame is retransmitted; does NOT correct error. u both CRC and parity checking widely used; CRC used in many network protocols, in addition to data link layer, including most LANs. u CRC can be implemented efficiently in hardware... computation done bit by bit

21 error checking : CRC implementation u shift register, XOR gates u 1 XOR gate for each “1” in pattern P, minus 1. u (n-1) 1-bit shift registers u example : show logic circuit for P - 110101.

22 error checking : Hamming code u correct a single bit error u detect multiple errors u extended parity checking; ie, redundant parity bits Idea: parity bits appear in positions corresponding to the nodes of a binary tree; data bits appear in positions corresponding to the leafs. If a bit is in error, the other bits “point” to it by their related positions in the tree.

23 error checking : Hamming code u each parity bit appears in a position corresponding to a power of 2: k = 0,1,2,4,8,16,... u bits checked by parity bit in position n are: 1. itself 2. continue for next n bits (including itself) 3. off (don’t check) next n bits 4. on (check) the next n bits and continue to end of message. Example: for the data 1101101, show Hamming coded mesage.

24 error checking : Hamming code u How is single error bit detected? example: suppose 111100010101 is received. 1st parity bit, position 1: 2nd parity bit, position 2: 3rd parity bit, position 4: 4th parity bit, position 8: 0 parity bit, position 0: result:

25 error checking : Hamming code u example: suppose 0111011 received; is it correct? Q: for a n-bit message, approximately how many bits are needed? Summary, error correction: u more complex codes correct multiple errors u require more redundancy, overhead. Also more time... so not widely used in communications. u do have a place in longer distance communications -- eg, deep space, etc. In fact could be critical to long distance ( time ) communications


Download ppt "CS3502: Data and Computer Networks DATA LINK LAYER - 1."

Similar presentations


Ads by Google