6 data linkcontrol

38
Data Communications - Data Link Control Protocols Key Points

Upload: hattori-sidek

Post on 16-Apr-2017

1.315 views

Category:

Education


0 download

TRANSCRIPT

Page 1: 6  data linkcontrol

Data Communications- Data Link Control Protocols

Key Points

Page 2: 6  data linkcontrol

2

Flow Control• Flow control :

Ensuring the sending entity does not overwhelm the receiving entity with data—Preventing buffer overflow

• Transmission time—Time taken to emit all bits into medium

• Propagation time—Time for a bit to traverse (merentasi) the link

Page 3: 6  data linkcontrol

3

Model of Frame Transmission

(mengelirukan)

Page 4: 6  data linkcontrol

4

Stop and Wait Flow Control• The simplest form of flow control• Source transmits frame• Destination receives frame and replies with

acknowledgement (ready to accept another frame)

• Source waits for ACK before sending next frame• Destination can stop flow by not send ACK

—As long as there are no ACK from dest., source do not sends frame

• Works well for a message sent in a few large frames

Page 5: 6  data linkcontrol

5

Fragmentation• Large block of data may be split into small frames

—Limited buffer size—Errors detected sooner (when whole frame received)—On error, retransmission of smaller frames is needed—Prevents one station occupying medium for long periods

(causing long delays at other sending station)• With multiple frames for a single message

inadequate—Only one frame at a time can be transit

• Stop and wait becomes inadequate when the bit length of the link is greater than the frame length (a>1)

Page 6: 6  data linkcontrol

Bit length of link

6

B=R x d/V

B = length of the link in bits , this is the number of bits present on the link at an instance in time when a stream of bits fully occupies the linkR = data rate of the link, in bpsd = length, or distance of the link in meterV = velocity of propagation, in m/s

Propagation delay

a = B/L

L = number of bits in the frame (length of the frame in bits)

Page 7: 6  data linkcontrol

7

Stop and Wait Link Utilization

length of link > length of frame (1 frame/time =Inefficient)

length of link < length of frame

Page 8: 6  data linkcontrol

Example

8

Page 9: 6  data linkcontrol

9

Sliding Windows Flow Control• Allow multiple frames to be in transit (improve efficiency )• Receiver has buffer W long• Transmitter can send up to W frames without ACK from

receiver• Each frame is numbered (sequence of order)• Receiver sends ACK includes number of next frame

expected• Transmitter maintains list of sequence no. to send,

Receiver maintains list of sequence no. to receive.• Sequence number bounded by size of field (k)

—Frames are numbered modulo 2k – numbered 0 to k-1Eg: if 2k=8(3 bits), frames are numbered 0,1,2,3,4,5,6,7,0,1,2,3…..7,0..

Page 10: 6  data linkcontrol

10

Sliding Window Diagram- SenderAssume using 23= 8,no. = 0,1,2,3,4,5,6,7,0…

