1

UNIT-TWO

Data Link Layer

Suresha V. Professor, Dept. of E&C, KVG College Of Engineering. Sullia, D.K
2574 327

INTRODUCTION
Farther of
Internet
Prof. Vinton Cerf

Vinton Cerf
Vint Cerf in Vilnius, September 2010.
Born
Residence

June 23, 1943 (age 68)
New Haven, Connecticu
tUSA

Citizenship

United States of
America

Fields

Computer science

Institutions

IBM,[1] UCLA,[1] 
Stanford University,[1]
DARPA [1]
,  MCI,[1][2] CNRI,
[1]
 Google[3]

Alma mater

Stanford
University, UCLA

Known for

TCP/IP
Internet Society

Notable awards

National Medal of
Technology
Presidential Medal of
Freedom
Turing Award
3

o Flow Control.  Regulates the flow of frames.INTRODUCTION  Provides a well-defined service interface to the network layer. • Above functions are software implemented protocols that provide4 smooth and reliable .  Data Link Control (DLC): Data link control functions includes o Framing. o Error Control.  Deals with transmission errors (CRC and ARQ).  Performs general link layer management.  Determines how the bits of the physical layer are grouped into frames (framing).  The two main functions of the data link layer are:  Data Link Control(DLC) : It deals with the design and procedures for communication b/w nodes: node-to-node communication.  Media Access Control(MAC): It explain how to share the link.

KVG College Of Engineering.574 327 5 .  The data link layer needs to pack bits into frames. Sullia. D. by adding a sender address and a destination address.  The destination address defines where the packet is to go.1. Dept. Professor. Suresha V. of E&C. or from other messages to other destinations. the sender address helps the recipient acknowledge the receipt.FRAMING  Divide the bit stream in to group of bits and attach checksum called Framing.K .  Framing in the data link layer separates a message from one source to a destination. so that each frame is distinguishable from another.

1. Sullia. (2) Variable Size Framing  Size of the frame is not fixed. which uses frames of fixed size called cells.  It is used in the ATM wide-area network. KVG College Of Engineering. Professor.  In variable-size framing.574 327  It Suresha is used in local area networks. there is no need for defining the boundaries of the frames. Dept. 6 . need a way to define the end of the frame and the beginning of the next.  In fixed-size framing. V.FRAMING (cont…)  Frames of Two Categories (1) Fixed-Size Framing  Size of the frame is fixed. the size itself can be used as a delimiter. D. of E&C.K .

K .1.FRAMING (cont…)  Character-oriented framing approach  In a character-oriented approach.  Trailer carries error detection or error correction redundant bits. of E&C.  The header. Suresha V.  The flag. Professor. composed of protocol-dependent special characters. data to be carried are 8-bit characters from a coding system such as ASCII. which normally carries the source and destination addresses and other control information. D. Sullia. an 8-bit (1-byte) flag is added at the beginning and the end of a frame. Dept. KVG College Of Engineering. are also multiples of 8 bits. signals the start or end of a frame.574 327 7 .  To separate one frame from the next.

1. Sullia. Suresha V.K . KVG College Of Engineering.1 Character-oriented framing approach (cont’d…) ( for reference only) A character stream. (b) With one error. D. (a) Without errors.574 327 8 .FRAMING (cont…) 1. Professor. of E&C. Dept.

Hence No longer used.Simple framing method. 3.FRAMING (cont…) 1. 2. the receiver knows that the frame is bad there is no way to tell where the next frame starts. 4. Dept. Asking for retransmission doesn’t help either because the start of the retransmitted frame is not known. The flag could be selected to be any character not used for text communication. KVG College Of Engineering. of E&C. 3. Disadvantage: 1. Character-oriented framing was popular when only text was exchanged by the data link layers. D.574 327 9 . What if the count is garbled. Professor. Suresha V.1. Even if with checksum. Sullia.K .1 Character-oriented framing approach (cont’d…) Advantage: 1 . 2.

KVG College Of Engineering.1. Dept. Sullia.2 Starting and ending character with byte stuffing  Byte stuffing is the process of adding 1 extra byte whenever there is a flag or escape character in the text.FRAMING (cont…) 1. Professor.K .574 327 10 . D. Figure : Byte stuffing and unstuffing Suresha V. of E&C.

Suresha V.574 327 11 .1.FRAMING (cont…) 1.2 Starting and ending character with byte stuffing (cont’d…. D. KVG College Of Engineering. Professor. Sullia. Dept. of E&C.) Fig: Framing with byte stuffing  Problem : fixed character size : assumes character size to be 8 bits : can’t handle heterogeneous environment.K .

we need to somehow inform the receiver that this is not the end of the frame. Professor. as shown in Figure below  This flag can create the same type of problem.That is. if the flag pattern appears in the data. of E&C. Dept. Sullia. so that the receiver does not mistake the pattern 0111110 for a flag.  We do this by stuffing 1 single bit (instead of I byte) to prevent the pattern from looking like a flag. KVG College Of Engineering.574 327 12 . Most protocols use a special 8-bit pattern flag 01111110 as the delimiter to define the beginning and the end of the frame. The strategy is called bit stuffing.FRAMING (cont…)  Bit-Oriented framing approach  Bit stuffing is the process of adding one extra 0 whenever five consecutive 1’s follow a 0 in the data. Suresha V.1.K . D.

