UNITII The Data Link Layer Data Link Layer

  • Slides: 27
Download presentation
UNIT-II The Data Link Layer

UNIT-II The Data Link Layer

Data Link Layer Design Issues • • Services Provided to the Network Layer Framing

Data Link Layer Design Issues • • Services Provided to the Network Layer Framing Error Control Flow Control

Functions of the Data Link Layer • • • Provide service interface to the

Functions of the Data Link Layer • • • Provide service interface to the network layer Dealing with transmission errors Regulating data flow • Slow receivers not swamped by fast senders

Functions of the Data Link Layer (2) Relationship between packets and frames.

Functions of the Data Link Layer (2) Relationship between packets and frames.

Services Provided to Network Layer (a) Unacknowledged Connectionless Service (Applicable only when the error

Services Provided to Network Layer (a) Unacknowledged Connectionless Service (Applicable only when the error rate is slow) (b) Acknowledged Connectionless Service (c) Acknowledged Connection Oriented Service

Types of Framing Methods 1. 2. 3. 4. Character Count Flag bytes with byte

Types of Framing Methods 1. 2. 3. 4. Character Count Flag bytes with byte stuffing Starting and Ending with flags with bit stuffing Physical Layer coding violation

Physical Layer Violation Some LAN encode 1 bit of data by using 2 physical

Physical Layer Violation Some LAN encode 1 bit of data by using 2 physical bits that means 1 bit is high low pair and 0 bit is used for low high pair. The combination of high and low are not used for data but is used for delimiting frames in some protocols

How to Control the Error? • • Feedback System Positive Acknowledgement or Negative Acknowledgement

How to Control the Error? • • Feedback System Positive Acknowledgement or Negative Acknowledgement Timer along with the Sequence Number

What is Flow Control? • Flow Control Occurs at Data Link Layer as well

What is Flow Control? • Flow Control Occurs at Data Link Layer as well as Higher Layers • What will happen if the senders send the frames faster rate and receiver receives the frames with lower rate ? Solutions: • Feed back based Flow Control (Mostly Used) • Rate based Flow Control (Not used in DL Layer)

What is Error Detection and Correction? • Error-Correcting Codes (Forward Error Correction) • Error-Detecting

What is Error Detection and Correction? • Error-Correcting Codes (Forward Error Correction) • Error-Detecting Codes

Error Correction Code 1 --1 0 0 0 1 2 --1 0 1 1

Error Correction Code 1 --1 0 0 0 1 2 --1 0 1 1 0 0 0 1 __________ • 0 0 1 1 1 0 0 0 (Hamming distance 3)

Error-Correcting Codes Use of a Hamming code to correct burst errors.

Error-Correcting Codes Use of a Hamming code to correct burst errors.

How to construct Hamming Code 20 21 - - 3 22 - 23 24

How to construct Hamming Code 20 21 - - 3 22 - 23 24 25 26 ---- Check bits 5 6 7 - 9 10 11 12 For 1 Check: 1, 3, 5, 7, 9, 11 (Even parity, set it 1 position to 0) For 2 Check: 2, 3, 6, 7, 10, 11 (If it is odd parity, set the 2 position 1) For 4 Check: 4, 5, 6, 7, 12 For 8 Check: 8, 9, 10, 11, 12

Error-Detecting Codes (Even/Odd Parity) 1011010 ---- 1011010 0 (Even Parity) ---------1011010 1 (Odd Parity)

Error-Detecting Codes (Even/Odd Parity) 1011010 ---- 1011010 0 (Even Parity) ---------1011010 1 (Odd Parity)

Error-Detecting Codes Calculation of the polynomial code checksum (CRC).

Error-Detecting Codes Calculation of the polynomial code checksum (CRC).

Elementary Data Link Protocols • • • An Unrestricted Simplex Protocol A Simplex Stop-and-Wait

Elementary Data Link Protocols • • • An Unrestricted Simplex Protocol A Simplex Stop-and-Wait Protocol A Simplex Protocol for a Noisy Channel

Elementary Data Link Protocols • • • An Unrestricted Simplex Protocol A Simplex Stop-and-Wait

Elementary Data Link Protocols • • • An Unrestricted Simplex Protocol A Simplex Stop-and-Wait Protocol A Simplex Protocol for a Noisy Channel

Unrestricted simplex protocol Assumption 1. Receiver can process data infinitely fast. Assumption 2. Channel

Unrestricted simplex protocol Assumption 1. Receiver can process data infinitely fast. Assumption 2. Channel never looses data Sender sends as fast as possible Receiver can always process fast enough

Simplex stop-and-wait protocol Assumption 2. Channel never looses data Sender sends frame Sender waits

Simplex stop-and-wait protocol Assumption 2. Channel never looses data Sender sends frame Sender waits for ack Sender sends frame Receiver sends ack after processing

Simplex protocol for noisy channel Assumption 2: Channel may loose data * Data frame

Simplex protocol for noisy channel Assumption 2: Channel may loose data * Data frame can be lost * Ack can be lost : Lost data frames: This means that sender will never get an ack. Sender can implement timer for each frame sent. If timer expires retransmit. : But what if the data frame arrived but the ack was lost? : Using above method, sender will retransmit frame that receiver has already received. Result: Duplicate frame at sender. : So receiver needs some way of distinguishing duplicates. Answer: Use sequence numbers. What should be the field size of these sequence numbers ?

Sliding Window Protocols • A One-Bit Sliding Window Protocol • A Protocol Using Go

Sliding Window Protocols • A One-Bit Sliding Window Protocol • A Protocol Using Go Back N • A Protocol Using Selective Repeat

Sliding Window Protocols (2) A sliding window of size 1, with a 3 -bit

Sliding Window Protocols (2) A sliding window of size 1, with a 3 -bit sequence number. (a) Initially. (b) After the first frame has been sent. (c) After the first frame has been received. (d) After the first acknowledgement has been received.

Protocol Verification • Finite State Machined Models • Petri Net Models

Protocol Verification • Finite State Machined Models • Petri Net Models

Example Data Link Protocols/Bit Oriented Protocol • Developed by IBM: Synchronous Data Link Control

Example Data Link Protocols/Bit Oriented Protocol • Developed by IBM: Synchronous Data Link Control Protocol (SDLC) • Modified by ANSI: Advanced Data Communication Control Procedure (ADCCP) • Modified by ISO: HDLC – High-Level Data Link Control Protocol • Modified by CCITT: Link Access Procedure

High-Level Data Link Control (Frame Format) 1. 2. 3. 4. 5. Address Field: is

High-Level Data Link Control (Frame Format) 1. 2. 3. 4. 5. Address Field: is used to identify one of the terminal Control Field: is used to identify Ack, sequence no. etc Data Field: Contains the original information Checksum: CRC calculation Flag bits: Starting and Ending

Types of Frames 1. 2. 3. An information frame. A supervisory frame. An unnumbered

Types of Frames 1. 2. 3. An information frame. A supervisory frame. An unnumbered frame (Many times used for control purposes. Still it is used for unreliable Connectionless purposes)

Types of Frames • • • P/F Field: Poll / Final: is used to

Types of Frames • • • P/F Field: Poll / Final: is used to poll a particular terminal Type 0 Field: Ack. Frame Type 1 Field: Negative Ack. Type 2 Field: Receiver not ready Type 3 Field: Selective Reject