Vous êtes sur la page 1sur 24

Chapter 2

The Data Link Layer

Data Link Layer


Network Layer Data Link Layer Physical Layer Network Layer Data Link Layer Physical Layer

a)

The main tasks of the data link layer are: Transfer data from the network layer of one machine to the network layer of another machine Convert the raw bit stream of the physical layer into groups of bits (frames)

MAC and LLC


to Network Layer

Data Link Layer

Logical Link Control Medium Access Control


to Physical Layer

a)
b)

The MAC protocol are implemented in the MAC sublayer which is the lower sublayer of the data link layer The higher portion of the data link layer is often called Logical Link Control (LLC)

Adapter Communication
a)

b) c)

It is a board /card that typically contains RAM ,DSP Chips, a host bus interface and link interface Commonly known as network interface Card For most part, this layer protocols are implemented in an adapter.

Data Link Layer Design Issues


a) Services Provided to the Network Layer b) Framing and its synchronization c) Error Control d) Flow Control e) Addressing f) Link management-control and data on same
link,their should be distinction.

Link layer protocol Services


a) b) c) d) e) f) g) Provide service interface to the network layer Framing, Link Access Reliable Delivery Flow control Error Detection Error Correction Half Duplex or full Duplex

Functions of the Data Link Layer (2)

Relationship between packets and frames.

Services Provided to Network Layer

(a) Virtual communication. (b) Actual communication.

Framing
Framing by character count.

A character stream. (a) Without errors. (b) With one error.


Problem: Even if the error is detected, the receiver cannot figure out where the next frame starts ... its cannot resynchronize.

Framing (2)

(a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing.
Problem: Too tied to the 8-bit per character format ... UNICODE uses 16-bits/char

Framing (3)
The goal is to have 01111110 as a unique bit pattern.

Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receivers memory after destuffing.

Elementary Data Link Protocols


a) An Unrestricted Simplex Protocol b) A Simplex Stop-and-Wait Protocol c) A Simplex Protocol for a Noisy Channel

Each protocol is increasing in complexity and drops unrealistic assumptions.

Flow Control: Initial Assumptions


a) b) c) d) e) Simplex Channel Infinite buffer capacity with the receiver Error free transmission Network layer at the senders end is always ready with data No need for flow control

Unrestricted Simplex Protocol

Some assumptions dropped


a) Infinite capacity in the buffer of the receiver. b) Need for flow control c) Stop-n-Wait protocol
Sender sends a frame And waits for a signal in the form of a dummy frame No seq no. is required since the line is still error free

Simplex Stop-andWait Protocol

Further assumptions dropped


a) The channel is noisy, frames may be damaged or lost b) Good scene : data frame reaches intact, ack sent back and received, next frame sent c) Bad scene :
Data frame damaged or lost ..hence no ack sender times out and resends .. No problems Data frame reaches intact but Ack lost .. Times out ..resends.. Receiver receives duplicate frames..Problem

Problem of Duplicate frames


a) Solution :
Keep a sequence number for each frame to distinguish between the new frame and a duplicate frame.

b) How large should be the sequence number? Or c) What should be minimum number of bits required for the sequence number?
The only ambiguity at the receiver is between two successive frames.. Say m and m+1 and never between m-1 and m +1 .. Its only after the ack for m-1 reaches back intact mth frame is sent.. And once mth frame reaches intact at the receivers end .. Story of m-1th frame is over .. However depending upon whether ack of mth frame reaches back intact or not either mth or m+1 th frame is sent .. hence only 1 bit is sufficient

A Simplex Protocol for a Noisy Channel

A positive acknowledgement with retransmission protocol.

Continued

Simplex protocol for noisy channel


* 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 ? 1 bit.

Unrestriced 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 for ack

Rcvr sends ack after processing

Sender sends frame

Sliding Window Protocols

a) A One-Bit Sliding Window Protocol b) A Protocol Using Go Back N c) A Protocol Using Selective Repeat
Read them from book