Data Link Layer Data Link Control Outline n

  • Slides: 46
Download presentation
Data Link Layer: Data Link Control

Data Link Layer: Data Link Control

Outline n Framing n n Byte vs. bit oriented protocols Data Link Control Flow

Outline n Framing n n Byte vs. bit oriented protocols Data Link Control Flow control n Error control n n Protocols 2

Framing n n Process of wrapping data with certain info before sending out A

Framing n n Process of wrapping data with certain info before sending out A frame typically consists of n n Flag: indication for start and end of a frame Header: source/destination addresses, as well as other control information Data from the upper layer Trailer: error detection/correction code 3

Byte vs. Bit Oriented n Framing in byte-oriented protocols n Framing in bit-oriented protocols

Byte vs. Bit Oriented n Framing in byte-oriented protocols n Framing in bit-oriented protocols 4

Byte Stuffing n Process of adding extra byte whenever there is an escape or

Byte Stuffing n Process of adding extra byte whenever there is an escape or a flag character in the data 5

Bit Stuffing n Process of adding extra bit to ensure flag sequence does not

Bit Stuffing n Process of adding extra bit to ensure flag sequence does not appear in the data 01111110 6

Flow Control and Error Control n Flow control n n A set of procedures

Flow Control and Error Control n Flow control n n A set of procedures that tells the sender how much data can be sent before waiting for acknowledgment Error control Includes both error detection and correction n Allows receiver to inform sender of lost or duplicate frames n Mostly based on Automatic Repeat Request (ARQ) n 7

Data Link Protocols 8

Data Link Protocols 8

Protocols for Noiseless Channel n Assuming channel is error free n n Not realistic…

Protocols for Noiseless Channel n Assuming channel is error free n n Not realistic… No need for error control 9

"Simplest" Mechanism n Assuming n n Noiseless channel Unlimited buffer and speed for the

"Simplest" Mechanism n Assuming n n Noiseless channel Unlimited buffer and speed for the receiver 10

"Simplest": Flow Diagram 11

"Simplest": Flow Diagram 11

Stop-and-Wait Mechanism n n Still noiseless channel Receiver has limited buffer n n Requires

Stop-and-Wait Mechanism n n Still noiseless channel Receiver has limited buffer n n Requires flow control Sender sends one frame at a time and wait for an acknowledgment 12

Stop-and-Wait: Overview 13

Stop-and-Wait: Overview 13

Stop-and-Wait: Flow Diagram 14

Stop-and-Wait: Flow Diagram 14

Noisy Channel n Realistic Error can and will happen n Require error control n

Noisy Channel n Realistic Error can and will happen n Require error control n n Mechanisms: Stop-and-Wait ARQ n Go-Back-N ARQ n Selective Repeat ARQ n 15

Stop-and-Wait ARQ n n Sender keeps a copy of sent frame until successful delivery

Stop-and-Wait ARQ n n 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. 16

Stop-and-Wait ARQ 17

Stop-and-Wait ARQ 17

Flow Diagram: Normal Operation Sender S=0 Receiver Frame 0 ACK 1 S=1 Frame 1

Flow Diagram: Normal Operation Sender S=0 Receiver Frame 0 ACK 1 S=1 Frame 1 ACK 0 Time R=0 Deliver R=1 Deliver R=0 Time 18

 Thinking Corner n Why data frames need to be numbered? 19

Thinking Corner n Why data frames need to be numbered? 19

Flow Diagram: Lost Frame Sender S=0 Receiver Frame 0 ACK 1 S=1 Timeout Frame

Flow Diagram: Lost Frame Sender S=0 Receiver Frame 0 ACK 1 S=1 Timeout Frame 1 R=0 Deliver R=1 Frame 1 ACK 0 Time Deliver R=0 Time 20

Flow Diagram: Lost ACK Sender S=0 Receiver Frame 0 ACK 1 S=1 Frame 1

Flow Diagram: Lost ACK Sender S=0 Receiver Frame 0 ACK 1 S=1 Frame 1 R=0 Deliver R=1 Deliver ACK 0 Timeout S=1 Frame 1 ACK 0 S=0 Time R=0 Frame 0 expected; discard R=0 Time 21

 Thinking Corner n Why ACK frames need to be numbered? 22

Thinking Corner n Why ACK frames need to be numbered? 22

Flow Diagram: Delayed ACK Sender Receiver S=0 Frame 0 ACK Frame 0 Timeout S=1

Flow Diagram: Delayed ACK Sender Receiver S=0 Frame 0 ACK Frame 0 Timeout S=1 R=0 Frame 1 1 Deliver R=1 Frame 0 expected; discard ACK 1 R=1 Timeout Frame 1 ACK 0 R=0 Deliver S=0 23

Flow diagram 11. 24

Flow diagram 11. 24

Bidirectional Transmission n n Data are transferred both ways ACK are "piggybacked" with data

Bidirectional Transmission n n Data are transferred both ways ACK are "piggybacked" with data frames 25

Go-Back-N ARQ n Allows multiple frames to be sent before waiting for ACK These

Go-Back-N ARQ n Allows multiple frames to be sent before waiting for ACK These frames must be numbered differently n Frame numbers are called Sequence numbers n n n 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 26

Sequence Numbers n n n Frame header contains m bits for sequence number That

Sequence Numbers n n n Frame header contains m bits for sequence number That allows up to 2 m different frame numbers How big should m be? 27

Sending Window n Sending more than one frame at once requires sender to buffer

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

"Sliding" Window n Once the first frames in the window is ACKed n n

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

Receiving Window n Receiver expects one frame at a time 30

Receiving Window n Receiver expects one frame at a time 30

Send window for Go-Back-N ARQ 11. 31

Send window for Go-Back-N ARQ 11. 31

Receive window for Go-Back-N ARQ 11. 32

Receive window for Go-Back-N ARQ 11. 32

Go-Back-N: Window Sizes n n For m-bit sequence numbers Send window size: at most

Go-Back-N: Window Sizes n n For m-bit sequence numbers Send window size: at most 2 m-1 Up to 2 m-1 frames can be sent without ACK n Receive window size: 1 Frames must be received in order 33

Go-Back-N: Normal Operation 34

Go-Back-N: Normal Operation 34

Go-Back-N: Lost Frame ACKs are cumulative 35

Go-Back-N: Lost Frame ACKs are cumulative 35

 Thinking Corner n Stop-and-Wait is a special case of Go-Back -N. n What

Thinking Corner n Stop-and-Wait is a special case of Go-Back -N. n What is the send window size in Stop-and. Wait? 36

Selective Repeat ARQ n Go-Back-N always discards out-of-order frames Losing one frame may result

Selective Repeat ARQ n Go-Back-N always discards out-of-order frames Losing one frame may result in retransmission of multiple frames n Very inefficient in noisy link n n Selective Repeat ARQ allows frames to be received out of order n Therefore, receive window > 1 37

Send Window 38

Send Window 38

Receive Window 39

Receive Window 39

Negative ACK n Used by receiver to indicate missing frame 40

Negative ACK n Used by receiver to indicate missing frame 40

Multiple Access Mechanisms 41

Multiple Access Mechanisms 41

ALOHA Protocol 42

ALOHA Protocol 42

Collision in CSMA B C 43

Collision in CSMA B C 43

Persistence Methods n What a station does when channel is idle or busy 44

Persistence Methods n What a station does when channel is idle or busy 44

Persistence Methods 45

Persistence Methods 45

CSMA/CD: Flow Diagram 46

CSMA/CD: Flow Diagram 46