270 likes | 352 Views
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 adds these, and combines bits into frames , or messages .
E N D
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)
data link layer : functions • framing and frame synchronization • error control • flow control • addressing • link management
data 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
data 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
data 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
data 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 P X X X X P P P P P P • show how to fool this error check • improves error probability by factor of 102 - 104
data 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
data 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 =
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
error 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
error checking : CRC implementation • 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.
error 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.
error 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. 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 1101100101, show Hamming coded mesage.
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
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
data link layer : stop-and -wait protocol send 1 frame, then stop, and wait for an acknowledgment before sending the next. X R data ack data
data link layer : stop and wait protocols • 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
DL 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?
DL : 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
DL : 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?
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
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
link utilization of AB protocol satellite link earth
sliding window protocol suppose w = 63: what if d61 lost? d0 d1 d62
HDLC: 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
HDLC • frame types and formats • I-frame (info/data) • S-frame (supervisory) • U-frame (data)