Anda di halaman 1dari 23

Data-Link Layer

COMPUTER NETWORKS
(DATA-LINK LAYER)

BITS edu campus

Data-Link Layer

Question to be answered ?
Computer Networks

Why it is important to have Datalink


Layer?

What are Functions performed


on Data-link layer?

Data-Link Layer

the need for Data-link layer


Computer Networks

1) Communication circuits make errors


occasionally.
2) Communication circuits have a
limited date rate.
3) There is a nonzero propagation delay
between the time a bit is sent and the
time it is received.
3

Data-Link Layer

Functions performed on Data-link


layer are:
Computer Networks

1- Framing
2- Flow Control
3- Error Control
4- Error Detection & Correction
4

Data-Link Layer

Framing
Computer Networks

The transmitted bit stream by the physical


layer is not guaranteed to be error free.
It is up to the data-link layer to detect, and
if necessary, to correct errors.
The data-link layer breaks the bit stream
up into discrete frames and compute the
checksum for each frame.
When a frame arrives at the destination,
the checksum is recomputed.

Data-Link Layer

Sending machine

Receiving machine
Computer Networks

Packet

Packet
Frame

Header

Payload field

Trailer

Header

Payload field

Trailer

Relationship between packets and frames 6

Data-Link Layer

SERVICES PROVIDED TO NETWORK


LAYER(1)

(a) Virtual communication.


(b) Actual communication.

Data-Link Layer

SERVICES PROVIDED TO NETWORK


LAYER (2)

Placement of the data link protocol.

Data-Link Layer

Framing

Networks rarely make any guarantees


about timing.
Other Framing Methods are:
1) Character count.
2) Flag bytes with byte stuffing
3)Starting and encoding flags, with bit stuffing
4) Physical layer coding violations
9

Computer Networks

The easiest way to achieve framing is to


insert time gaps between frames.

Data-Link Layer

Framing

Character count

Computer Networks

1) Character count framing method uses a


field in the header to specify the number of
characters in the frame.

Frame 1

Frame 2

Frame 3

4 Characters

6 Characters

2Characters
10

Data-Link Layer

Framing

Error

Frame 1

Frame 2 (wrong)

4 Characters

6 Characters

Computer Networks

The problem with Character count algorithm


is that the count can be distorted by a
transmission error.

Frame 3
11

Data-Link Layer

Framing

FLAG

Header

Payload field

Trailer

A Frame delimited by flag bytes

Computer Networks

2) The second method uses in each frame


start and end special bytes (Flag byte) to
get around the problem of resynchronisation
after an error occurred.
- Flag bytes used as a delimiters.

FLAG

12

FRAMING (2)

(a) A frame delimited by flag bytes.


(b) Four examples of byte sequences before and after
stuffing.

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 receivers memory after
destuffing.

Data-Link Layer

Framing
Computer Networks

- A problem occurs with this method when


binary data are being transmitted. It may
easily happen that the flag bytes bit pattern
occurs in the data.
- one way to solve this problem is to have
the senders data-link layer insert a special
escape byte (ESC) just before each
accidental flag byte in the data.
- this technique is called byte stuffing or
character stuffing.
15

Data-Link Layer

Framing

- A major disadvantage of this framing


method is that it is closely tied to the use of 8bit characters.

Computer Networks

- The byte-stuffing scheme with a slight


simplification is used in the PPP protocol.

16

Data-Link Layer

Error Control

- The technique of acknowledgment and


retransmission is used to ensure reliable
delivery.
- This can be achieved by using timer and
assigning sequence number for each
frame.

Computer Networks

- Error Control is needed to make sure all


frames are eventually delivered to the
network layer at the destination and in the
proper order.

17

Data-Link Layer

Flow Control
Computer Networks

- Flow Control is needed to deal with the


situation when the sender is running on a
fast computer and the receiver is running
on a slow machine.
- the sender keeps transmitting the frames
out at a higher rate until the receiver is
completely swamped (flooded).
- At a certain point the receiver will simply be
unable to cope with the frames as they
18
arrive, and will start to lose them.

Data-Link Layer

Flow Control
-

There are two approaches for flow control:


Computer Networks

1) Feedback-based flow control, where the


receiver sends back information to the
sender giving it permission to send more
data.

2) Rate-based flow control, where there is a


rate limit at which senders may transmit
data, without using feedback from the
19
receiver.

Data-Link Layer

Error Detection & Correction


Two basic strategies to deal with errors:
Computer Networks

1) Error-correcting codes, includes enough


redundant information with each sent data,
to enable receiver to deduce what the
transmitted data must have been.

2) error-detecting codes, includes only


enough information to allow the receiver to
deduce that an error occurred, but not
which error, and have it request a
20
retransmission.

Data-Link Layer

Error Detection & Correction

- In this scheme a single parity bit is


appended to the data.

Computer Networks

- The simplest error-detection scheme is a


Parity Check.

- The parity bit is chosen so that the


number of 1 bits in the code is even (or
odd).
21

Data-Link Layer
Transmitter
E=f(DATA)

DATA

Computer Networks

DATA

Receiver

DATA

E, E = Error-detecting codes
f

= Error-detecting code function

E=f(DATA)

22
Compare

Data-Link Layer

Error Detection & Correction

- With wireless links, where unacceptable


delay caused by repetition Error-correction
is more suitable.

Computer Networks

- Error-detection and retransmission is


efficient where error rate is low (over
copper wire or optical fiber).

23

Anda mungkin juga menyukai