FRAMING (cont…) 1.K . Professor. Dept. Figure : KVG Bit College stuffing and unstuffing Suresha V. of E&C.)  Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data.2 Bit-Oriented framing approach (cont’d…. Of Engineering.574 327 13 . D. so that the receiver does not mistake the pattern 0111110 for a flag.1. Sullia.

Suresha V.574 327 14 .FRAMING (cont…) 1. Professor.1.)  Fig: Framing with bit stuffing (a) The original data.K . KVG College Of Engineering. (c) The data as they are stored in receiver’s memory after destuffing. Dept. of E&C.2 Bit-Oriented framing approach (cont’d…. Sullia. (b) The data as they appear on the line. D.

 Flow control ensures that a transmitting station does not overflow a receiving station with data  Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment.K . Professor. Sullia. 2. KVG College Of Engineering. Flow Control  Flow Control is a technique for speed matching of transmitter and receiver. 1. Dept. FLOW AND ERROR CONTROL 2.2. Collectively. Suresha V. of E&C. D.574 327  15 . these functions are known as Data Link Control (DLC).  The most important responsibilities of the data link layer are  Flow Control  Error Control.

Sullia. of E&C. D.  Error control in the data link layer is based on automatic repeat request (ARQ) which is the retransmission of data. Suresha V. AND ERROR CONTROL 2. KVG College Of Engineering. Error Control  Error control is both error detection and error correction..  It allows the receiver to inform the sender of any frames lost or damaged in transmission and coordinates the retransmission of those frames by the sender. Professor.574 327 16 . 2 FLOW 2. Dept.K .

K . DATA LINK PROTOCOLS ***  Here it explains how the data link layer can combine framing. KVG College Of Engineering. D. and error control to achieve the delivery of data from one node to another.574 327 17 .  Figure shows Taxonomy of protocols are used in data link layer Suresha V. Dept. of E&C. Professor. Sullia.  The protocols are normally implemented in software by using one of the common programming languages. flow control.3 .

KVG College Of Engineering.K .1 Simplest Protocol (unrestricted ideal protocol) The following assumption has been made for developing the (algorithm) simplex protocol  The channel is a perfect noiseless channel. duplicated.  Hence an ideal channel in which no frames are lost. Sullia.1.  It is a unidirectional protocol in which data frames are traveling in only one direction. Professor.574 327 18 . Dept.3. D.  Both transmitting and receiving network layer are always Suresha V. or corrupted.from the sender to receiver.  No flow control and error control used. of E&C.

 Design : Figure shows The design of the simplest protocol with no flow or error control Suresha V.K .574 327 19 . Dept. KVG College Of Engineering. Sullia. Professor. D. of E&C.

574 327 20 .1 Sender-site algorithm for the simplest protocol Suresha V. KVG College Of Engineering. Dept. Professor. Algorithm 3. Algorithms for Simplest Protocol Algorithm 3.K .1 shows the procedure at the sender site. D. Sullia. of E&C.

Sullia. Algorithms for Simplest Protocol Algorithm 3. of E&C.574 327 21 . KVG College Of Engineering. 2 Receiver-site algorithm for the simplest protocol Suresha V.2 shows the procedure at the receiver site. D. Professor.K . Algorithm 3. Dept.

It is very simple.K . D. Suresha V.  The sender sends a sequence of frames without even thinking about the receiver. Example for simplex protocol  Figure below shows an example of communication using this protocol. KVG College Of Engineering.574 327 Figure : Flow diagram for above Example 22 . of E&C. Professor. Dept. Sullia.  To send three frames. 4. three events occur at the sender site and three events at the receiver site.

 Efficiency analysis
 Transmission in one direction
 The receiver is always ready to receive the next frame (has infinite
buffer storage).
 Error-free communication channel.
 No acknowledgments or retransmissions used.
 If frame has

d data bits and h overhead bits, channel bandwidth

b bits/second:
Maximum Channel Utilization = data size / frame size = d / (d
One way
Data Fram
transmission
+ h)
Channel delay
Data Frame
1
time = ( d+h )
or latency l
Maximum Data Throughput
=e d / (d + h ) * channel
Data F
2
Frame

ram
Data Frame
3
where
e
bandwidth
= d / (d + h ) * b
4Data Frame
b = channel
5Data Frame
bandwidth
6: :
/b

Sender

:
:

:
:

Receiver

Suresha V. Professor, Dept. of E&C, KVG College Of Engineering. Sullia, D.K - 574 327

23

1. The following assumption has been made for developing the

(algorithm) Stop-andWait Protocol
 The channel is a perfect noiseless channel.

Flow control used

It is a bidirectional protocol in which frames are traveling
in both direction

Both transmitting and receiving network layer are always
not ready.

Processing time considerable

Finite buffer space is available

Suresha V. Professor, Dept. of E&C, KVG College Of Engineering. Sullia, D.K - 574 327

24

 Simplex: Data transmission in one direction
 The receiver may not be always ready to receive the next frame (finite buffer
storage).
 Receiver sends a positive acknowledgment frame to sender to transmit the next
data frame.
 Error-free communication channel assumed.
No retransmissions used.
 Maximum channel utilization » (time to transmit frame /round trip
time) * d / (d + h)
» d / (b * R)
 Maximum data throughput
» Channel Utilization * Channel
Time
Bandwidth
Data»Frad/
Round trip
m(b
e * R) * b = d / R
1
time, R

Frame
t
n
e
m
ledg
Acknow

Data Fram
e
2

Sender

Frame
t
n
e
m
g
led
Acknow

Receiver

Suresha V. Professor, Dept. of E&C, KVG College Of Engineering. Sullia, D.K - 574 327

25

KVG College Of Engineering. Sullia.2. Dept. D. of E&C.K . Professor. Design Figure shows Design of Stop-and-Wait Protocol Suresha V.574 327 26 .

Dept. KVG College Of Engineering.1 Sender-site algorithm for the Stop-and-Wait Protocol Suresha V.K . of E&C.3. Algorithms Algorithm 3. Professor. D. Sullia.574 327 27 .

K . of E&C. Sullia.2 shows the procedure at the receiver site. Algorithm 3. KVG College Of Engineering. 2 Receiver-site algorithm for the Stop-and-Wait Protocol Suresha V.2. Professor. Dept.574 327 28 . Algorithms Algorithm 3. D.

When the ACK arrives.574 327 29 . D. Sullia. KVG College Of Engineering. Dept. the sender sends the next frame. Note that sending two frames in the protocol involves the sender in four events and the receiver in two events.4.K . of E&C. Professor. Figure : Flow diagram for above Example Suresha V. Example for Stop-and-Wait protocol • • • The sender sends one frame and waits for feedback from the receiver.

KVG College Of Engineering. Sullia. hence error occur.  We discuss three protocols in this section that use error control.  Stop-and-Wait Automatic Repeat Request(ARQ) ***  Go-Back-N Automatic Repeat Request (ARQ) ***  Selective Repeat Automatic Repeat Request (ARQ) ***  Automatic Repeat Request(ARQ) Purpose: To ensure a sequence of information packets is delivered in order and without errors or duplications despite transmission errors & losses Suresha V. of E&C. Professor.  Noiseless channels are nonexistent. D.K .574 327 30 . Stop-and-Wait Protocol gives us an idea of how to add flow control. Dept.

K . timer is set ! If no ACK or NAK is received during timeout period. Dept. causing sender to re-send the frame.  In case a frame never got to receiver. sender has a timer: each time a frame is sent.574 327 retransmits a frame but receiver actually received the previous 31 . D. Professor. it resends the frame  Timer introduces a problem: Suppose timeout and sender Suresha V. For noisy link. pure stop and wait protocol will break down. of E&C. it discards the frame and send a negative ACK (NAK). KVG College Of Engineering. is incorporated with stop and wait flow control protocol  If error is detected by receiver. and solution is to incorporate some error control mechanism  Stop and wait with ARQ: Automatic Repeat reQuest (ARQ). an error control method. Sullia.

Professor. 5.NOTE: 1.K .574 327 32 . 4. use sequence numbers to number the frames. An important link parameter is defined by a = propagation time / frame time = R d / V L where R = data rate (bps) d = link distance (m) V = propagation velocity (m/s) L = frame Length (bits) 2. The sequence numbers are based on modulo-2 arithmetic. Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires 3. In Stop-and-Wait ARQ. V. KVG College Of Engineering. the acknowledgment number always announces in modulo-2 arithmetic the sequence number of the next frame Suresha expected. D. Dept. In Stop-and-Wait ARQ. of E&C. Sullia.

KVG College Of Engineering. of E&C.1. D. 2 Design ( Figure shows Design of the Stop-and-Wait ARQ Protocol ) Suresha V. Professor. Dept.K .574 327 33 . Sullia.

574 327 34 . D. Dept.d…) Algorithm :Sender-site algorithm for Stop-and-Wait ARQ Suresha V. Sullia. KVG College Of Engineering. Professor.1.K . of E&C. Stop-and-Wait ARQ (Automatic Repeat Request) protocol (cont.

K .d…) Algorithm :Sender-site algorithm for Stop-and-Wait ARQ (continued) Suresha V. Sullia.1.574 327 35 . Dept. D. of E&C. Professor. KVG College Of Engineering. Stop-and-Wait ARQ (Automatic Repeat Request) protocol (cont.

Stop-and-Wait ARQ (Automatic Repeat Request) protocol (cont.1. Sullia. of E&C. Professor. D.574 327 36 .K .d…) Algorithm : Receiver-site algorithm for Stop-and-Wait ARQ Protocol Suresha V. KVG College Of Engineering. Dept.

so after the time-out. The resent frame 1 is acknowledged and the timer stops.1. which is 37 Suresha V. The sender has no idea if the frame or the acknowledgment is lost. 6. it resends frame0.d…) Example 1. Frame 1 is lost and resent after the time-out. 5. Sullia. Frame 0 is sent and acknowledged. Event : 1.K .  Figure 1 shows an example of Stop-and-Wait ARQ.574 327 . Stop-and-Wait ARQ (Automatic Repeat Request) protocol (cont. Frame 0 is sent and acknowledged. KVG College Of Engineering. but the acknowledgment is lost. 3. 2. of E&C. Dept. Professor. 4. D.

574 327 38 .d…) Figure : Flow diagram for Example 1 Suresha V.1. of E&C.K . KVG College Of Engineering. Sullia. Stop-and-Wait ARQ (Automatic Repeat Request) protocol (cont. D. Dept. Professor.

Professor. Dept. Stop-and-Wait ARQ (Automatic Repeat Request) protocol (cont.000 bits during the time it takes for the data to go from the sender to the receiver and then back again. the bandwidth of the line is 1 Mbps. D. what is the utilization percentage of the link? Solution  The bandwidth-delay product (capacity) is= B.574 327 39 . and 1 bit takes 20 ms to make a round trip. Sullia. KVG College Of Engineering. of E&C.d…)  Efficiency of Stop-and-Wait ARQ  Example 1  Assume that.  Then link utilization = data size/ bandwidth-delay product (channel capacity) Suresha V.  However. the system sends only 1000 bits. What is the bandwidth-delay product? If the system data frames are 1000 bits in length.1. in a Stop-and-Wait ARQ system.K .W * Delay per bit  Analysis: The system can send 20.

if there are damaged frames.K . Professor. of E&C.3 Efficiency of Stop-and-Wait ARQ (cont’d…)  Example 2 What is the utilization percentage of the link in Example 1 if we have a protocol that can send up to 15 frames before stopping and worrying about the acknowledgments? Solution   The bandwidth-delay product is still 20.574 327 40  Pipelining improves the efficiency of the transmission if the number . Dept.1. KVG College Of Engineering.000/20. D. Sullia.  Remedy for increasing the efficiency is Pipelining  Pipelining : several frames can be sent before we receive news about the previous frames. or 75 percent.  Of course. the utilization percentage is much less because frames have to be resent.000.000 bits.  Percentage of utilization is 15. The system can send up to 15 frames or 15. Suresha V.000(1000 bits/frame) bits during a round trip.

KVG College Of Engineering. sender window size is 1( disadvantage over Go back N ARQ) 6. Sullia. Efficiency is very less. of E&C. D. Only 1 frame is sent at a time 3.K . It has timer implementation  Disadvantages of stop and wait ARQ 1. receiver window size is 1( disadvantage over selective repeat ARQ) Suresha V. It can be used for noisy channels 2. Dept.1.3 Efficiency of Stop-and-Wait ARQ (cont’d…)  Advantages of stop and wait ARQ 1. Professor. Timer should be set for each individual frame 4. It has both error and flow control mechanism 3.574 327 41 . 2. No pipelining 5.

13.9.  To improve the efficiency of transmission multiple frames must be in transition while waiting for acknowledgment. we can repeat the sequence. Improve Stop-and-Wait by not waiting. 15. 12. Professor. 11.K .  Sequence numbers are modulo 2m.8. So the sequence numbers are 0. D.where m is the size of the sequence number field in bits.  keep a copy of these frames until the acknowledgments arrive. 10. the only sequence numbers are 0 through 15 inclusive.5. if m is 4.3.4.2. of E&C.6. However.  For example.574 327 42 . 7. KVG College Of Engineering. 14. Dept.0.  Use m-bit sequence numbering.  Keep channel busy by continuing to send frames.  Several frames are send before receiving acknowledgments. Sullia. Suresha V. 1.

 Label each packet with a sequence number  A window is a collection of adjacent sequence numbers  The range which is the concern of the sender is called the send sliding window Suresha V. Sullia. Dept.K . of E&C. KVG College Of Engineering. D. Professor.  The sender and receiver need to deal with only part of the possible sequence numbers. Concept  Introduce a window of size n  Can inject n packets into net before hearing an ACK  Sliding window  Sliding window is an abstract concept that defines the range of sequence numbers that is the concern of the sender and receiver.574 327 43 .

Figure 3: Send window for Go-Back-N ARQ Suresha V. of E&C. D. Professor. Dept. KVG College Of Engineering.574 327 44 .K . Sullia.

Sullia. The send window is an imaginary box covering the sequence numbers of the data frames which can be in transit.  First Region: It defines the sequence numbers belonging to frames that are already acknowledged  Second Region: It defines the range of sequence numbers belonging to the frames that are sent and have an unknown status.”  Third Region: It defines the range of sequence numbers for frames that can be sent. but not yet been received from the network layer. of E&C. Professor. KVG College Of Engineering.K .  Fourth Region: It defines sequence numbers that cannot be used Suresha V. D. Dept.  The window at any time divides the possible sequence numbers into four regions. call these “outstanding frames.574 327 until the window slides 45 .

KVG College Of Engineering.)  The send window can slide one or more slots when a valid acknowledgment arrives Figure 4 : Receive window for Go-Back-N ARQ  The receive window is an abstract concept defining an imaginary box of size 1 with one single variable Rn.3.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d…. D. Professor. sliding occurs Suresha V. The window slides when a correct frame has arrived. Dept.574 327 46 one slot at a time . of E&C. Sullia.K .

