0% found this document useful (0 votes)
34 views

CH 11

Our postal system practices a type of framing. The simple act of inserting a letter into an envelope serves as the delimiter. The most important responsibilities of the data link layer are flo! control and error control.

Uploaded by

Samatha Rao K
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

CH 11

Our postal system practices a type of framing. The simple act of inserting a letter into an envelope serves as the delimiter. The most important responsibilities of the data link layer are flo! control and error control.

Uploaded by

Samatha Rao K
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 103

Chapter 11 Data Link Control

11.1

Copyright The McGraw-Hill Companies, Inc. Permission required or reproduction or display.

11-1 FRAMING
The data link layer needs to pack bits into frames, so that each frame is distinguishable from another. Our postal system practices a type of framing. The simple act of inserting a letter into an envelope separates one piece of information from another; the envelope serves as the delimiter. Topics discussed in this section:
Fixed-Size Framing Variable-Size Framing
11.2

Figure 11.1 A frame in a character-oriented protocol

11.3

Figure 11.2 Byte stuffing and unstuffing

11.4

ote

Byte stuffing is the process of adding 1 extra byte hene!er there is a flag or escape character in the text.

11.5

Figure 11.3 A frame in a bit-oriented protocol

11."

ote

Bit stuffing is the process of adding one extra $ hene!er fi!e consecuti!e 1s follo a $ in the data% so that the recei!er does not &istake the pattern $11111$ for a flag.

11.#

Figure 11.4 Bit stuffing and unstuffing

11.'

11-2 FLOW AND ERROR CONTROL


The most important responsibilities of the data link layer are flo! control and error control. "ollectively, these functions are kno!n as data link control.

Topics discussed in this section:


Flow Control Error Control

11.(

ote

)lo

control refers to a set of procedures used to restrict the a&ount of data that the sender can send before aiting for ackno ledg&ent.

11.1$

ote

*rror control in the data link layer is based on auto&atic repeat re+uest% hich is the retrans&ission of data.

11.11

11-3 PROTOCOLS
o! let us see ho! the data link layer can combine framing, flo! control, and error control to achieve the delivery of data from one node to another. The protocols are normally implemented in soft!are by using one of the common programming languages. To make our discussions language-free, !e have !ritten in pseudocode a version of each protocol that concentrates mostly on the procedure instead of delving into the details of language rules.

11.12

Figure 11.5 Ta#onomy of protocols discussed in this chapter

11.13

11-4 NOISELESS CHANNELS


$et us first assume !e have an ideal channel in !hich no frames are lost, duplicated, or corrupted. %e introduce t!o protocols for this type of channel.

Topics discussed in this section:


Simplest roto!ol Stop-and-"ait roto!ol

11.14

Figure 11.# The design of the simplest protocol !ith no flo! or error control

11.15

$lgorit%m 11.1 &ender-site algorithm for the simplest protocol

11.1"

$lgorit%m 11.2 'eceiver-site algorithm for the simplest protocol

11.1#

-#ample )).)
(igure )).* sho!s an e#ample of communication using this protocol. +t is very simple. The sender sends a se,uence of frames !ithout even thinking about the receiver. To send three frames, three events occur at the sender site and three events at the receiver site. ote that the data frames are sho!n by tilted bo#es; the height of the bo# defines the transmission time difference bet!een the first bit and the last bit in the frame.

11.1'

