Вы находитесь на странице: 1из 38

Data Link Control and Protocols

Data communication system always have a sending and a Receiving device Flow control
A set of procedures that tells the sender how much data it can transmit before receiving an acknowledgment from the receiver. The flow control must not overwhelm the receiver Receiver have slower processing speed than incoming Tx Data, and limited memory(buffer) for storing the incoming transmission data. Once the buffer filled the sender should be informed to halt transmission until it is once again able to receive.

Data Link Control and Protocols

Error Control
A mechanism for error detection and error correction Inform receiver about any lost or damaged received frame Error correction is the retransmission of specified frames Error detection + retransmission is called Automatic Repeat Request or ARQ.

DLL is responsible for flow control and error control or Flow control + error control is collectively know as Data link Control

Flow and error control protocols

Stop and-Wait ARQ Go-Back-N ARQ Selective Repeat ARQ

Stop and-Wait ARQ

Keep a copy of last transmitted frame for retransmission For identification purpose both DATA & ACK frames are numbered alternately 0 & 1. In case of a damaged frame is detected the receiver discard the frame and send no Acknowledgment. If the receiver receives an out of order frame, it knows that a frame is lost it simply discard the out-of-order received frame The sender has a Control Variable S that holds the number of the recently send frame (0 or 1). The Receiver has a Control Variable R that holds the number of the next frame expected (0 or 1).

Stop and-Wait ARQ

The sender starts a timer when its send a frame to receive an Acknowledgment with in an allotted time period. The receiver sends only positive Acknowledgment for frames receive safe and sound. The Acknowledgment number always define the number of next expected frame. If frame 0 is received, ACK1 is sent, if frame 1 is received ACK0 is sent.

Stop and-Wait ARQ


Sender Receiver

S=0

Frame 0 ACK 1

R=0

S=1

Frame 1

R=1

S=0

ACK 0

Time

Time

Stop and-Wait ARQ

In transmission of a frame we have four situations


Normal Operation The frame is lost The acknowledgment is lost The acknowledgment is delayed.

Lost or Damaged Frame


Sender Receiver

S=0

Frame 0 ACK 1

R=0 The The receiver remains silent about a lost frame and keeps its value of R

S=1 Time out Sender send another copy of frame when time expires S=0 S=1

Frame 1

R=1

lost
Frame 1 R=1 ACK 0

R=0

Time

Time

Lost Acknowledgment
Sender Receiver

S = 0 Frame 0 ACK 1 S=1 Frame 1 ACK 0

R=0

R=1 R=0 Expecting frame 0, frame 1 discarded

Time out

S=1

lost
Frame 1

S=0

ACK 0

Time

Time

Delayed Acknowledgment
Sender Receiver

S = 0 Frame 0

R=0 ACK 1
ACK 1 Frame 1 R=1 Expecting Frame1, frame 0 discarded

Time out

S = 0 Frame 0 S=1

Time out

Discarded S=1

Frame 1 R=1 ACK 0

Time

Time

Bi-directional Transmission

The stop and wait mechanism is unidirectional It can be bi-directional if Both parties have two separate channels for full duplex transmission or Share the same channel for half-duplex Transmission Both parties will need S & R Variables to track frame sent and expect.

A method to combine a Data frame with an Acknowledgment. Save Bandwidth

Piggybacking

Sender

Receiver

S=0

Frame 0, ACK0 R=0 Frame 0, ACK 1

S=1

Frame 1, ACK 1 Frame 1, ACK 0

R=1

S=0

Time

Time

GO-BACK-N ARQ

In Stop-and-Wait ARQ the sender send one frame and waiting for the ACK. This is wastage of bandwidth For better efficiency, multiple frames should be in transition while waiting for Acknowledgment Go-Back-N ARQ send up to W Frames before worrying about ACK like Stop-and-Wait ARQ it keeps the copy of these Frames until the ACK arrive. Some extra features are added to Stop-and-Wait ARQ

GO-BACK-N ARQ

Each transmitted frame have a sequence No. If the header of the frame allows m bits, then sender can transmit 2() sequentially I.e 0-7 The sequence can be repeated but will be considered the next cycle. The sender sets a timer for each frame sent. The receiver has no timer

Sliding Window

The size of the window at the receiver site in this protocol is always 1

a. Before Sliding

b. After Sliding

Sliding Window

Control Variables
The sender has three variables S, SF, and SL S holds the sequence number of recently sent frame SF holds the sequence number of the first frame in the window SL holds the sequence number of the last frame in the window The size of the window is W = SL SF + 1 The receiver has only one variable , R that holds the sequence No of the frame it expects to receive.

GO-BACK-N ARQ

Acknowledgment
The receiver send only positive ACK for the frame arrived safe and sound If a frame lost or damaged the receiver discard all the subsequent frame In case of no ACK and from receiver the sender go back and resend all frames, beginning with the one with the expired timer Receiver can also send one cumulative ACK for several frames

Normal Operation

Sender
A
SF
0 1

Receiver
B

SL
2 3 0 1 2

Frame 0

0 1 2 3

0 1 2

S
0 1 2 3 0 1 2

