Datalink control(framing,protocols)

73

Transcript of Datalink control(framing,protocols)

Page 1: Datalink control(framing,protocols)
Page 2: Datalink control(framing,protocols)

BrAinY 4Presented to:- Ma’am Sumbal and class

Group MembersZUPASHSANAMARHABAGroup Leader HiRA

Page 3: Datalink control(framing,protocols)

DATA LINK CONTROL:-FramingError control &flow controlsProtocolsNoiseless channelNoisy channel

Topics to be discussed:-

Page 4: Datalink control(framing,protocols)

FRAMING Zupash Kiramat

Page 5: Datalink control(framing,protocols)
Page 6: Datalink control(framing,protocols)

FRAMINGThe data link layer needs to pack bits into frames. So that each frame is distinguishable from another.

TYPESFixed size framingVariable sized framing

Page 7: Datalink control(framing,protocols)

•Data to be carried are of 8 bits character from a coding system such as ASCII. •The header carries the source and destination addresses and other control information .•Trailer which carries error detection or error correction redundant bits, are also multiple of 8 bits.• To separate one fame from the next an 8bits frame is added at the beginning and at the end of a frame.

Character oriented protocol:

Page 8: Datalink control(framing,protocols)

A frame in character oriented protocol

Page 9: Datalink control(framing,protocols)

Stuffing

Page 10: Datalink control(framing,protocols)

11.10

Byte stuffing and unstuffing

Page 11: Datalink control(framing,protocols)

Byte stuffing is the process of adding 1 extra byte whenever there is a flag or escape character in the text

Note:

Page 12: Datalink control(framing,protocols)

11.12

Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the

data, so that the receiver does not mistakethe pattern 0111110 for a flag.

Note

Page 13: Datalink control(framing,protocols)

Bit oriented protocol:

the 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.

Figure shows a frame in a bit oriented protocol.

Page 14: Datalink control(framing,protocols)

Bit stuffing and unstuffing

Page 15: Datalink control(framing,protocols)

ERROR CONTROL AND FLOW CONTROL

PROTOCOLS

SANA AYUB

Page 16: Datalink control(framing,protocols)

Data link control

The most important responsibilities of the data link layer are flow control and error control. Collectively, these functions are known as data link control.

Data link control=flow +error control

Page 17: Datalink control(framing,protocols)

Flow control

Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment.

Receiving device hasLimited speedLimited amount of memory. So the sending device must not send

frame at a rate faster than a receiving station can absorb them.

Page 18: Datalink control(framing,protocols)

Error control

Error control includes both error control and error detection.

Allows reciever to inform the sender if a frame is lost or damaged during transmission and coordinates the retransmission of those frames by the sender.

Whenever an error is detected,specified frames are retransmitted.

Page 19: Datalink control(framing,protocols)

PROTOCOLS:

Page 20: Datalink control(framing,protocols)

Protocols

Now let us see how the data link layer can combine framing, flow control, and error control to achieve the delivery of data from one node to another. The protocols are normally implemented in software by using one of the common programming languages. To make our discussions language-free, we have written in pseudocode a version of each protocol that concentrates mostly on the procedure instead of delving into the details of language rules.

Page 21: Datalink control(framing,protocols)
Page 22: Datalink control(framing,protocols)

NOISELESS CHANNEL simplest protocol stop-and-wait protocol

MARHABA WAZIR

Page 23: Datalink control(framing,protocols)

NOISELESS CHANNEL

Page 24: Datalink control(framing,protocols)

1. NOISELESS CHANNEL

lets assume that we have an ideal channel in which no frames are lost, corrupted or duplicated.

We introduce two protocols for this type channel:

a. Simplest protocolb. STOP-and-WAIT protocol

Page 25: Datalink control(framing,protocols)

The design of the simplest protocol with no flow or error control

Figure shows an example of communication using this protocol

Page 26: Datalink control(framing,protocols)

a.Simplest protocol

It is very simple. The sender sends a sequence of frames

without even thinking about the receiver. To send three frames, three events occur at

the sender site and three events at the receiver site.

Page 27: Datalink control(framing,protocols)

Note that the data frames are shown by tilted

boxes; the height of the box defines the transmission time difference between the first bit and the last bit in the frame.