Figure 11.& (lo! diagram for -#ample )).)

11.1(

Figure 11.' .esign of &top-and-%ait /rotocol

11.2$

$lgorit%m 11.3 &ender-site algorithm for &top-and-%ait /rotocol

11.21

$lgorit%m 11.4 'eceiver-site algorithm for &top-and-%ait /rotocol

11.22

-#ample )).2
(igure )).0 sho!s an e#ample of communication using this protocol. +t is still very simple. The sender sends one frame and !aits for feedback from the receiver. %hen the A"1 arrives, the sender sends the ne#t frame. ote that sending t!o frames in the protocol involves the sender in four events and the receiver in t!o events.

11.23

Figure 11.( (lo! diagram for -#ample )).2

11.24

11-5 NOISY CHANNELS


Although the &top-and-%ait /rotocol gives us an idea of ho! to add flo! control to its predecessor, noiseless channels are none#istent. %e discuss three protocols in this section that use error control.

Topics discussed in this section:


Stop-and-"ait $utomati! )epeat )e*uest +o-,a!--. $utomati! )epeat )e*uest Sele!ti/e )epeat $utomati! )epeat )e*uest
11.25

ote

*rror correction in ,top-and-.ait /01 is done by keeping a copy of the sent fra&e and retrans&itting of the fra&e hen the ti&er expires.

11.2"

ote

2n ,top-and-.ait /01% e use se+uence nu&bers to nu&ber the fra&es. 3he se+uence nu&bers are based on &odulo-2 arith&etic.

11.2#

ote

2n ,top-and-.ait /01% the ackno ledg&ent nu&ber al ays announces in &odulo-2 arith&etic the se+uence nu&ber of the next fra&e expected.

11.2'

Figure 11.10 .esign of the &top-and-%ait A'3 /rotocol

11.2(

$lgorit%m 11.5 &ender-site algorithm for &top-and-%ait A'3

(continued)

11.3$

$lgorit%m 11.5 &ender-site algorithm for &top-and-%ait A'3

(continued)

11.31

$lgorit%m 11.# 'eceiver-site algorithm for &top-and-%ait A'3 /rotocol

11.32

-#ample )).5
(igure )).)) sho!s an e#ample of &top-and-%ait A'3. (rame 4 is sent and ackno!ledged. (rame ) is lost and resent after the time-out. The resent frame ) is ackno!ledged and the timer stops. (rame 4 is sent and ackno!ledged, but the ackno!ledgment is lost. The sender has no idea if the frame or the ackno!ledgment is lost, so after the time-out, it resends frame 4, !hich is ackno!ledged.

11.33

Figure 11.11 (lo! diagram for -#ample )).5

11.34

-#ample )).9
Assume that, in a &top-and-%ait A'3 system, the band!idth of the line is ) 6bps, and ) bit takes 24 ms to make a round trip. %hat is the band!idth-delay product7 +f the system data frames are )444 bits in length, !hat is the utili8ation percentage of the link7 Solution The bandwidth-delay product is

11.35

-#ample )).9 =continued>


The system can send 24,444 bits during the time it takes for the data to go from the sender to the receiver and then back again. :o!ever, the system sends only )444 bits. %e can say that the link utili8ation is only )444;24,444, or < percent. (or this reason, for a link !ith a high band!idth or long delay, the use of &top-and-%ait A'3 !astes the capacity of the link.

11.3"

-#ample )).<
%hat is the utili8ation percentage of the link in -#ample )).9 if !e have a protocol that can send up to )< frames before stopping and !orrying about the ackno!ledgments7 &olution The bandwidth-delay product is still 20,000 bits. The system can send up to 15 frames or 15,000 bits during a round trip. This means the utilization is 15,000/20,000, or 75 percent. Of course, if there are damaged frames, the utilization percentage is much less because frames have to be resent.
11.3#

ote

2n the 4o-Back-5 6rotocol% the se+uence nu&bers are &odulo 2m% here & is the si7e of the se+uence nu&ber field in bits.

11.3'

Figure 11.12 &end !indo! for ?o-Back- A'3

11.3(

ote

3he send indo is an abstract concept defining an i&aginary box of si7e 2 m 8 1 ith three !ariables9 ,f% ,n% and ,si7e.

11.4$

ote

3he send indo can slide one or &ore slots hen a !alid ackno ledg&ent arri!es.

11.41

Figure 11.13 'eceive !indo! for ?o-Back- A'3

11.42

ote

3he recei!e indo is an abstract concept defining an i&aginary box of si7e 1 ith one single !ariable 0 n. 3he indo slides hen a correct fra&e has arri!ed: sliding occurs one slot at a ti&e.

11.43

Figure 11.14 .esign of ?o-Back- A'3

11.44

Figure 11.15 %indo! si8e for ?o-Back- A'3

11.45

ote

2n 4o-Back-5 /01% the si7e of the send indo &ust be less than 2m: the si7e of the recei!er indo is al ays 1.

11.4"

$lgorit%m 11.& ?o-Back- sender algorithm

(continued)

11.4#

$lgorit%m 11.& ?o-Back- sender algorithm

(continued)

11.4'

$lgorit%m 11.' ?o-Back- receiver algorithm

11.4(

-#ample )).@
(igure )).)@ sho!s an e#ample of ?o-Back- . This is an e#ample of a case !here the for!ard channel is reliable, but the reverse is not. o data frames are lost, but some A"1s are delayed and one is lost. The e#ample also sho!s ho! cumulative ackno!ledgments can help if ackno!ledgments are delayed or lost. After initiali8ation, there are seven sender events. 'e,uest events are triggered by data from the net!ork layer; arrival events are triggered by ackno!ledgments from the physical layer. There is no time-out event here because all outstanding frames are ackno!ledged before the timer e#pires. ote that although A"1 2 is lost, A"1 5 serves as both A"1 2 and A"1 5.
11.5$

Figure 11.1# (lo! diagram for -#ample )).@

11.51

-#ample )).*
(igure )).)* sho!s !hat happens !hen a frame is lost. (rames 4, ), 2, and 5 are sent. :o!ever, frame ) is lost. The receiver receives frames 2 and 5, but they are discarded because they are received out of order. The sender receives no ackno!ledgment about frames ), 2, or 5. +ts timer finally e#pires. The sender sends all outstanding frames =), 2, and 5> because it does not kno! !hat is !rong. ote that the resending of frames ), 2, and 5 is the response to one single event. %hen the sender is responding to this event, it cannot accept the triggering of other events. This means that !hen A"1 2 arrives, the sender is still busy !ith sending frame 5.
11.52