Dept.  Acknowledgment  The receiver sends a positive acknowledgment if a frame has arrived safe and sound and in order.574 327 47 .K . beginning with the Suresha V. causes the sender to go back and resend all frames.3.  The reason is that the timer for the first outstanding frame always expires first.)  Timers  Although there can be a timer for each frame that is sent.one of E&C. KVG College Of Engineering. Professor. in this protocol use only one.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….  If a frame is damaged or is received out of order.  The silence of the receiver causes the timer of the unacknowledged frame at the sender site to expire. D. Sullia.  This. in turn. the receiver is silent and will discard all subsequent frames until it receives the one it is expecting. send all outstanding frames when this timer expires.

Professor. Suresha V. That is why the protocol is called Go-Back-N ARQ.)  Resending a Frame  When the timer expires.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….5. 4.K . KVG College Of Engineering. Sullia.574 327 48 . and 6 again. D. the sender resends all outstanding frames. the sender goes back and sends frames 3. Dept.3. suppose the sender has already sent frame 6. of E&C. but the timer for frame 3 expires.  This means that frame 3 has not been acknowledged. For example.

K .2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d…. Professor. Dept. of E&C. KVG College Of Engineering.3.574 327 49 . D.) Figure 5 : Design of Go-Back-N ARQ Suresha V. Sullia.