Page 28: Datalink control(framing,protocols)

Flow diagram for simplest protocol

Page 29: Datalink control(framing,protocols)

b.STOP and WAIT Protocol

Page 30: Datalink control(framing,protocols)

Stop-and-Wait Protocol

Simple tokens of ACK and flow control added

Page 31: Datalink control(framing,protocols)

Stop-and-Wait Protocol flow diagram

Page 32: Datalink control(framing,protocols)

Stop-and-Wait protocol

At most one packet in flight at any time.

Sender sends one packet. Reciver sends acknowledgment

packet when it receive data.

THINKING CORNERWhat type of a link we need here?(Simplex, half duplex, full duplex)

Page 33: Datalink control(framing,protocols)

NOISY CHANNEL

1) Stop-and-wait ARQ2) Go-back-N ARQ3) Selective repeat ARQ

HIRA ANWAR

Page 34: Datalink control(framing,protocols)

2.NOISEY CHANNEL

Page 35: Datalink control(framing,protocols)

Noisy channel

Realistic• error can and will happen.• needs error control.

Mechanisms1) Stop-and-wait ARQ2) Go-back-N ARQ3) Selective repeat ARQ

Page 36: Datalink control(framing,protocols)

STOP AND WAIT ARQ

Page 37: Datalink control(framing,protocols)

FramesPacket Error Free Packet

Transmitter

Receiver

Information Frame

Control Frame

Timer is set after each frame transmission

Page 38: Datalink control(framing,protocols)

38

