The data linklayer uses the services of the physical layer to
send and receive bits over communication channels.
It has a number of functions, including:
1. Providing a well-defined service interface to the network
layer.
2.Framing
3. Dealing with transmission errors.
4. Regulating the flow of data so that slow receivers are not
swamped by fast senders.
I)Datalink layer Design Issue
3.
a) Services providedto the network layer –
The data link layer act as a service interface to the network layer.
This transfer also takes place via DLL (Data link-layer).
It provides three types of services:
Unacknowledged and connectionless services.
Acknowledged and connectionless services.
Acknowledged and connection-oriented services
4.
Unacknowledged and connectionlessservices.
Here the sender machine sends the independent frames without any
acknowledgement from the sender.
There is no logical connection established.
Acknowledged and connectionless services.
There is no logical connection between sender and receiver
established.
Each frame is acknowledged by the receiver.
If the frame didn’t reach the receiver in a specific time interval it has
to be sent again.
It is very useful in wireless systems.
5.
Acknowledged and connection-orientedservices
A logical connection is established between sender and receiver
Each frame is numbered so the receiver can ensure all frames have
arrived and exactly once.
3 phases
Phase 1: establish the connection
Phase 2 : send the frames
Phase 3 : release the connection
6.
Grouping the bitstogether from the physical layer and
constructing a frame called framing .
The frames are created by the adding a header and trailer to the
packet which specify the source and destination addresses .
Breaking the bit stream up into frames is more difficult than it
at first appears.
One way to achieve this framing is to insert time gaps between
frames,
FRAMING
Framing is of two types :
1. Fixed size framing or static framing- size of frame is fixed- no
need to specify the start of the frame .
2. Variable size framing or Dynamic- Size of the frames changed .-
It is necessary to specify the start of each frame .
7.
FRAMING METHODS
1. Charactercount.
2. Flag bytes with byte stuffing.
3. Starting and ending flags, with bit stuffing.
4. Physical layer coding violations.
8.
Character count
Thefirst framing method uses a field in the header to specify the
number of characters in the frame.
When the data link layer at the destination sees the character count, it
knows how many characters follow and hence where the end of the
frame is
9.
Flag bytes withbyte stuffing
The second framing method gets around the problem of resynchronization after an error by having
each frame start and end with special bytes.
Protocols have used the same byte, called a flag byte, as both the starting and ending delimiter.
if the receiver ever loses synchronization, it can just search for the flag byte to find the end of the
current frame
11.
Starting and endingflags with bit
stuffing
The new technique allows data frames to contain an arbitrary
number of bits and allows character codes with an arbitrary
number of bits per character .
Each frame begins and ends with a special bit pattern,
01111110 (in fact, a flag byte).
Whenever the sender's data link layer encounters five
consecutive 1s in the data, it automatically stuffs a 0 bit into
the outgoing bit stream.
12.
Physical layer codingviolations
The last method of framing is only applicable to networks in which the encoding
on the physical medium contains some redundancy.
For example, some LANs encode 1 bit of data by using 2 physical bits. Normally,
a 1 bit is a high-low pair and a 0 bit is a low-high pair.
The combinations high-high and low-low are not used for data but are used for
delimiting frames in some protocols. (0,0) (1,1)
13.
Error Control
The usualway to ensure reliable delivery is to provide the
sender with some feedback(Acknowledgment).
If the sender receives a positive acknowledgement about a
frame, it knows the frame has arrived safely.
On the other hand, a negative acknowledgement means that
something has gone wrong, and the frame must be
transmitted again.
14.
If aframe is ever lost due to, for example, malfunctioning
hardware.
This possibility is dealt with by introducing timers into
the data link layer.
When the sender transmits a frame, it also starts a timer.
The timer is set to expire after an interval long for the
frame to reach the destination.
The acknowledgement propagate back to the sender.
15.
If eitherthe frame or the acknowledgement is lost, the timer will go off,
alerting the sender to a potential problem.
Solution is to just transmit the frame again.
However, when frames may be transmitted multiple times there is a danger
that the receiver will accept the same frame two or more times and pass it to the
network layer more than once.
To prevent this from happening, it is generally necessary to assign sequence
numbers to outgoing frames.
so that the receiver can distinguish retransmissions from originals.
16.
Flow Control
whenthe sender is running on a fast (or lightly loaded) computer
and the receiver is running on a slow (or heavily loaded) machine.
The sender keeps pumping the frames out at a high rate until the
receiver is completely swamped.
Two approaches are commonly used
1. feedback-based flow control, the receiver sends back information to
the sender giving it permission to send more data or at least .
2. Rate-based flow control the protocol has a built-in mechanism that
limits the rate at which senders may transmit data.