-#ample )).* =continued>


The physical layer must !ait until this event is completed and the data link layer goes back to its sleeping state. %e have sho!n a vertical line to indicate the delay. +t is the same story !ith A"1 5; but !hen A"1 5 arrives, the sender is busy responding to A"1 2. +t happens again !hen A"1 9 arrives. ote that before the second timer e#pires, all outstanding frames have been sent and the timer is stopped.

11.53

Figure 11.1& (lo! diagram for -#ample )).*

11.54

ote

,top-and-.ait /01 is a special case of 4o-Back-5 /01 in hich the si7e of the send indo is 1.

11.55

Figure 11.1' &end !indo! for &elective 'epeat A'3

11.5"

Figure 11.1( 'eceive !indo! for &elective 'epeat A'3

11.5#

Figure 11.20 .esign of &elective 'epeat A'3

11.5'

Figure 11.21 &elective 'epeat A'3, !indo! si8e

11.5(

ote

2n ,electi!e 0epeat /01% the si7e of the sender and recei!er indo &ust be at &ost one-half of 2&.

11."$

$lgorit%m 11.( &ender-site &elective 'epeat algorithm

(continued)

11."1

$lgorit%m 11.( &ender-site &elective 'epeat algorithm

(continued)

11."2

(continued)

$lgorit%m 11.( &ender-site &elective 'epeat algorithm

(continued)

11."3

$lgorit%m 11.10 'eceiver-site &elective 'epeat algorithm

11."4

$lgorit%m 11.10 'eceiver-site &elective 'epeat algorithm

11."5

Figure 11.22 .elivery of data in &elective 'epeat A'3

11.""

-#ample )).A
This e#ample is similar to -#ample )).5 in !hich frame ) is lost. %e sho! ho! &elective 'epeat behaves in this case. (igure )).25 sho!s the situation. One main difference is the number of timers. :ere, each frame sent or resent needs a timer, !hich means that the timers need to be numbered =4, ), 2, and 5>. The timer for frame 4 starts at the first re,uest, but stops !hen the A"1 for this frame arrives. The timer for frame ) starts at the second re,uest, restarts !hen a A1 arrives, and finally stops !hen the last A"1 arrives. The other t!o timers start !hen the corresponding frames are sent and stop at the last arrival event.
11."#

-#ample )).A =continued>


At the receiver site !e need to distinguish bet!een the acceptance of a frame and its delivery to the net!ork layer. At the second arrival, frame 2 arrives and is stored and marked, but it cannot be delivered because frame ) is missing. At the ne#t arrival, frame 5 arrives and is marked and stored, but still none of the frames can be delivered. Only at the last arrival, !hen finally a copy of frame ) arrives, can frames ), 2, and 5 be delivered to the net!ork layer. There are t!o conditions for the delivery of frames to the net!ork layer: (irst, a set of consecutive frames must have arrived. &econd, the set starts from the beginning of the !indo!.
11."'

-#ample )).A =continued>


Another important point is that a A1 is sent after the second arrival, but not after the third, although both situations look the same. The reason is that the protocol does not !ant to cro!d the net!ork !ith unnecessary A1s and unnecessary resent frames. The second A1 !ould still be A1) to inform the sender to resend frame ) again; this has already been done. The first A1 sent is remembered =using the nak&ent variable> and is not sent again until the frame slides. A A1 is sent once for each !indo! position and defines the first slot in the !indo!.

11."(

-#ample )).A =continued>


The ne#t point is about the A"1s. otice that only t!o A"1s are sent here. The first one ackno!ledges only the first frame; the second one ackno!ledges three frames. +n &elective 'epeat, A"1s are sent !hen data are delivered to the net!ork layer. +f the data belonging to n frames are delivered in one shot, only one A"1 is sent for all of them.

11.#$

Figure 11.23 (lo! diagram for -#ample )).A

11.#1

Figure 11.24 .esign of piggybacking in ?o-Back- A'3

11.#2

11-6 HDLC
:igh-level .ata $ink "ontrol =:.$"> is a bit-oriented protocol for communication over point-to-point and multipoint links. +t implements the A'3 mechanisms !e discussed in this chapter.

Topics discussed in this section:


Con1igurations and 2rans1er 3odes Frames Control Field
11.#3

Figure 11.25

ormal response mode

11.#4

Figure 11.2# Asynchronous balanced mode

11.#5

Figure 11.2& :.$" frames

11.#"

Figure 11.2' "ontrol field format for the different frame types

11.##

2able 11.1 B-frame control command and response

11.#'

-#ample )).0
(igure )).20 sho!s ho! B-frames can be used for connection establishment and connection release. ode A asks for a connection !ith a set asynchronous balanced mode =&AB6> frame; node B gives a positive response !ith an unnumbered ackno!ledgment =BA> frame. After these t!o e#changes, data can be transferred bet!een the t!o nodes =not sho!n in the figure>. After data transfer, node A sends a .+&" =disconnect> frame to release the connection; it is confirmed by node B responding !ith a BA =unnumbered ackno!ledgment>.

11.#(

Figure 11.2( -#ample of connection and disconnection

11.'$

-#ample )).)4
(igure )).54 sho!s an e#change using piggybacking. ode A begins the e#change of information !ith an +-frame numbered 4 follo!ed by another +-frame numbered ). ode B piggybacks its ackno!ledgment of both frames onto an +-frame of its o!n. ode BCs first +-frame is also numbered 4 D =&> fieldE and contains a 2 in its ='> field, ackno!ledging the receipt of ACs frames ) and 4 and indicating that it e#pects frame 2 to arrive ne#t. ode B transmits its second and third +-frames =numbered ) and 2> before accepting further frames from node A.
11.'1

-#ample )).)4 =continued>


+ts ='> information, therefore, has not changed: B frames ) and 2 indicate that node B is still e#pecting ACs frame 2 to arrive ne#t. ode A has sent all its data. Therefore, it cannot piggyback an ackno!ledgment onto an +-frame and sends an &-frame instead. The '' code indicates that A is still ready to receive. The number 5 in the ='> field tells B that frames 4, ), and 2 have all been accepted and that A is no! e#pecting frame number 5.

11.'2

Figure 11.30 -#ample of piggybacking !ithout error

11.'3

-#ample )).))
(igure )).5) sho!s an e#change in !hich a frame is lost. ode B sends three data frames =4, ), and 2>, but frame ) is lost. %hen node A receives frame 2, it discards it and sends a '-F frame for frame ). ote that the protocol being used is ?o-Back- !ith the special use of an '-F frame as a A1 frame. The A1 frame does t!o things here: +t confirms the receipt of frame 4 and declares that frame ) and any follo!ing frames must be resent. ode B, after receiving the '-F frame, resends frames ) and 2. ode A ackno!ledges the receipt by sending an '' frame =A"1> !ith ackno!ledgment number 5.
11.'4

