ch3datalink-1

24
The Data Link Layer Chapter 2

Upload: kartheek32777

Post on 04-Jun-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 1/24

The Data Link Layer

Chapter 2

Page 2: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 2/24

2

Data Link 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”) 

Network

Layer 

Data Link

Layer 

Physical

Layer 

Network

Layer 

Data Link

Layer 

Physical

Layer 

Page 3: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 3/24

3

MAC and LLC

a) The MAC protocol are implemented in the MAC sublayer  which is

the lower sublayer of the data link layer

b) The higher portion of the data link layer is often called Logical Link

Control (LLC) 

Logical Link

Control

Medium Access

Control   D  a   t  a   L   i  n   k

   L  a  y  e  r

to Physical Layer 

to Network Layer 

Page 4: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 4/24

Adapter Communication

a) It is a board /card that typically contains RAM ,DSP Chips, a host

 bus interface and link interface

b) Commonly known as network interface Card

c) For most part, this layer protocols are implemented in an adapter.

Page 5: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 5/24

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.

Page 6: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 6/24

Link layer protocol Services

a) Provide service interface to the network layer

b) Framing, Link Access

c) Reliable Delivery

d) Flow control

e) Error Detectionf) Error Correction

g) Half Duplex or full Duplex

Page 7: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 7/24

Functions of the Data Link Layer (2)

Relationship between packets and frames.

Page 8: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 8/24

Services Provided to Network Layer

(a) Virtual communication.

(b) Actual communication.

Page 9: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 9/24

Framing

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

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

Framing by character count.

Page 10: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 10/24

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

Page 11: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 11/24

Framing (3)

Bit stuffing(a) The original data.

(b) The data as they appear on the line.

(c) The data as they are stored in receiver‟s memory after destuffing. 

The goal is to have 01111110 as a unique bit pattern.

Page 12: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 12/24

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.

Page 13: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 13/24

Flow Control: Initial Assumptionsa) Simplex Channel

b) Infinite buffer capacity with the receiverc) Error free transmission

d)  Network layer at the senders end is always ready with data

e)  No need for flow control

Page 14: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 14/24

Unrestricted

Simplex

Protocol

Page 15: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 15/24

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

Page 16: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 16/24

Simplex

Stop-and-

Wait

Protocol

Page 17: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 17/24

Page 18: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 18/24

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 requiredfor the sequence number? –  The only ambiguity at the receiver is between two

successive frames.. Say m and m+1 and never betweenm-1 and m +1 .. Its only after the ack for m-1 reaches

 back intact mth frame is sent.. And once mth framereaches intact at the receiver‟s end .. Story of m-1thframe is over .. However depending upon whether ackof mth frame reaches back intact or not either mth orm+1 th frame is sent .. hence only 1 bit is sufficient

Page 19: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 19/24

A Simplex Protocol for a Noisy Channel

A positive acknowledgement with retransmission protocol.

Continued 

Page 20: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 20/24

 

Page 21: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 21/24

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.

Page 22: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 22/24

Unrestriced simplex protocol

 Assumption 1. Receiver can process data infinitely fast. Assumption 2. Channel never looses data

Sendersends as fastas possible

Receiver canalwaysprocess fastenough

Page 23: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 23/24

Simplex stop-and-wait protocol Assumption 2. Channel never looses data

Sendersendsframe

Senderwaits forack

Rcvr sendsack afterprocessing

Sendersendsframe

Page 24: Ch3DataLink-1

8/13/2019 Ch3DataLink-1

http://slidepdf.com/reader/full/ch3datalink-1 24/24

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‟