cs3505: data link layer. data link layer phys. layer subject to errors; not reliable; and only...

27
CS3505: CS3505: DATA LINK LAYER DATA LINK LAYER

Upload: stephen-hunter

Post on 04-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

CS3505:CS3505:

DATA LINK LAYER DATA LINK LAYER

Page 2: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer data link layer

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.

purpose of DL: transform unreliable physical bit stream into reliable data communications link...

PHY + DL = DATA COMMUNICATIONS MAC layer (media access control) - takes place

of DL layer in LANs (together with LLC)

Page 3: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : functionsdata link layer : functions

framing and frame synchronization

error control

flow control

addressing

link management

Page 4: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : framingdata link layer : framing

bits must be grouped into frames ( messages)

frames marked by synchronous transmission: starts, ends with a special flag pattern

groups bits into fields, subgroups; two main types are data and control bits.

several types of control bits; some for

error detection and/or correction

addressing

flow control

other control type information

Page 5: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : error controldata link layer : error control

3 basic techniques parity checking

simple and easy, but not very effective

CRC - cyclic redundancy check more complex, but very effective and efficient

Hamming code limited error correction; based on complex

combinations of parity checks

Page 6: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : parity checkingdata link layer : parity checking

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.

example: data bits 0011001; add parity bit 1 --->00110011

Page 7: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : parity checkingdata link layer : parity checking

what is the problem with simple parity checking as described? (show how to fool it)

X X X P LRC - double parity checks improve this

X X X X P

X X X X PX X X X PP P P P P

show how to fool this error check improves error probability by factor of 102 - 104

Page 8: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : error probabilitiesdata link layer : error probabilities

let PB = Prob [single bit error];

then (1 - PB ) = Prob [no error]

for group of N bits, define P1 : Prob[no errors]

P2 : Prob{ undetected error]

P3 : Prob[detected error]

By definition, P1 + P2 + P3 = 1

Page 9: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : error probabilitiesdata link layer : error probabilities

frame probabilities, parity checking given a frame, sent as a sequence of words/bytes,

each with a parity check. What are P1, P2, and P3?

NB = no.bits/word; NC = no.words/frame.

P1 =

P2 =

P3 =

Page 10: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

error checking : CRC error checking : CRC

stronger error check needed

idea: insert a group of bits in the frame, which serve as as more powerful check.

added bits (frame check sequence, FCS) cause the resulting frame to be exactly divisible by a predetermined number.

modulo-2 arithmetic used; binary addition with no carries examples

Page 11: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

error checking : CRCerror checking : CRC

CRC summary all single and double bit errors all odd numbers of errors all burst errors smaller than n most larger burst errors If error detected, frame is retransmitted; does NOT

correct error. both CRC and parity checking widely used; CRC

used in many network protocols, in addition to data link layer, including most LANs.

CRC can be implemented efficiently in hardware... computation done bit by bit

Page 12: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

error checking : CRC error checking : CRC implementationimplementation

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

Page 13: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

error checking : Hamming codeerror checking : Hamming code

correct a single bit error detect multiple errors 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.

Page 14: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

error checking : Hamming codeerror checking : Hamming code

each parity bit appears in a position corresponding to a power of 2: n = 0,1,2,4,8,16,...

bits checked by parity bit in position n are: 1. itself2. continue for next n bits (including itself)3. off (don’t check) next n bits4. on (check) the next n bits

and continue to end of message.

Example: for the data 1101100101, show Hamming coded mesage.

Page 15: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

error checking error checking

Summary, error correction: more complex codes correct multiple errors require more redundancy, overhead. Also more

time... so not widely used in communications. do have a place in longer distance

communications -- eg, deep space, etc. In fact could be critical to long distance (time) communications

Page 16: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

DL layer : flow and error control DL layer : flow and error control

purpose : control flow of data from sender S to receiver R, so R is not overwhelmed nor kept idle

secondary purpose also used to avoid swamping the network or link with traffic.

technique : send control information between S and R, synchronizing on buffer space, transmission rates, etc.

protocols: stop-and-wait, alternating bit sliding window

Page 17: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : stop-and -wait data link layer : stop-and -wait protocolprotocol

send 1 frame, then stop, and wait for an acknowledgment before sending the next.

RXdata

ack

data

Page 18: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

data link layer : stop and wait data link layer : stop and wait protocolsprotocols

what is the efficiency of this S&W protocol? i.e., of the total time spent, how much is actually spent sending the data?

variables

tD, time spent transmitting the data

tprop, propagation delay

tproc, processing time

tack, time spent transmitting the ack.

U, utilization or efficiency of the protocol

Page 19: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

DL layer : stop and waitDL layer : stop and wait

finite state machine specification of the protocol assuming no channel errors

reachability analysis of the protocol

what happens if a message is lost?

Page 20: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

DL : stop and waitDL : stop and wait

to tolerate losses, must add timeouts (TO) and retransmissions data loss ack loss

finite state machine specification timeout and retransmission

reachability analysis

Page 21: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

DL : stop and waitDL : stop and wait

what is the efficiency of the stop and wait protocol? (what % of time actually Xmitting data) assuming no channel losses with channel losses

what happens if ack is lost? (what problem does this cause for the receiver?)

what is the obvious solution?

Page 22: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

DL : alternating bit protocol DL : alternating bit protocol

add a number to data frames, to uniquely identify; enable repeated messages to be safely discarded

CFSM specification, AB protocol

reachability analysis

efficiency

Page 23: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

protocol specification protocol specification

protocols are algorithms, critical to network operation; these are/will be standardized, and must be clearly specified, without ambiguity, so that implementations by different vendors will be the

same, and protocol can be thoroughly analyzed (checked

for errors)

communicating finite state machines (CFSM) - a very often used tool for protocol specification

Page 24: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

link utilization of AB protocollink utilization of AB protocol

satellite link

earth

Page 25: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

sliding window protocolsliding window protocol

suppose w = 63: what if d61 lost?

d0d1

d62

Page 26: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

HDLC: high level data link controlHDLC: high level data link control

ISO standard for a data link protocol other DL standards exist, but are very similiar;

e.g., PPP HDLC combines various functions of the DL layer -

flow control, error control, sequencing, framing, etc. - into a single protocol standard

HDLC standard is broad, covering several different cases

Page 27: CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful

HDLCHDLC frame types and formats

I-frame (info/data) S-frame (supervisory)U-frame (data)