Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Framing, Error Control, Flow Control

Lecture-10

Computer Communication Networking


Data Link Layer Design Issues

• The data link layer has a number of specific functions it can carry out.
These functions include

1. Assign Physical Addressing


2. Providing a well-defined service interface to the network layer.
3. Dealing with transmission errors.
4. Regulating the flow of data so that slow receivers are not swamped by
fast senders.
FLOW AND ERROR CONTROL

▪ The most important responsibilities of the data link layer


are flow control and error control. Collectively, these
functions are known as data link control.

▪ Flow control refers to a set of procedures used to restrict


the amount of data that the sender can send before waiting
for acknowledgment.

▪ Error control in the data link layer is based on


automatic repeat request, which is the retransmission of
data.
Framing

• Network Layer <-> Data Link Layer <-> Physical Layer

• What the physical layer does attempt to deliver raw bit


stream to the destination. This bit stream is not guaranteed
to be error free.

• It is up to the data link layer to detect, and if necessary,


correct errors.

• To break the bit stream up into frames and compute the


checksum for each frame. When a frame arrives at the
destination, the checksum is recomputed to find errors
FRAMING

▪ The data link layer needs to pack bits into frames, so that
each frame is distinguishable from another. Our postal
system practices a type of framing. The simple act of
inserting a letter into an envelope separates one piece of
information from another; the envelope serves as the
delimiter.
Framing :
Breaking the bit stream into frames

• Methods for breaking bits

1. Character count.
2. Flag bytes with byte stuffing.
3. Starting and ending flags, with bit stuffing.
4. Physical layer coding violations.
Framing:
Character Count
Framing:
Character Count
• The trouble with this algorithm is that the count can be
changed by a transmission error.

• So, The destination will get out of synchronization and will be


unable to locate the start of the next frame.

• Sending a frame back to the source asking for a


retransmission does not help, since the destination does not
know how many characters to skip over to get to the start of
the retransmission.
Framing:
Flag bytes with byte stuffing.
• Problem of resynchronization can be solved by using start
and end with special bytes.

• Flag byte, as both the starting and ending delimiter

• In this way, if the receiver ever loses synchronization, it can


just search for the flag byte to find the end of the current
frame.
Framing:
Flag bytes with byte stuffing.
• A serious problem occurs when floating-point numbers are being
transmitted. It may easily happen that the flag byte's bit pattern occurs in
the data.
• One way to solve this problem is to have the sender's data link layer
insert a special escape byte (ESC) just before each flag byte in the data.
The data link layer on the receiving end removes the escape byte before
the data are given to the network layer. This technique is called byte
stuffing or character stuffing.
Framing:
Flag bytes with byte stuffing.

one used in the PPP protocol that most home


computers use to communicate with their
Internet service provider
Framing:
Flags with bit stuffing.
• 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. This
bit stuffing is analogous to byte stuffing, in which an escape byte is
stuffed into the outgoing character stream before a flag byte in the data.
A frame in a character-oriented protocol
Byte stuffing and un stuffing

Byte stuffing is the process of adding 1 extra byte


whenever there is a flag or escape character in the text.
A frame in a bit-oriented protocol

Bit stuffing is the process of adding one extra 0 whenever five


consecutive 1s follow a 0 in the data, so that the receiver does not
mistake the pattern 0111110 for a flag.
Bit stuffing and un stuffing
Framing:
Physical layer coding violations
• This 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 and they can be used as frame boundaries.
Link layer services
▪ Framing, Link Access:
▪ encapsulate datagram into frame, adding header, trailer
▪ channel access if shared medium
▪ “MAC” addresses used in frame headers to identify
source, dest
▪ different from IP address!
▪ reliable delivery between adjacent nodes
▪ we learned how to do this already
▪ seldom used on low bit-error link (fiber, some twisted
pair)
▪ wireless links: high error rates
▪ Q: why both link-level and end-end reliability?
Where is the link layer implemented?
▪ in each and every host
▪ link layer implemented in
“adaptor” (aka network
interface card NIC) or on
a chip
▪ Ethernet card, 802.11
applicatio
n memor
transport cpu
y
card; Ethernet chipset network

▪ implements link, physical


link

host
layer control bus

▪ attaches into host’s


ler (e.g., PCI)
link
physica
system buses l physical
transmissio

▪ combination of hardware, n

software, firmware network


adapter
card
Adaptors communicating

datagra datagra
m m
controll controll
er er

sending host receiving host


datagra
m
frame

▪ sending side: ▪ Receiving side:


▪ encapsulates datagram in ▪ looks for errors, rdt, flow
frame control, etc
▪ adds error checking bits, ▪ extracts datagram, passes
rdt, flow control, etc.
to upper layer at
receiving side

You might also like