Frame 1 ACK 2

R
0 1 2 3 0 1 2

S
0 1 2 3 0 1 2

R
0 1 2 3 0 1 2

Frame 2 ACK 3

S
0 1 2 3 0 1 2

R
0 1 2 3 0 1 2

Frame 3

Time

Time

Damaged or Lost Frame


Sender A
SF
0 1

Receiver B

SL
2 3 0 1 2

S
0

S
1 2 3 0 1 2

Frame 0 Frame 1 ACK 2 Frame 2

0 1 2 3

0 1 2

R
0 1 2 3 0 1 2

S
0 1 2 3 0 1 2

R
Lost
0 1 2 3 0 1 2

S
0 1 2 3 0 1 2

Frame 3 Resent

Frame 3 discarded

S
3 0 1 2

Time out

Frame 2
ACK 3

0 1 2 3

0 1 2

Resent

Frame 3

Time

Time

0 1 2 3

0 1 2

Selective Repeat ARQ

GO-BACK-N ARQ is inefficient over noisy link Resending of multiple frames for one damaged or lost frame Selective Repeat ARQ is a new mechanism and does not use resending of multiple frame for one damaged or lost frame Processing at receiver side is now more complex Now the size of window should be at most one-half of the value 2^m The receiver and sender now have same size windows

Selective Repeat ARQ


The receiver is now looking for a range of sequence numbers The receiver now have two variables RF and RL Now receiver can send a Negative Acknowledgment (NAK) for a specific lost or damaged frame to the sender Sender also sets a timer for each frame sent The size of the sender and receiver window must be at most one-half of 2^m or 2^m/2.

Frame 0
0 1 2 3 0 1 2

S
0 1 2 3 0 1 2

Frame 1 ACK 2
0 1 2 3 0 1 2

S
0 1 2 3 0 1 2

Frame 2
Lost

Frame 3
0 1 2 3 0 1 2

S
Resent

NAK 2
0 1 2

Frame 2

0 1 2 3

0 1 2

Time

Time

High-level Data Link Control(HDLC)

An actual protocol designed to support both Halfduplex and full-duplex communication over point-topoint and multi link It implement the ARQ mechanism HDLC provides the following modes of Transmission Normal Response Mode Asynchronous Balanced Mode

Normal Response Mode-NRM


Unbalanced configuration, one primary and multiple secondary stations A primary station can send commands, a Secondary station can only response
Primary Secondary

Command

Response

Point-to-Point

Primary

Secondary

Secondary

A
Command Multi-point

Primary

Response

Response

Asynchronous Balanced Mode


The configurations is balanced The link is point-to-point and each station can function as a primary and a secondary

Combined

Combined

Command/Response

Command/Response

Point-to-Point

High-level Data Link Control(HDLC)

HDLC defines three types of frames Information Frames (I-frame) used to transport user data and control information relating to user data (piggybacking) Supervisory frames (S-frames) used to transport Control information Unnumbered Frames (U-frames) are reserved for system management (for link itself) e.g. connects and disconnects connections between senders and receivers.

High-level Data Link Control(HDLC)


1-or multi-byte Only in I- and U-frames

Flag
8-bit

Address

Control
1-or 2-byte

Information

FCS
2-or 4-byte

Flag
8-bit

Flag field with a 01111110 pattern identifies both start and end o f a frame and synchronization

The control field is used for flow and error control


FCS is for HDLC,s error detection field The information field contain the user,s data Address field contains a from address if originated by secondary station (final). it contain a to address if originated by primary station (poll). Those networks that do not use primary secondary configuration (Ethernet) use two address fields I.e source and destination addresses

HDLC frame type


Flag Address Control Information FCS Flag

I-Frame

Flag

Address

Control

FCS

Flag

S-Frame

Flag

Address

Control

Information

FCS

Flag

U-Frame

HDLC frame type

High-level Data Link Control(HDLC)

Flag

Address

Control

Information

FCS

Flag

Poll=2ndry station originate Final=primary station originate

High-level Data Link Control(HDLC)

Piggybacking without & With Error


A
DATA
F L a g F L a g F L a g F L a g F L a g F C S

B
Data

I - Frame

0
Data

0
I - Frame

B B

F L a g F L a g

F C S

1
Data

A
A A

I - Frame
0 I - Frame 1 I - Frame 2
F L a g

2
Data

F C S

F L a g F L a g F L a g

2
Data

F C S

2
Acknowledgment

F C S

F C S

S - Frame

RR

F L a g

A
DATA
F L a g

B
A
I - Frame 0 2
Data
F C S
F L a g F L a g F L a g

Error

F L a g F L a g

A
A
F L a g

I - Frame
1 I - Frame 2
Reject
F C S

Data

2
Data

F C S

2 S - Frame 1
DATA
F L a g

F C S

REJ B
Data

F L a g

A A

I - Frame 1 I - Frame 2
F L a g F C S

2
Data

F C S

F L a g F L a g

F L a g

2
Acknowledgment

F C S

S - Frame

RR

F L a g

Ethernet Frame

Thanks a lot

Вам также может понравиться