Each time a frame is sent window shrink (# of frames may be transmitted)Each time ACK is received window grows (to end side (total of 7 frames))

acknowledged

Sent but not yet acknowledged

Page 11: 6  data linkcontrol

11

Sliding Window Diagram-receiverACK must includes F0 (RR 0)

“Receiver has received all frames up to F7 and is ready to receive F0.”

Each time a frame is received window shrink (# of frames available)Each time ACK is sent window grows (to end side (total of 7 frames))

*RR = Ready Receive

Page 12: 6  data linkcontrol

12

Example Sliding Window

A may transmits 7 frames, beginning with F0

A transmits F0,F1,F2 (no ACK)

A shrunk its window to 4 frames, maintains copy of F0,F1,F2

A may transmits 4 frames, beginning with F3B transmits RR 3 frames (received frames up to F2,ready to receive 7 more frames starts from F3)

B grows back to 7 frames, starts from F3A discards copy of F0,F1,F2

A transmits F3,F4,F5,F6

B returns RR 4 (ACK F3, allows A transmits from F4 – F2)

By the time RR 4 reaches A, A already transmitted F4,F5,F6,So A can only transmits 4 frames starts from F7.

B may receives 7 frames, beginning with F0

B shrunk its window to 4 frames (available frames)

Page 13: 6  data linkcontrol

13

Sliding Window Enhancements• Receiver can acknowledge frames without permitting

further transmission (Receive Not Ready, RNR)—EG: RNR 5 = “I have received all frames up through no. 4 but

unable to accept any more at this time”• Must send a normal acknowledge to restart

transmission• If duplex,

—2 stations exchange data, both maintain 2 windows (to transmit and to receive)

—To support this requirement, use piggybacking• If no data to send, use acknowledgement frame (RR @ RNR)• If data but no acknowledgement to send, send last

acknowledgement number again, or have ACK valid flag (TCP)

Page 14: 6  data linkcontrol

14

Error Control• Mechanisms of detection and correction of errors

—Types of errors• Lost frames• Damaged frames

• Automatic repeat request (ARQ) – to turn an unreliable data link to a reliable one

• ARQ mechanisms:—Error detection

• parity check, CRC, etc.—Positive acknowledgment

• Dest. ACK source received error-free frames.—Retransmission after timeout

• Source retransmits frame not ACK—Negative acknowledgement and retransmission

• Dest. ACK source received error- detected frames.• Source retransmits frame

Page 15: 6  data linkcontrol

15

Automatic Repeat Request (ARQ)• Three versions of ARQ have been

standardized:a) Stop and waitb) Go back Nc) Selective reject (selective retransmission)

Page 16: 6  data linkcontrol

16

(a) Stop and Wait• Source transmits single frame• Wait for ACK• If receiver received frame damaged, discard it

—Transmitter has timeout (transmitter occupied with timer)

—If no ACK within timeout, retransmit frame• If ACK damaged (but arrived), transmitter will not

recognize it—Transmitter will retransmit—Receiver gets two copies of frame—Use ACK0 and ACK1

Page 17: 6  data linkcontrol

17

Stop and Wait -

Diagram# of frame : Labeled alternately 0 and 1

ACK0 : Receiver received frame 1,Ready to receive frame 0.ACK1 : Receiver received frame 0,Ready to receive frame 1.

Page 18: 6  data linkcontrol

18

Stop and Wait - Pros and Cons• Simple• Inefficient

Page 19: 6  data linkcontrol

19

(b) Go Back N (1)• Based on sliding window• If no error, ACK as usual with next frame

expected• Use window to control number of

outstanding frames• If error, reply with rejection (REJ)

—Discard that frame and all future frames until error frame received correctly

—Transmitter must go back and retransmit that frame and all subsequent frames

Page 20: 6  data linkcontrol

20

Go Back N - Damaged Frame• Receiver detects error in frame i• Receiver sends rejection-i (REJ i )• Transmitter gets rejection-i• Transmitter retransmits frame i and all

subsequent

Page 21: 6  data linkcontrol

21

Go Back N - Lost Frame (1)Case 1:• Frame i lost• Transmitter sends i+1• Receiver gets frame i+1 out of sequence• Receiver send reject i (REJ i )• Transmitter goes back to frame i and

retransmits

Page 22: 6  data linkcontrol

22

Go Back N - Lost Frame (2)Case 2:• Frame i lost and no additional frame sent• Receiver gets nothing and returns neither

acknowledgement nor rejection• Transmitter times out and sends

acknowledgement frame with P bit set to 1. ( RR(P bit =1) )

• Receiver interprets this as command which it acknowledges with the number of the next frame it expects (frame i ) . (RR i )

• Transmitter then retransmits frame i

Page 23: 6  data linkcontrol

23

Go Back N –Damaged Acknowledgement(RR @ RNR@ REJ)