Figure 11.31 -#ample of piggybacking !ith error

11.'5

11-7 POINT-TO-POINT PROTOCOL


Although :.$" is a general protocol that can be used for both point-to-point and multipoint configurations, one of the most common protocols for point-to-point access is the /oint-to-/oint /rotocol =///>. /// is a byte-oriented protocol. Topics discussed in this section:
Framing 2ransition %ases 3ultiplexing 3ultilin11.'"

Figure 11.32 /// frame format

11.'#

ote

666 is a byte-oriented protocol using byte stuffing ith the escape byte $11111$1.

11.''

Figure 11.33 Transition phases

11.'(

Figure 11.34 6ultiple#ing in ///

11.($

Figure 11.35 $"/ packet encapsulated in a frame

11.(1

2able 11.2 $"/ packets

11.(2

2able 11.3 "ommon options

11.(3

Figure 11.3# /A/ packets encapsulated in a /// frame

11.(4

Figure 11.3& ":A/ packets encapsulated in a /// frame

11.(5

Figure 11.3' +/"/ packet encapsulated in /// frame

11.("

2able 11.4 "ode value for +/"/ packets

11.(#

Figure 11.3( +/ datagram encapsulated in a /// frame

11.('

Figure 11.40 6ultilink ///

11.((

-#ample )).)2
$et us go through the phases follo!ed by a net!ork layer packet as it is transmitted through a /// connection. (igure )).9) sho!s the steps. (or simplicity, !e assume unidirectional movement of data from the user site to the system site =such as sending an e-mail through an +&/>. The first t!o frames sho! link establishment. %e have chosen t!o options =not sho!n in the figure>: using /A/ for authentication and suppressing the address control fields. (rames 5 and 9 are for authentication. (rames < and @ establish the net!ork layer connection using +/"/.
11.1$$

-#ample )).)2 =continued>


The ne#t several frames sho! that some +/ packets are encapsulated in the /// frame. The system =receiver> may have been running several net!ork layer protocols, but it kno!s that the incoming data must be delivered to the +/ protocol because the "/ protocol used before the data transfer !as +/"/. After data transfer, the user then terminates the data link connection, !hich is ackno!ledged by the system. Of course the user or the system could have chosen to terminate the net!ork layer +/"/ and keep the data link layer running if it !anted to run another "/ protocol.
11.1$1

Figure 11.41 An e#ample

11.1$2

Figure 11.41 An e#ample =continued>

11.1$3

You might also like