KVG College Of Engineering. Professor. Sullia. of E&C. Send Window Size  o  In Go-Back-N ARQ.574 327 50 . Dept.K . D. the size of the receiver window is always 1. Figure 6 Window size for Go-Back-N ARQ Suresha V. the size of the send window must be less than 2m .

)  Algorithms ( Algorithm. of E&C. D. KVG College Of Engineering.3. Professor. Sullia. Dept.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….K .574 327 51 .7 Go-Back-N sender algorithm) (continued) Suresha V.

of E&C. D. Sullia.7 Go-Back-N sender algorithm) (continued) Suresha V. KVG College Of Engineering.)  Algorithms ( Algorithm. Professor.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….3.K .574 327 52 . Dept.

K .574 327 53 .)  Algorithms : Go-Back-N receiver algorithm Suresha V.3.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d…. KVG College Of Engineering. Sullia. Dept. D. Professor. of E&C.

arrival events are triggered by acknowledgments from the physical layer. ACK 3 serves as both ACK 2 .K . KVG College Of Engineering. Professor.  After initialization. D. Sullia.  There is no time-out event here because all outstanding frames are acknowledged before the timer expires. Suresha V.574 327  54 Note that although ACK 2 is lost.3.  No data frames are lost. of E&C. but some ACKs are delayed and one is lost. Dept. there are seven sender events.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)  Example 1  Figure 1 shows an example of Go-Back-N.  This is an example of a case where the forward channel is reliable. but the reverse is not. Request events are triggered by data from the network layer.  The example also shows how cumulative acknowledgments can help if acknowledgments are delayed or lost.

D.3. KVG College Of Engineering. of E&C. Sullia.574 327 55 .K . Professor.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)  Example 1 ( Figure 1 Flow diagram for Example 1) Suresha V. Dept.

The receiver receives frames 2 and 3.K . the sender is still busy with sending frame 3. This means that when ACK 2 arrives. or 3.  When the sender is responding to this event. frame 1 is lost.  Frames 0. Dept.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d…. Note that the resending of frames 1. Sullia.  The sender sends all outstanding frames (1. It is the same Suresha V. but they are discarded because they are received out of order. 2. and 3 is the response to one single event. D.  We have shown a vertical line to indicate the delay. 2.3. 2. 2.  The sender receives no acknowledgment about frames 1. KVG College Of Engineering. of E&C. However.  The physical layer must wait until this event is completed and the data link layer goes back to its sleeping state. it cannot accept the triggering of other events. 1. Its timer finally expires. Professor.) Example 2   Figure 5 shows what happens when a frame is lost. and 3) because it does not know what is wrong.574 327 56 . and 3 are sent.

KVG College Of Engineering.574 327 57 . Professor. of E&C. D.3.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d…. Sullia.K . Suresha V.) Example 2 ( Figure 5 Flow diagram for Example 2)  Stop-and-Wait ARQ is a special case of Go-Back-NARQ in which the size of the send window is 1. Dept.