• Receiver gets frame i and send acknowledgement (i+1) which is lost (RR i+1) is sent to transmitter but lost in transmission

• Acknowledgements are cumulative, so next acknowledgement (i+n) may arrive before transmitter times out on frame i

• If transmitter times out, it sends acknowledgement with P bit set as before

( RR(P bit =1) )• This can be repeated a number of times before a

reset procedure is initiated

Page 24: 6  data linkcontrol

24

Go Back N - Damaged Rejection*Same as for lost frame (2)• Receiver gets nothing and returns neither

acknowledgement nor rejection• Transmitter times out and sends

acknowledgement frame with P bit set to 1. ( RR(P bit =1) )• Receiver interprets this as command which it

acknowledges with the number of the next frame it expects (frame i ) . (RR i )

• Transmitter then retransmits frame i

Page 25: 6  data linkcontrol

25

Go Back N - Diagram

RR 2:REJ 4:RR(P bit=1)

Page 26: 6  data linkcontrol

26

(c) Selective Reject• Also called selective retransmission• Only rejected frames are retransmitted• Subsequent frames are accepted by the

receiver and buffered• Minimizes retransmission• Receiver must maintain large enough

buffer• More complex login in transmitter

Page 27: 6  data linkcontrol

27

Selective Reject -Diagram

Page 28: 6  data linkcontrol

28

High Level Data Link Control• The important data link control is High

Level Data Link Control (HDLC)• ISO 33009, ISO 4335• Widely used, basis for some other data

link control protocols

Page 29: 6  data linkcontrol

29

HDLC Basic CharacteristicsStations type:• Primary station

—Controls operation of link—Frames issued are called commands—Maintains separate logical link to each

secondary station• Secondary station

—Under control of primary station—Frames issued called responses

• Combined station—May issue commands and responses

Page 30: 6  data linkcontrol

30

HDLC Link ConfigurationsLink configurations:• Unbalanced

—One primary and one or more secondary stations

—Supports full duplex and half duplex• Balanced

—Two combined stations—Supports full duplex and half duplex

Page 31: 6  data linkcontrol

31

HDLC Transfer Modes (1)Data transfer modes of operation:• Normal Response Mode (NRM)• Asynchronous Balanced Mode (ABM)• Asynchronous Response Mode (ARM)

Page 32: 6  data linkcontrol

32

HDLC Transfer Modes (1)• Normal Response Mode (NRM)

—Unbalanced configuration—Primary initiates transfer to secondary—Secondary may only transmit data in response

to command from primary—Used on multi-drop lines—Host computer as primary—Terminals as secondary

Page 33: 6  data linkcontrol

33

HDLC Transfer Modes (2)• Asynchronous Balanced Mode (ABM)

—Balanced configuration—Either station may initiate transmission

without receiving permission—Most widely used—No polling overhead

Page 34: 6  data linkcontrol

34

HDLC Transfer Modes (3)• Asynchronous Response Mode (ARM)

—Unbalanced configuration—Secondary may initiate transmission without

permission form primary—Primary responsible for line—rarely used

Page 35: 6  data linkcontrol

35

Frame StructureHDLC uses synchronous transmission (frames)

header trailer

END!!

Page 36: 6  data linkcontrol

36

Key Points• Why do we need data link control

protocol?• Because of the possibility of transmission errors• Because the receiver may need to regulate the

rate of the data arrive• Because synchronization and interfacing

techniques are insufficient by themselves—So, we need a layer of control that provide

• Flow control, error detection and error control

Page 37: 6  data linkcontrol

37

Key Points -2• Flow control

—Enables a receiver to regulate the flow of data from a sender so that the receiver’s buffers do not overflow.

• Error control—Achieved by retransmission of damaged frames

that have not been acknowledged or for which the other side requests a retransmission

• High-level data link control (HDLC)—Widely used data link control protocol.

Page 38: 6  data linkcontrol

38

Sliding Window Diagram