Stop-and-Wait ARQ(Automatic Repeat reQuest Sender keeps a copy of sent frame

until successful delivery is ensured. Receiver responds with an ack when

it successfully receives a frame. Both data and ack frames must be

numbered. When sender does not receive an

ack within certain time, it assumes frame is lost, then retransmits the same frame.

Page 39: Datalink control(framing,protocols)

39

Stop-and-Wait ARQ

1. Normal operation2. The frame is lost3. The ACK is lost4. The ACK is delayed

Page 40: Datalink control(framing,protocols)

40

Flow Diagram: Normal Operation

Time

Sender Receiver

Time

Frame 0

ACK 1Frame 1

ACK 0

S = 0

S = 1

R = 0

R = 1

R = 0

Deliver

Deliver

Page 41: Datalink control(framing,protocols)

41

Flow Diagram: Lost Frame

Time

Sender Receiver

Time

Frame 0

ACK 1

Frame 1

ACK 0

S = 0 R = 0

R = 1

R = 0

S = 1

Timeout

Frame 1

Deliver

Deliver

Page 42: Datalink control(framing,protocols)

42

Flow Diagram: Delayed ACKSender Receive

r

Frame 0

ACK 1

ACK 0

S = 0 R = 0

R = 1

R = 0

Frame 0Timeout

S = 1

S = 0

R = 1

Frame 0 expected;

discard

Deliver

ACK 1Frame 1

Timeout Frame 1Deliver

Page 43: Datalink control(framing,protocols)

THINKING CORNER: Why Data frames & ACK frames need to be sequentially numbered?

Page 44: Datalink control(framing,protocols)

Need for Sequence Numbers

(a) Frame 1 lost

A

B

Frame 0

Frame 1

ACK

Frame 1

ACK

TimeTime-out

Frame 2

(b) ACK lostA

B

Frame 0

Frame 1

ACKFrame 1ACK

TimeTime-out

Frame 2ACK

Page 45: Datalink control(framing,protocols)

45

Drawbacks of Stop-and-Wait ARQ After each frame sent the host must wait

for an ACK. inefficient use of bandwidth.

To improve efficiency ACK should be sent after multiple frames.

Alternatives: Sliding Window protocols1.Go-back-N ARQ2.Selective Repeat ARQ

Page 46: Datalink control(framing,protocols)

46

Pipelining

One task begins before the other one ends. increases efficiency in transmission.

There is no pipelining in Stop-and-Wait ARQ.

In sliding window protocol pipelining is implemented.

Page 47: Datalink control(framing,protocols)

Sliding window

The sliding window is an theoretical concept that defines the range of sequence numbers that is the concern of the sender and receiver.

Page 48: Datalink control(framing,protocols)

2.GO BACK N ARQ (Automatic Repeat reQuest)

Page 49: Datalink control(framing,protocols)

49

(sliding window protocol)Go-Back-N ARQ

Allows multiple frames to be sent before waiting for ACK. These frames must be numbered

differently. Frame numbers are called Sequence

numbers. Frames must be received in the

correct order. If a frame is lost, the lost frame and

all of the following frames must be retransmitted.

Page 50: Datalink control(framing,protocols)
Page 51: Datalink control(framing,protocols)

51

The name of Go-back-N: why? Re-sending frame

when the frame is damaged the sender goes back and sends a set of frames starting from the last one ACKn’d

the number of retransmitted frames is N

Example:

The window size is 4. A sender has sent frame 6 and the

timer expires for frame 3 (frame 3 not ACKn’d). The sender goes back and re-sends the frames 3, 4, 5 and 6.

Page 52: Datalink control(framing,protocols)

Sequence numbers

Frame header contains m bits for sequence number.

That allows up to 2m different frame numbers.

We can repeat sequence numbers.

Page 53: Datalink control(framing,protocols)

53

Sending Window

Sending more than one frame at once requires sender to buffer multiple frames. Known as "sending window" Any of these frames in the window can be

lost.

Page 54: Datalink control(framing,protocols)

54

"Sliding" Window

Once the first frames in the window is ACKed ACKed frames are removed from the buffer More frames are transmitted Result: The window slides to the right

Page 55: Datalink control(framing,protocols)

55

Receiving Window

Receiver expects one frame at a time

Page 56: Datalink control(framing,protocols)

56

Go-back-N-Control variables-

S- holds the sequence number of the recently sent frame

SF – holds sequence number of the first frame in the window

SL – holds the sequence number of the last frame R – sequence number of the frame expected to be

received

Page 57: Datalink control(framing,protocols)

57

Go-Back-N: Window Sizes

For m-bit sequence numbers. Send window size: at most 2m-1.

Up to 2m-1 frames can be sent without ACK.

Receive window size: 1 Frames must be received in order.

Page 58: Datalink control(framing,protocols)

58

Go-Back-N: Normal Operation

Page 59: Datalink control(framing,protocols)

59

Go-Back-N: Lost Frame

ACKs are cumulative

Page 60: Datalink control(framing,protocols)

60

Go-back-N

Inefficient all out of order received packets are discarded

This is a problem in a noisy link many frames must be retransmitted ->

bandwidth consuming

Solution re-send only the damaged frames

Selective Repeat ARQ avoid unnecessary retransmissions

Page 61: Datalink control(framing,protocols)

61

Thinking Corner

Stop-and-Wait is a special case of Go-Back-N. What is the send window size in Stop-

and-Wait?

Page 62: Datalink control(framing,protocols)

SELECTIVE REPEAT ARQ

Page 63: Datalink control(framing,protocols)

63

Selective Repeat ARQ

Go-Back-N always discards out-of-order frames Losing one frame may result in

retransmission of multiple frames Very inefficient in noisy link

Selective Repeat ARQ allows frames to be received out of order Therefore, receive window > 1

Page 64: Datalink control(framing,protocols)

64

Send and Receive Windows

Sender and receiver share window space equally

For m-bit sequence numbers Send window: up to 2m-1

Receive window: up to 2m-1

Page 65: Datalink control(framing,protocols)

65

Send Window

Page 66: Datalink control(framing,protocols)

66

Receive Window

Page 67: Datalink control(framing,protocols)

67

Negative ACK Used by receiver to indicate missing

frame

Page 68: Datalink control(framing,protocols)

68

Selective Repeat: Window Size

Page 69: Datalink control(framing,protocols)

69

PIGGY BACKING(Bidirectional Transmission) Data are transferred both ways ACK are "piggybacked" with data

frames

Page 70: Datalink control(framing,protocols)

Queries??????

Page 71: Datalink control(framing,protocols)

links

https://youtu.be/Ms1XEMZbjgM https://youtu.be/Cs8tR8A9jm8 https://youtu.be/ovEQhPCbSGI

Page 72: Datalink control(framing,protocols)
Page 73: Datalink control(framing,protocols)

THANK YOU