574 327 58 . KVG College Of Engineering. D.  Timer can be set for a group of frames. Dept.  Efficiency is more. Waiting time is pretty low. a lot of BW is wasted If NACK is lost . We can alter the size of the sender window  Disadvantages: This protocol is very inefficient for a noisy link.  Only one ACK can acknowledge one or more frames.3 Selective Repeat Automatic Repeat Request  Advantages: The sender can send many frames at a time. Suresha V. a long time is wasted until re-transmission of all packets (until another NACK is sent). Buffer requirement: Transmitter needs to store the last N packets Scheme is inefficient when round-trip delay large and data transmission rate is high Retransmission of many error-free packets following an erroneous packet When RTT is large: for a high number of NACK. Professor. of E&C. Sullia.3.K .

3.K . but the processing at the Suresha V. Dept. It is more efficient for noisy links. 59 . Sullia.”  Selective Repeat retransmits only an individual frame. there is another mechanism that does not resend N frames when just one frame is damaged. only the damaged frame is resent. This mechanism is called “Selective Repeat ARQ. D.574 327 receiver is more complex. KVG College Of Engineering.  NAK causes retransmission of oldest un-Acked frame.3 Selective Repeat Automatic Repeat Request***  Go-Back-N ARQ inefficient because multiple frames are resent when errors or losses occur  For noisy links. of E&C. Professor.  Timeout causes individual corresponding frame to be resent.

of E&C.3 Selective Repeat Automatic Repeat Request (cont…)  Type Of Windows  Figure 3. Sullia. Dept.K . KVG College Of Engineering.2 Receive window for Selective Repeat ARQ Suresha V.574 327 60 . D. Professor.3.3.1 Send window for Selective Repeat ARQ  Figure 3.3.

Second. KVG to College Engineering.  The protocol uses the same variables as we discussed for Go-BackN. there are differences between the windows in this protocol and the ones in Go-Back-N.  The smaller window size means less efficiency in filling the pipe.  This Protocol allows as many frames as the size of the receive window to arrive out of order and be kept until there is a set of inSuresha V.K .3. Dept. D.3 Selective Repeat Automatic Repeat Request (cont…)  Windows Description  This Protocol also uses two windows: a send window and a receive window. • • First. of E&C. Professor.  However.574 327 order frames to be delivered theOfnetwork 61 .layer. but the fact that there are fewer duplicate frames can compensate for this. the receive window is the same size as the send window. the size of the send window is much smaller. Sullia.

3 Selective Repeat Automatic Repeat Request (cont…) Figure 3. Professor. KVG College Of Engineering.3 Design of Selective Repeat ARQ Suresha V.574 327 62 . of E&C. D.3. Sullia. Dept.K .3.

Sullia. KVG College Of Engineering. window size Suresha V.3 Selective Repeat Automatic Repeat Request (cont…)  window size  In Selective Repeat ARQ. the size of the sender and receiver window must be at most one half of 2m Figure 3.574 327 63 . of E&C.3.3. Dept. D.4 Selective Repeat ARQ.K . Professor.

of E&C. Sullia. Dept.574 327 64 .3.3 Selective Repeat Automatic Repeat Request (cont…) Algorithms: Sender-site Selective Repeat algorithm continued) Suresha V. D. Professor. KVG College Of Engineering.K .

KVG College Of Engineering.574 327 65 . Dept.3 Selective Repeat Automatic Repeat Request (cont…) Algorithms: Sender-site Selective Repeat algorithm (continued) continued) Suresha V.K . of E&C. D.3. Sullia. Professor.

D.574 327 66 .K . Dept. of E&C. Professor. KVG College Of Engineering.3 Selective Repeat Automatic Repeat Request (cont…) Algorithms: Sender-site Selective Repeat algorithm (continued) Suresha V. Sullia.3.

