DATA LINK LAYER
TOPIC: Error control & Flow control
Submitted to :
Prof Manraj Singh Pattar
Submitted by:
li!ha "or#al $ancy %ain $i&ea %ain Sharuti %ain I$'E(
1|Page
S no
) , + 0 . / 1 2
To#ic
Introduction to data lin* layer Ser&ice! #ro&ided to networ* layer Ser&ice! Framing Error detection Error correction Flow control Error control 3eference!
Page no + . / 1 )0 ). )2 ,-
2|Page
INTRODUCTION
Data Link Layer Design Issues
The data lin* layer ha! a number of !#ecific function! it can carry out4 The!e function! include )4 Pro&iding a well5defined !er&ice interface to the networ* layer4 ,4 'ealing with tran!mi!!ion error!4 +4 3egulating the flow of data !o that !low recei&er! are not !wam#ed by fa!t !ender!4 To accom#li!h the!e goal!6 the data lin* layer ta*e! the #ac*et! it get! from the networ* layer and enca#!ulate! them into frame! for tran!mi!!ion4 Each frame contain! a frame header6 a #ayload field for holding the #ac*et6 and a frame trailer4
3|Page
Services Provided to t e Net!ork Layer
The function of the data lin* layer i! to #ro&ide !er&ice! to the networ* layer4 The #rinci#al !er&ice i! tran!ferring data from the networ* layer on the !ource machine to the networ* layer on the de!tination machine4 On the !ource machine i! an entity6 call it a #roce!!6 in the networ* layer that hand! !ome bit! to the data lin* layer for tran!mi!!ion to the de!tination4 The job of the data lin* layer i! to tran!mit the bit! to the de!tination machine !o they can be handed o&er to the networ* layer there4 )4 7nac*nowledged connectionle!! !er&ice4 ,4 +4 c*nowledged connectionle!! !er&ice4 c*nowledged connection5oriented !er&ice
7nac*nowledged Connectionle!! Ser&ice
7nac*nowledged connectionle!! !er&ice con!i!t! of ha&ing the !ource machine !end inde#endent frame! to the de!tination machine without ha&ing the de!tination machine ac*nowledge them4 $o logical connection i! e!tabli!hed beforehand or relea!ed afterward4 If a frame i! lo!t due to noi!e on the line6 no attem#t i! made to detect the lo!! or reco&er from it in the data lin* layer4 Thi! cla!! of !er&ice i! a##ro#riate when the error rate i! &ery low !o that reco&ery i! left to higher layer!4 It i! al!o a##ro#riate for real5time traffic6 !uch a! &oice6 in which late data are wor!e than bad data4 Mo!t 8 $! u!e unac*nowledged connectionle!! !er&ice in the data lin* layer4
c*nowledged Connectionle!! !er&ice
9hen thi! !er&ice i! offered6 there are !till no logical connection! u!ed6 but each frame !ent i! indi&idually ac*nowledged4 In thi! way6 the !ender *now! whether a frame ha! arri&ed correctly4 If it ha! not arri&ed within a !#ecified time inter&al6 it can be !ent again4 Thi! !er&ice i! u!eful o&er unreliable channel!6 !uch a! wirele!! !y!tem!4
4|Page
Connection Oriented Service
9ith thi! !er&ice6 the !ource and de!tination machine! e!tabli!h a connection before any data are tran!ferred4 Each frame !ent o&er the connection i! numbered6 and the data lin* layer guarantee! that each frame !ent i! indeed recei&ed4 Furthermore6 it guarantee! that each frame i! recei&ed e:actly once and that all frame! are recei&ed in the right order4 9ith connectionle!! !er&ice6 in contra!t6 it i! concei&able that a lo!t ac*nowledgement cau!e! a #ac*et to be !ent !e&eral time! and thu! recei&ed !e&eral time!4 Connection5oriented !er&ice6 in contra!t6 #ro&ide! the networ* layer #roce!!e! with the e;ui&alent of a reliable bit !tream4
5|Page
SERVICES
)4 Framing ,4 Error control +4 Flow control -4 cce!! Control 04 Phy!ical ddre!!ing
6|Page
"ra#ing
To #ro&ide !er&ice to the networ* layer6 the data lin* layer mu!t u!e the !er&ice #ro&ided to it by the #hy!ical layer4 9hat the #hy!ical layer doe! i! acce#t a raw bit !tream and attem#t to deli&er it to the de!tination4 Thi! bit !tream i! not guaranteed to be error free4 The number of bit! recei&ed may be le!! than6 e;ual to6 or more than the number of bit! tran!mitted6 and they may ha&e different &alue!4 It i! u# to the data lin* layer to detect and6 if nece!!ary6 correct error!4 The u!ual a##roach i! for the data lin* layer to brea* the bit !tream u# into di!crete frame! and com#ute the chec*!um for each frame4 <Chec*!um algorithm! will be di!cu!!ed later in thi! cha#ter4= 9hen a frame arri&e! at the de!tination6 the chec*!um i! recom#uted4 If the newly5com#uted chec*!um i! different from the one contained in the frame6 the data lin* layer *now! that an error ha! occurred and ta*e! !te#! to deal with it <e4g46 di!carding the bad frame and #o!!ibly al!o !ending bac* an error re#ort=4 >rea*ing the bit !tream u# into frame! i! more difficult than it at fir!t a##ear!4 One way to achie&e thi! framing i! to in!ert time ga#! between frame!6 much li*e the !#ace! between word! in ordinary te:t4 ?owe&er6 networ*! rarely ma*e any guarantee! about timing6 !o it i! #o!!ible the!e ga#! might be !;uee@ed out or other ga#! might be in!erted during tran!mi!!ion4 Since it i! too ri!*y to count on timing to mar* the !tart and end of each frame6 other method! ha&e been de&i!ed4 In thi! !ection we will loo* at four method!: )4 Character count4 ,4 Flag byte! with byte !tuffing4 +4 Starting and ending flag!6 with bit !tuffing4 -4 Phy!ical layer coding &iolation!4
7|Page
Error Contro$
?a&ing !ol&ed the #roblem of mar*ing the !tart and end of each frame6 we come to the ne:t #roblem: how to ma*e !ure all frame! are e&entually deli&ered to the networ* layer at the de!tination and in the #ro#er order4 Su##o!e that the !ender ju!t *e#t out#utting frame! without regard to whether they were arri&ing #ro#erly4 Thi! might be fine for unac*nowledged connectionle!! !er&ice6 but would mo!t certainly not be fine for reliable6 connection5oriented !er&ice4 The u!ual way to en!ure reliable deli&ery i! to #ro&ide the !ender with !ome feedbac* about what i! ha##ening at the other end of the line4 Ty#ically6 the #rotocol call! for the recei&er to !end bac* !#ecial control frame! bearing #o!iti&e or negati&e ac*nowledgement! about the incoming frame!4 If the !ender recei&e! a #o!iti&e ac*nowledgement about a frame6 it *now! the frame ha! arri&ed !afely4 On the other hand6 a negati&e ac*nowledgement mean! that !omething ha! gone wrong6 and the frame mu!t be tran!mitted again4 n additional com#lication come! from the #o!!ibility that hardware trouble! may cau!e a frame to &ani!h com#letely <e4g46 in a noi!e bur!t=4 In thi! ca!e6 the recei&er will not react at all6 !ince it ha! no rea!on to react4 It !hould be clear that a #rotocol in which the !ender tran!mit! a frame and then wait! for an ac*nowledgement6 #o!iti&e or negati&e6 will hang fore&er if a frame i! e&er lo!t due to6 for e:am#le6 malfunctioning hardware
Error 'etection Error Correction
8|Page
Error Detection
9hen data i! being tran!mitted from one machine to another6 it may #o!!ible that data become corru#ted on it! way4 Some of the bit! may be altered6 damaged or lo!t during tran!mi!!ion4 Such a condition i! *nown a! error4 The error may occur becau!e of noi!e on line6 attenuation and delay di!tortion4 For reliable communication6 it i! im#ortant that error! are detected and corrected4 Ty#e! of error! Single bit error >ur!t error
Single bit error
It mean! only one bit of data unit i! changed from ) to A or from A to )4 Single bit error can ha##en in #arallel tran!mi!!ion where all the data bit! are tran!mitted u!ing !e#arate wire!4 Single bit error i! lea!t li*ely ty#e of error! in !erial tran!mi!!ion4
>ur!t Error
It mean! two or more bit! in data unit are changed from ) to A or from A to )4 In bur!t error6 it i! not nece!!ary that only con!ecuti&e bit! are changed4 The length of bur!t error i! mea!ured from fir!t changed bit to la!t changed bit4
9|Page
Techniques
Error detection mean! in!#ecting the data !o a! to chec* whether or not data i! changed during the tran!mi!!ion4 n error detection !y!tem i! needed at the recei&er end that !hould chec* the incoming data and re#ort the number and ty#eB! error! that define ha&e occurred4 The mo!t common techni;ue u!ed for error detection i! redundancy4
3edundancy
3edundancy i! the method in which !ome e:tra bit! are added to the data !o a! to chec* whether the data contain error or not4 The!e redundant bit! are added by the !ender and remo&ed by the recei&er a! !oon a! the accuracy of the tran!mi!!ion ha! been determined The!e redundant bit! are then added to the data and data C redundant bit! are tran!mitted to the recei&er
Ty#e!
)4 Dertical 3edundancy chec*E#arity chec* ,4 8ongitudinal 3edundancy chec* +4 Cyclic 3edundancy chec* -4 Chec*!um
10 | P a g e
%ertica$ Redundancy C eck&Parity C eck
Thi! method i! al!o *nown a! #arity chec*4 In thi! method6 a redundant bit called #arity bit i! added to each data unit4 Thi! method may include e&en #arity or odd #arity4 E&en #arity mean! that total number of )are e&en4 Odd #arity mean! the total no of ) are odd4 E:am#le If !ource want! to tran!mit a data unit ))AA))) u!ing e&en #arity to the de!tination4 The !ource will fir!t #a!! thi! unit to e&en #arity generator4 The #arity generator will count the number of ) in data and will add #arity bit4 In thi! e:am#le6 !ince the number of ) in data unit i! fi&e6 the #arity generator a##end! a #arity bit ) to thi! data unit ma*ing the total number of ) e&en4 ) ) A A ) ) )
E&en Parity generator <Count! ) in data= ) ) A A ) ) ) ) )
D3C can detect all !ingle bit error It can al!o detect bur!t error but only in tho!e ca!e! where number of bit! changed i! odd4 The major di!ad&antage of thi! method i! that it i! not able to detect bur!t error if the number! of bit! are e&en4
11 | P a g e
Longitudinal Redundancy Check
In thi! method bloc* of bit! i! di&ided into table or matri: of row! and column!4 In order to detect the error6 a redundant row of bit! i! added to the whole bloc* and thi! bloc* i! tran!mitted to the recei&er4 The recei&er u!e! thi! redundant row to detect error4 fter chec*ing the data for error!6
recei&er! acce#t the data and di!card the redundant row of bit!4
Sender data 11001010 10101010 11001100 11100011
11001010 10101010 11001100 11100011 01001111
11001010
10101010
11001100 Receiver data
11100011
01001111
9hen thi! data reache! the de!tination6 recei&er u!e! 83C to detect error in data4 83C i! u!ed to detect bur!t error!4 For e4g4 !u##o!e +, bit data #lu! 83C that wa! being tran!mitted i! hit by bur!t error of length fi&e and !ome bit! are corru#ted4
12 | P a g e
Cyc$ic Redundancy C eck
C3C i! more #owerful than D3C and 83C in detecting error!4 It i! not ba!ed on binary addition li*e D3C and 83C4 3ather it i! ba!ed on binary di&i!ion4 t the !ender !ide6 the data unit to be tran!mitted i! di&ided by a #redetermined di&i!or <binary number= in order t obtain the remainder4 Thi! remainder i! called C3C4 The C3C ha! one bit le!! than the di&i!or4 It mean! that if C3C i! of n bit!6 di&i!or i! of nC ) bit4 The !ender a##end! thi! bit C3C to the end of data unit !uch that the re!ulting data unit become! e:actly di&i!ible by #redetermined di&i!or i4e4 remainder become @ero4
)A)) )A)) )AA)AAA )A)) A)AA AAAA )AAA )A)) A))A AAAA ))A
13 | P a g e
C ecksu#
Chec*!um i! the error detection method u!ed by u##er layer #rotocol! and i! con!idered to be more reliable than 83C6 D3C & C3C4 Thi! method ma*e! u!e of chec*!um generator on the !ender !ide &chec*!um chec*er on the recei&er !ide4 t the !ender !ide6 chec*!um generator di&ide! the data into e;ual !ubunit! of n bit length4 Thi! length i! generally of ). bit!4 For e:am#le If the data unit to be tran!mitted i! )A)A)AA) u!ed at the !ender & recei&er !ite4 AA)))AA)6 the following #rocedure i!
Sender !ite:
)A)A)AA) AA)))AA) )))AAA)A AAA)))A)
<!ubunit )= <!ubunit ,= <!um u!ing ) com#liment= chec* !um <com#liment of !um =
)A)A)AA) ' T
3ecei&er site:
AA)))AA)
AAA)))A) Chec*!um
)A)A)AA) AA)))AA) AAA)))A) )))))))) AAAAAAAA
!ubunit ) !ubunit , chec*!um !um !um com#liment
14 | P a g e
Error Correction
Error correction mean! rectifying all the bit! that ha&e been altered or changed during the tran!mi!!ion of data4 Error correction can be done a! follow!: >y retran!mi!!ion of data from !ender to recei&er4 >y the u!e of error correction code at the recei&er !ide4
?amming Code
?amming code i! a techni;ue de&elo#ed by 3494 hamming for error correction4 Thi! method correct! the error by finding the !tate at which the error ha! occurred4
15 | P a g e
"$o! Contro$
nother im#ortant de!ign i!!ue that occur! in the data lin* layer <and higher layer! a! well= i! what to do with a !ender that !y!tematically want! to tran!mit frame! fa!ter than the recei&er can acce#t them4 Thi! !ituation can ea!ily occur when the !ender i! running on a fa!t <or lightly loaded= com#uter and the recei&er i! running on a !low <or hea&ily loaded= machine4 The !ender *ee#! #um#ing the frame! out at a high rate until the recei&er i! com#letely !wam#ed4 E&en if the tran!mi!!ion i! error free6 at a certain #oint the recei&er will !im#ly be unable to handle the frame! a! they arri&e and will !tart to lo!e !ome4 Clearly6 !omething ha! to be done to #re&ent thi! !ituation4 Two a##roache! are commonly u!ed4 In the fir!t one6 feedbac*5ba!ed flow control6 the recei&er !end! bac* information to the !ender gi&ing it #ermi!!ion to !end more data or at lea!t telling the !ender how the recei&er i! doing4 In the !econd one6 rate5ba!ed flow control6 the #rotocol ha! a built5in mechani!m that limit! the rate at which !ender! may tran!mit data6 without u!ing feedbac* from the recei&er4 In thi! cha#ter we will !tudy feedbac*5ba!ed flow control !cheme! becau!e rate5ba!ed !cheme! are ne&er u!ed in the data lin* layer4
Method!
Sto# and 9ait Sliding window
16 | P a g e
Stop and Wait
In thi! method of flow control6 the !ender !end! a !ingle frame to recei&er and wait! for an ac*nowledgment4 The ne:t frame i! !end by !ender only when ac*nowledgment of #re&iou! frame i! recei&ed4 Thi! #roce!! of !ending a frame & waiting for an ac*nowledgment continue! a! long a! !ender ha! data to !end4 To end u# the tran!mi!!ion !ender tran!mit! EOT frame The main ad&antage i! it! accuracy4 $e:t frame i! tran!mitted only when the ac*nowledged i! recei&ed4 So no chance of frame being lo!t
Sender
Receiver
D ! C" D !
#O!
17 | P a g e
S$iding 'indo!
In !liding window method6 multi#le frame! are !ent by !ender at a time before needing an ac*nowledgment4 Multi#le frame! !ent by !ource are ac*nowledged by recei&er u!ing a !ingle C" frame4 Sliding window refer! to an imaginary bo:e! that hold the frame! on both !ender and recei&er !ide4 It #ro&ide! the u##er limit on the number of frame! that can be tran!mitted before re;uiring an ac*nowledgment4 Frame! may be ac*nowledged by recei&er at any #oint e&en window i! not full on recei&er !ide4 Frame! may be tran!mitted by !ource e&en when window i! not yet full on !ender !ide4
'indo!
18 | P a g e
Error Contro$
Error control function of data lin* layer detect! the error in tran!mitted frame! and retran!mit! all the erroneou! frame!4 Therefore error control function of data lin* layer hel#! in dealing with data frame! that are damaged in tran!mit6 data frame lo!t in tran!mit and the ac*nowledgment frame that are lo!t in tran!mi!!ion4 The method i! u!ed for error control i! called utomatic 3e#eat 3e;ue!t < 3F=4
utomatic 3e#eat 3e;ue!t < 3F=
If an error i! detected in any frame6 the recei&er !end! a negati&e ac*nowledgement <$ "= bac* to !ource and the !#ecific frame i! retran!mitted4
3F techni;ue!:
Sto# and 9ait 3F Sliding window 3F
Go 5 bac* 5 n Selecti&e H reject
19 | P a g e
Sto( and 'ait
The !ending de&ice *ee#! a co#y of the la!t frame tran!mitted until it recei&e! an ac*nowledgment for that frame4 "ee#ing thi! co#y hel#! the !ender in retran!mi!!ion of lo!t or damaged frame! later on4 >oth data frame! and #ur#o!e4 Criteria u!ed by !to# and wait 3F method: 'amaged data frame! 8o!t data frame! 8o!t ac*nowledged frame! C" frame! are numbered alternately A and ) for identification
20 | P a g e
'amaged data frame!
If a data frame recei&ed by a recei&er contain! an error6 it return! $ " frame to the !ender4 On recei&ing $ " frame6 !ender retran!mit! the la!t data frame4
21 | P a g e
8o!t data frame!
E&ery !ending de&ice i! e;ui##ed with timer4 The !ender !tart! thi! timer when it tran!mit! data frame4 If a data frame i! lo!t on it! way6 it will not be recei&ed by recei&er4 recei&er can ne&er ac*nowledge it6 #o!iti&ely or negati&ely4 The !ending de&ice wait! for an C" and $ " frame until timer goe! of4 ! a re!ult the
22 | P a g e
8o!t ac*nowledgment frame!
9hen any data frame reache! the de!tination6 the recei&er ac*nowledge! it either with C" or with $ "4 If C" or $ " frame returned by the recei&er i! lo!t in tran!mit6 !ending de&ice
retran!mit the data frame that ha! not been ac*nowledged
23 | P a g e
Re)erences
htt#:EEdoc!4google4comE&iewerI
aJ&&;Jcache:gA*c.om/ 8E%:www4ci!4tem#le4eduEKlatec*iECour!e!ECIS.)/5 A-E!lide!ECh+'ata8in*4##tCdataClin*ClayerC5 CerrorCcontrol&hlJen&glJin&#idJbl&!rcidJ 'GEESh/iihD8j@fFb@Agre/M7A,.m n)tthMC5nrjD'OhmlFy;#5 E#bPP)1'@/P%TOo+lto)A%rgl)n*h:f"GM?E*o-l2,Tc#9h9dwL.$9F8wcgt1&8) 3flnm,fl$el7M3$8D1E2D5?&!igJ ?IEtb3Acw3F.;Cblr@)L@C0F*Fn7?Leg
htt#:EEwww4google4co4inE!earchI;JdataClin*ClayerC5
CerrorCcontrol&hlJen&biwJ),1A&bihJ1.2&#rmdJi&n!&eiJ:0y;Tdu$EI(;r f!,Li oC &!tartJ)A&!aJ$
htt#:EEdoc!4google4comE&iewerI
aJ&&;Jcache:Nj&';*Dm !w%:#eo#le4du4ac4inEKngu#taECS,A-E'ataO,0,A8in* O,0,A8ayer4##tCdataClin*ClayerC5 CerroeCcontrol&hlJen&glJin&#idJbl&!rcidJ 'GEESj&@C92ED9?SCg8u$EgMr 8$1Sn7&i5OFg'?@umL$$bPe5A1m?hM-h8M;c:F2.Awte0mL?m)&aeA5 ;Om9u/):Aw/bO;1M-iogyc;PLP,+D*(G*&@E+lb0F%'?j>j%f0fune%*Mit&!igJ ?IEtbTru&M8;Em+'M95%m3.GPI8;mF:Ng
htt#:EEdoc!4google4comE&iewerI
aJ&&;Jcache:#(aIC1Dehaw%:www4c!4&irginia4eduEK@aherEcla!!e!ECS-0/Electure!Eflo w5control4#dfCdataClin*ClayerC5 CerroeCcontrol&hlJen&glJin&#idJbl&!rcidJ 'GEESh(OP>rr@L(u*2%-MDuS@C 7$dgifC:?o.>/7F?fNg-2Cl.w!L,gdbAdO5 M!MAhcL@EE.,Pl!Gcu#:yd0Mh/./.:$;7/M:trut:hD9y*>Iy#!iEu2F)E)>L1/: 1"u#-M0#y%*D5F&!igJ ?IEtbFI3$9#mf?Twy(Pyb &M:0r!+G/M
htt#:EEdoc!4google4comE&iewerI
aJ&&;Jcache:li/+MIN@h/E%:eeweb4#oly4eduEel0+.Edatalin*Ncontrol4#dfCdataClin*Cla yerC5 CerrorCcontrol&hlJen&glJin&#idJbl&!rcidJ 'GEESgl'ES-:EMhroL0oF#G"0 Nd"/:ynEb@e",+j8?P?yLj/9)"*OeN,efN@7'jgG.&),o&Miaa@e32y2ti*fC&3oE
24 | P a g e
"F98bn?nmlIyaMFmT5o(5Ar.Anw5 d*1hhac+:"o"Ni3y),c&&!igJ ?IEtbFScSEy"t.bS:;CNA,Df@7(FM93ew
25 | P a g e