Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

Unit II

“Data Link Control”

By
Mr. Raghuram K. M.
Assistant Professor,
Department of Electronics and Communication Engineering
SDM College of Engineering and Technology, Dharwad, Karnataka.
1
• functions include framing, flow and error
control, and software implemented protocols
that provide smooth and reliable transmission
of frames between nodes.

2
1. FRAMING

• pack bits into frames, so that each frame is


distinguishable from another
• By adding a sender address and a destination
address
Fixed-Size Framing
• no need for defining the boundaries of the
frames; the size itself can be used as a delimiter
• Ex: ATM wide-area network

3
Variable-Size Framing
• need a way to define the end of the frame and the
beginning of the next
• prevalent in local area networks
• two approaches

1. Character-Oriented Protocols
• data to be carried are 8-bit characters from a coding
system such as ASCII
• Header and trailer are also multiples of 8 bits
• To separate one frame from the next, an 8-bit (I-byte)
flag is added at the beginning and the end of a frame.

4
• when only text was exchanged, flag could be
selected to be any character not used for text
communication
• While sending other types such as graphs,
audio, and video, any pattern used for the flag
could also be part of the information, which
makes receiver wrongly think that it has
reached the end of the frame
• byte-stuffing strategy to fix this problem
Byte Stuffing: process of adding 1 extra byte
whenever there is a flag or escape character in
the text.
5
Byte stuffing and unstuffing

6
Bit-Oriented Protocols
• data section of a frame is a sequence of bits to be
interpreted by the upper layer as text, graphic,
audio, video, and so on
• Most protocols use a special 8-bit pattern flag
01111110 as the delimiter to define the
beginning and the end of the frame
• Bit stuffing strategy to over come the same flag
related problem

Bit stuffing : process of adding one extra 0


whenever five consecutive 1s follow a 0 in the
data, so that the receiver does not mistake the
pattern 0111110 for a flag
7
Bit stuffing and unstuffing

8
2. FLOW AND ERROR CONTROL
Flow Control
• set of procedures used to restrict the amount of
data that the sender can send before waiting for
acknowledgment
• flow of data must not be allowed to overwhelm
the receiver since it has limited speed and
limited memory
• receiving device must be able to inform the
sending device before those limits are reached –
ex: if the buffer is filled
9
Error Control
• Refers to the methods of error detection and
retransmission
• allows the receiver to inform the sender if any
frames lost or damaged in transmission -
coordinates the retransmission of those
frames by the sender
• often implemented simply: Any time an error
is detected in an exchange, specified frames
are retransmitted. This process is called
automatic repeat request (ARQ)
10
3. PROTOCOLS
• normally implemented in software by using one of
the common programming languages
• for noiseless (error-free) channels and those that
can be used for noisy (error-creating) channels

11
4. NOISELESS CHANNELS
• ideal channel in which no frames are lost, duplicated, or
corrupted – but practically non existant

Simplest Protocol
Assumptions:
• no flow control and no error control
• unidirectional - data frames are traveling in only one
direction
• processing time that is small enough to be negligible
• receiver can never be overwhelmed with incoming
frames
12
Design

13
Sender-site algorithm for the simplest protocol

14
Receiver-site algorithm for the simplest protocol

15
Example Flow Diagram

16
Stop-and-Wait Protocol
• Flow control is added to prevent the receiver
from becoming overwhelmed with frames
• sender sends one frame, stops until it receives
confirmation from the receiver (okay to go
ahead), and then sends the next frame
• unidirectional communication for data frames,
but auxiliary ACK frames (simple tokens of
acknowledgment) travel from the other
direction

17
Design

18
Sender-site algorithm for Stop-and-Wait Protocol

19
Receiver-site algorithm for Stop-and-Wait Protocol

20
Example

21
5. NOISY CHANNELS
• Protocols use error control

Stop-and-Wait Automatic Repeat Request (Stop-and Wait


ARQ)
• sender keeps a copy of the sent frame. At the same time,
it starts a timer
• When the frame arrives at the receiver site, it is checked
and if it is corrupted, it is silently discarded
• detection of errors in this protocol is manifested by the
silence of the receiver
• If the timer expires and there is no ACK for the sent
frame, the frame is resent, the copy is held, and the timer
is restarted
22
• to identify a frame, they are numbered. When
the receiver receives a data frame that is out of
order, this means that frames were either lost or
duplicated
• ACK frame can also be corrupted and lost, it too
needs redundancy bits and a sequence number
• sender simply discards a corrupted ACK frame or
ignores an out-of-order one

Disadvantage: inefficient in bandwidth utilization if


the round trip delay is large..

23
Sequence Numbers
• Since we want to minimize the frame size, we look for the
smallest range of sequence numbers that provides
unambiguous communication
• if we decide that the field is m bits long, the sequence
numbers start from 0, go to 2m - 1, and then are repeated
• Assuming three possibilities i.e. [1] Successful delivery of
frame and ACK [2] ACK is corrupted or lost [3] Frame is
corrupted or lost
• sequence numbers are based on modulo-2 arithmetic – i.e.
0,1,0,1 is sufficient (m=1)

Acknowledgment Numbers
• acknowledgment numbers always announce the sequence
number of the next frame expected by the receiver
• Ex: if frame 0 has arrived safe and sound, the receiver
sends an ACK frame with acknowledgment
24
25
Sender Site

26
……….

27
Receiver Site

28
29
Go-Back-N Automatic Repeat Request
• multiple frames must be in transition while
waiting for acknowledgment – pipelining
• keep a copy of these frames until the
acknowledgments arrive

Sequence Numbers
• sequence numbers are modulo-2m
• Ex: 0, 1,2,3,4,5,6, 7,8,9, 10, 11, 12, 13, 14,
15,0, 1,2,3,4,5,6,7,8,9,10, 11, ... For m=4

30
Sliding Window
• an abstract concept that defines the range of
sequence numbers that is the concern of the
sender and receiver
• Send sliding window is an imaginary box
covering the sequence numbers of the data
frames which can be in transit
• Maximum size of the window is 2m – 1
• let the size be fixed and set to the maximum
value - sliding window of size 15 (m =4)

31
Send window

32
• window at any time divides the possible sequence numbers
into four regions
1. Acknowledged frames – copy removed
2. Outstanding frames – sent frames
3. Frames not received by upper layer – not yet sent
4. Frames that cannot be sent until the window slides

• Three variables
1. Sf defines the sequence number of the first (oldest)
outstanding frame
2. Sn holds the sequence number that will be assigned to the
next frame to be sent.
3. Ssize defines the size of the window

• send window can slide one or more slots to the right when
an acknowledgment arrives from the other end
33
• size of the receive window is always 1.
• Any frame arriving out of order is discarded
and needs to be resent
• only one variable Rn (receive window, next
frame expected)

34
Timers
• Only one timer
• timer for the first outstanding frame always expires
first; we send all outstanding frames when this timer
expires

Acknowledgment
• If a frame is damaged or is received out of order, the
receiver is silent and will discard all subsequent frames
until it receives the one it is expecting
• Silence of the receiver causes the timer of the
unacknowledged frame at the sender site to expire
• This makes sender to go back and resend all frames,
beginning with the one with the expired timer
• Reciever can send one cumulative acknowledgment for
several frames
35

You might also like