Dept.3.574 327 67 .K .3 Selective Repeat Automatic Repeat Request (cont…) Algorithm : Receiver-site Selective Repeat algorithm (continued Suresha V. D. Professor. Sullia. of E&C. KVG College Of Engineering.

Professor.3 Selective Repeat Automatic Repeat Request (cont…) Algorithm : Receiver-site Selective Repeat algorithm (continued) Suresha V. D. Sullia. Dept.K .574 327 68 . of E&C. KVG College Of Engineering.3.

of Only E&C. Figure 3.  At the receiver site we need to distinguish between the acceptance of a frame and its delivery to the network layer. which means that the timers need to be numbered (0. frame 3 arrives and is marked and stored. but it cannot be delivered because frame 1 is missing.  The timer for frame 0 starts at the first request. restarts when a NAK arrives. at the lastOfarrival.574 327 69 . Dept. frame 2 arrives and is stored and marked.  One main difference is the number of timers.K .  The timer for frame 1 starts at the second request.Example 1: Selective Repeat Automatic Repeat Request  In this example frame 1 is lost.4. Here. Professor. Sullia. KVG College Engineering.  At the second arrival.  At the next arrival. but still none of the frames can be delivered. D. 1. but stops when the ACK for this frame arrives. and 3). 2. each frame sent or resent needs a timer. It show how Selective Repeat behaves in this case. and finally stops when the last ACK arrives.1shows the situation. The other two timers start when the corresponding frames are sent and stop at the last arrival event. Suresha V.

the set starts from the beginning of the window.Example for Selective Repeat Automatic Repeat Request (cont’d…. Suresha V. D.  The second NAK would still be NAK1 to inform the sender to resend frame 1 again. a set of consecutive frames must have arrived.  The reason is that the protocol does not want to crowd the network with unnecessary NAKs and unnecessary resent frames.574 327 70 . Dept. although both situations look the same. this has already been done. but not after the third. Sullia. Notice that only two ACKs are sent here.  The first NAK sent is remembered (using the nakSent variable) and is not sent again until the frame slides. KVG College Of Engineering. Another important point is that a NAK is sent after the second arrival.  Second. of E&C.K . Professor.)  There are two conditions for the delivery of frames to the network layer: First.The next point is about the ACKs.  A NAK is sent once for each window position and defines the first slot in the window.

574 327 71 .Figure 5 Flow diagram for Example 1 Suresha V. Sullia. Dept. KVG College Of Engineering. of E&C. Professor.K . D.

D. Professor.Piggybacking  The three protocols discussed in the previous section are all unidirectional: data frames flow in only one direction although control information such as ACK and NAK frames can travel in the other direction.K . it can also carry control Suresha V.  When a frame is carrying data from A to B.  A technique called piggybacking is used to improve the efficiency of the bidirectional protocols.5.  In real life. data frames are normally flowing in both directions: from node A to node B and from node B to node A. KVG College Of Engineering. This means that the control information also needs to flow in both directions. Dept. of information about E&C. Sullia.574 327 72 .

 However. of E&C.K . Suresha V.)  Both are involved in three types of events: request.. D.574 327 73 . Professor.Piggybacking (cont. the arrival event here is complicated. Sullia. the arrival event.  An important point about piggybacking is that both sites must use the same algorithm.5. the site needs to handle control information as well as the frame itself.  The request event uses only the send window at each site. the arrival event needs to use both windows. arrival.  This algorithm is complicated because it needs to combine two arrival events into one. and time-out. when a frame arrives.  Both of these concerns must be taken care of in one event. Dept. KVG College Of Engineering.

Professor. KVG College Of Engineering. of E&C. D.K .1 : Design of piggybacking in Go-Back-N ARQ Suresha V. Sullia. Dept.574 327 74 .Figure 5.

K . D.A 2^(m-1) Pipelining Implemented Not Implemented Implemented Out of order Frames Discarded Discarded Accepted Cumulative ACK Applicable N.A 2^(m-1) Maximum receiver Size Window 1 N. Dept.COMPARISON CHART PROTOCOL:- GO-BACK-N STOP AND WAIT SELECTIVE REPEAT Bandwidth utilization Medium Low High Maximum sender Size Window 2^m-1 N. Professor. KVG College Of Engineering. Sullia.A N.A Applicable NAK N. of E&C.574 327 75 .A Applicable Suresha V.

• All are bit oriented.  HDLC is Mother of many LAN and WAN DLC protocols.K .574 327 76 . Dept.6 .  This protocol based on some principles. HDLC (High-Level Data Link Control ) **** INTRODUCTION :  Old and still heavily used protocol. of E&C. • All uses bit stuffing for data transferency. Sullia. D. Professor.  It is a classical bit-oriented protocol for communication over pointto-point and multipoint links. It implements the ARQ mechanisms. Suresha V. KVG College Of Engineering.

controls the link with commands o Secondary station : receives data. Sullia.Asynchronous balanced mode (ABM).Normal response mode (NRM) .  Normal response mode (NRM) o Used with unbalanced configuration o Unbalanced: one primary station. secondary can only reply o The NRM is used for both point-to-point and multiple-point links o Primary station : sends data.K . KVG College Of Engineering.) Configurations and Transfer Modes Of HDLC  HDLC provides two common transfer modes that can be used in different configurations: . 6 . responds to control messages o Combined station : can issue both commands and responses Suresha V. one or more secondary stations o Primary initiates data transfer. D. HDLC (High-Level Data Link C ontrol ) (cont. of E&C.574 327 77 .. Professor. Dept.

6 . HDLC (High-Level Data Link Control ) (cont..)

Normal response mode (NRM)
-

Figure : Normal response mode
Suresha V. Professor, Dept. of E&C, KVG College Of Engineering. Sullia, D.K - 574 327

78

6.

HDLC (High-Level Data Link Control ) (cont..)

 Asynchronous balanced mode (ABM):
 Used with balanced configurations.
 Balanced: two combined stations.
 Either side may send data at any time.

Suresha V. Professor, Dept. of E&C, KVG College Of Engineering. Sullia, D.K - 574 327

79

HDLC Frames ****
 To provide the flexibility necessary to support all the options

possible in the modes and
configurations, HDLC defines three types of frames:
(1) Information frames (I-frames)
(2) Supervisory frames (S-frames)
(3) Unnumbered frames (V-frames).
 Each type of frame serves as an envelope for the transmission

of a different type of
message.
 I-frames are used to transport user data and control
information relating to user
data (piggybacking).
 S-frames are used only to transport control information.
Suresha V. Professor, Dept. of E&C, KVG College Of Engineering. Sullia, D.K - 574 327
80
 V-frames
are reserved for system management. Information

574 327 81 .K . D. of E&C. Sullia. KVG College Of Engineering.HDLC Frames  HDLC overall frame format octets 01111110 1 Address variable Control data CRC 1 or 2 variable 2 or 4 FS ITU-T versions of the CRC are used frame separator (FS): bit stuffing used for all fields between separators Suresha V. Dept. Professor.

of E&C. Professor. D. Flag Field.574 327 82 . Ending Flag Field. as shown in Figure below a beginning 1.K . Control Field. 6. Dept. 5. Address Field. the ending flag of one frame can serve as the beginning flag of the next frame. Sullia. 2. 3. Suresha V. KVG College Of Engineering. Frame Check Sequence (FCS) Field.  In multiple-frame transmissions. Information Field. 4.HDLC Frames Description ***  Each frame in HDLC may contain up to six fields.

Professor. KVG College Of Engineering. Dept. of E&C. D.) 1. Flag field :  The flag field of an HDLC frame is an 8-bit sequence with the bit pattern 01111110 that identifies both the beginning and the end of a frame and serves as a synchronization pattern for the receiver.K . (Figure for reference only) fig: HDLC Flag Field Suresha V. Sullia.574 327 83 ..HDLC Fields Description (cont.

depending on the needs of the network.  Ending each intermediate byte with 0 indicates to the receiver that there are more address bytes to come.  An address field can be 1 byte or several bytes long. the last bit is always a 1. Dept.Address field :  The second field of an HDLC frame contains the address of the secondary station. it contains a to address. Sullia. Professor.  If the address is more than 1 byte.  If the address field is only 1 byte. D.  If a primary station created the frame.  One byte can identify up to 128 stations.  Larger networks require multiple-byte address fields. of E&C. only the last will end with 1. it contains a from address.HDLC Fields Description (continue) 2. Suresha V. all bytes but the last one will end with 0.  If a secondary creates the frame. KVG College Of Engineering.K .574 327 84 .

KVG College Of Engineering.HDLC Fields Description (continue) 2. D. Sullia. Professor.574 327 85 . Dept. of E&C.Address field : (Fig for reference only) Suresha V.K .

this is the final octet of the address . Sullia. Professor.574 327 86 . of E&C. D.if 0. as the address is not relevant • An address of 11111111 represents “all” Suresha V.HDLC Fields Description (continue) 2. the value of the field will be 10000000. another address octet follows • If the link is strictly point-to-point. KVG College Of Engineering. Dept.if 1.K .Address field : bits 7 1 address F (for reference only) • F bit: .

574 327 87 . KVG College Of Engineering. o Its length can vary from one network to another.or 2-byte segment of the frame used for flow and error control. 5. Dept. of E&C. Professor.HDLC Fields Description (continue) 3. FCS field o The frame check sequence (FCS) is the HDLC error detection field. 4. Suresha V. It can contain either a 2. Sullia.K . o The interpretation of bits in this field depends on the frame type. D.Control field o The control field is a 1.or 4-byte ITU-T CRC. Information field o The information field contains the user's data from the network layer or management information.

K . Sullia. D. Dept. as shown in Figure below Figure : Control field format for the different frame types Suresha V. KVG College Of Engineering. Professor. of E&C. o The format is specific for the type of frame.HDLC Frame format  Control Field for different frame types o The control field determines the type of frame and defines its functionality.574 327 88 .

D.K . Sullia.574 327 89 .HDLC Frame format  Control Field for different frame types Fig for reference only) Suresha V. KVG College Of Engineering. Professor. Dept. of E&C.

control field is 2 bytes  N(R) Receive Sequence Number • The last 3 bits used • It correspond to the acknowledgment number when Suresha V.HDLC Frame format 1. 90 . KVG College Of Engineering. E&C. Control Field for I-Frames o I-frames are designed to carry user data from the network layer. D.574 327 piggybacking isofused. Sullia. o They can include flow and error control information (piggybacking).K . Professor. o The subfields in the control field are used to define following functions.  The first bit defines the type. • Extension format.  First bit of the control field = 0  N(S) Sequence Number Of The Sent Frame • 3 Bits Used. • Sequence number between 0 and 7. Dept.

of E&C. Sullia. • In all other cases. KVG College Of Engineering.HDLC Frame format 1.574 327 91 . Control Field for I-Frames (cont.K .. D. Suresha V. • It is called Poll when set by the primary station to obtain a response from a secondary station • Final when set by the secondary station to indicate a response or the end of transmission. Dept.)  The P/F bit • The single bit between N(S) and N(R) is called the P/F bit. • Poll/Final is a single bit with two names. the bit is clear. Professor.

this means the frame is Suresha V. Dept.HDLC Frame format 2. Professor.K .  S-frames do not have information fields. KVG College Of Engineering. Sullia.  If the first 2 bits of the control field is 10.g. when the station either has no data of its own to send or needs to send a command or response other than an acknowledgment).574 327 an S-frame. Control Field for S-Frames  Supervisory frames are used for flow and error control whenever piggybacking is either impossible or inappropriate (e. D. of E&C. 92 ..

 This kind of frame acknowledges the receipt of a safe and sound frame or group of frames.Receive ready (RR). Suresha V. Sullia. the value N(R) field defines the acknowledgment number. Dept. it is an RR S-frame. as described below: Fig: reference only 1.574 327 93  In this case. D.HDLC Frame format 2. of E&C. With 2 bits. Control Field for S-Frames (cont…)  The 2 bits called code is used to define the type of S-frame itself. .K . we can have four types of S-frames. KVG College Of Engineering.  If the value of the code subfield is 00. Professor.

that Suresha V. D. the Professor. 3. Receive not ready (RNR).  If the value of the code subfield is 10. it is a REJ S-frame. Sullia.  It is a NAK that can be used in Go-Back-N ARQ to improve the efficiency of the process by informing sender. Reject (REJ).K the . Control Field for S-Frames (cont…) 2. it is an RNR S-frame.  This kind of frame is an RR frame with additional functions.  The value of N(R) is the acknowledgment number. the KVG College Engineering.  It acknowledges the receipt of a frame or group of frames. but not like the one used for Selective Repeat ARQ. senderOftime expires.2.  It acts as a kind of congestion control mechanism by asking the sender to slow down. and it announces that the receiver is busy and cannot receive more frames.before of E&C.  If the value of the code subfield is 01.  This is a NAK frame.574last 327 frame 94is . Dept.

Control Field for S-Frames (cont…) 4. of E&C. Dept.Selective reject (SREJ).  This is a NAK frame used in Selective Repeat ARQ.  The value of N(R) is the negative acknowledgment number.2. it is an SREJ S-frame.  If the value of the code subfield is 11.574 327 95 . KVG College Of Engineering. D.  Note that the HDLC Protocol uses the term selective reject instead of selective repeat. Professor. Suresha V. Sullia.K .

Professor. of E&C. Dept. D.HDLC Format Use of P/F Field (For reference only) Suresha V. KVG College Of Engineering.574 327 96 .K . Sullia.

Dept. Sullia. KVG College Of Engineering.K . Professor.574 327 97 . D. of E&C.HDLC Format Use of P/F Field( For reference only) Suresha V.

Professor. of E&C.574 327 98 . Dept.K .HDLC Format Use of P/F Field (for reference only) Suresha V. D. Sullia. KVG College Of Engineering.

HDLC Format Use of P/F Field( For reference only) Suresha V. Dept.574 327 99 . D. KVG College Of Engineering. of E&C.K . Sullia. Professor.

K .HDLC Format Use of P/F Field( For reference only) Suresha V. KVG College Of Engineering. Professor. D.574 327 100 . Dept. of E&C. Sullia.

Control Field for V-Frames  Unnumbered frames are used to exchange session management and control information between connected devices. 101 . D.K .  Unlike S-frames. 3. KVG College Of Engineering. but one used for system management information.  U-frame codes are divided into two sections: a 2-bit prefix before the P/F bit and a 3-bit suffix Suresha V. Professor. not user data. of E&C. Dept. U-frames contain an information field. much of the information carried by U-frames is contained in codes included in the control field..574 327 after the P/F bit. however. Sullia.  As with S-frames.

D. Professor. of E&C. Table 6 U-frame control command and response Suresha V.K . Sullia.. Dept. KVG College Of Engineering.574 327 102 .

After data transfer. of E&C. it is confirmed by node B responding with a UA (unnumbered acknowledgment). Example of connection and disconnection Suresha V. Professor. After these two exchanges.. KVG College Of Engineering.574 327 103 . node B gives a positive response with an unnumbered acknowledgment (UA) frame.9 Figure shown below explain how U-frames can be used for connection establishment and connection release. Sullia. Dept. Node A asks for a connection with a set asynchronous balanced mode (SABM) frame. data can be transferred between the two nodes (not shown in the figure). node A sends a DISC (disconnect) frame to release the connection. Example 11. D.K .

of E&C. it cannot piggyback an acknowledgment onto an I-frame and sends an S-frame instead..10 Figure 11. Node A begins the exchange of information with an I-frame numbered 0 followed by another I-frame numbered 1.30 shows an exchange using piggybacking. 1. KVG College Of Engineering. Node B’s first I-frame is also numbered 0 [N(S) field] and contains a 2 in its N(R) field.574 327 104 . Its N(R) information.K . The RR code indicates that A is still ready to receive. D. Professor. Suresha V. Node A has sent all its data. Example 11. Sullia. The number 3 in the N(R) field tells B that frames 0. Therefore. Node B piggybacks its acknowledgment of both frames onto an I-frame of its own. Node B transmits its second and third Iframes (numbered 1 and 2) before accepting further frames from node A. has not changed: B frames 1 and 2 indicate that node B is still expecting A’s frame 2 to arrive next. therefore. acknowledging the receipt of A’s frames 1 and 0 and indicating that it expects frame 2 to arrive next. Dept. and 2 have all been accepted and that A is now expecting frame number 3.

D. KVG College Of Engineering.K . Figure 11.574 327 105 .. Dept. of E&C. Sullia. Professor.30 Example of piggybacking without error Suresha V.

31 shows an exchange in which a frame is lost. it discards it and sends a REJ frame for frame 1. Note that the protocol being used is Go-Back-N with the special use of an REJ frame as a NAK frame. Node B. and 2). The NAK frame does two things here: It confirms the receipt of frame 0 and declares that frame 1 and any following frames must be resent.. KVG College Of Engineering. Professor. Suresha V. Node B sends three data frames (0. 1. of E&C.K . Node A acknowledges the receipt by sending an RR frame (ACK) with acknowledgment number 3. after receiving the REJ frame. but frame 1 is lost. Sullia.11 Figure 11. D. Example 11. resends frames 1 and 2. When node A receives frame 2. Dept.574 327 106 .

Professor. of E&C.K . Dept.31 Example of piggybacking with error Suresha V. Sullia.. D. Figure 11.574 327 107 . KVG College Of Engineering.

Summary of Data Link Layer .574 327 108 . there is no need for defining the boundaries of frames. KVG College Of Engineering.  Data link control deals with the design and procedures for communication between two adjacent nodes: node-to-node communication. D.  Frames can be of fixed or variable size.  Framing in the data link layer separates a message from one source to a destination. we need a delimiter(flag) to define the boundary of two frames. In fixed-size framing. of E&C. Professor. or from other messages going from other sources to other destinations.  Variable-size framing uses two categories of protocols: byte-oriented (or characterSuresha V. Sullia.K . Dept. in variable-size framing.

Dept. KVG College Of Engineering. Error control V.574 327 109 . of E&C. D.  Flow control refers to a set of procedures used to restrict the amount of data that the sender Suresha can send before waiting for acknowledgment. we use bit stuffing. an extra 0 is added to the data section of the frame when there is a sequence of bits with the same pattern as the flag.  In bit-oriented protocols. we use byte stuffing. a special byte added to the data section of the frame when there is a character with the same pattern as the flag. Professor. Summary of Data Link Layer  In byte-oriented (or character-oriented) protocols.K .. Sullia.

and then sends the next frame. the sender sends one frame.K . Professor. Dept.  For the noisy channel. The Stop-and-Wait ARQ Protocol. SUMMARY of Data Link Layer (cont’d. KVG College Of Engineering. and Selective Repeat ARQ.• . the sender sends its frames one after another with no regards to the receiver. of E&C. G0Back-N.  In the Stop-and-Wait Protocol. adds a simple error control mechanism to the Stop-andWait Protocol. we can send several frames before receivingSuresha acks. three protocols: Stop-and-Wait ARQ.. Sullia. stops until it receives confirmation from the receiver.574 327 110 .V. D.)  In the Simplest Protocol.  In the Go-Back-N ARQ Protocol.

of E&C. it can also carry control information about frames from A. In 00Back. When a frame is carrying data from A to B. Sullia. the most common protocols for point-to-point access is the Point-to-Point Protocol (PPP). the size of the receiver window is always 1. which is a byte-oriented protocol. if m is the number of bits for the sequence number.N ARQ.574 327 111 . it can also carry control information about frames from B. D.High-level Data Link Control (HDLC) is a bit-oriented protocol for communication over point-to-point and multipoint links. Dept. •SUMMARY of Data Link Layer (cont’d…) . the size of the sender and receiver window must be at most one-half of 2m. However.. Suresha V. Professor.Both Go-Back-N and Selective-Repeat Protocols use a sliding window. .A technique called piggybacking is used to improve the efficiency of the bidirectional protocols. when a frame is carrying data from B to A. In Selective Repeat ARQ. .K . then the size of the send window must be less than 2m. KVG College Of Engineering.

2 Data Link Layer Suresha V. KVG College Of Engineering. D.574 327 112 .. THE END OF UNIT. Professor. Sullia. Dept. of E&C.K .

KVG College Of Engineering. D.Suresha V Suresha V. Professor.Acknowledgement : My Sincere Thanks To The Author Prof. publisher Tata McGraw Hill By Prof. Because The Above Presentation Materials Are Heavily Borrowed From His Textbook “Data Communication & Networking” 4th Edition. Dept. Sullia.BEHROUZ A FOROUZAN.574113 327 . of E&C.K .

of E&C.574 327 114 .Mercedes Horse Any questions? Thank you reach me at : suresha.K . Professor. D. Dept.com Suresha V. Sullia.vee@gmail. KVG College Of Engineering.