Flow and Error Control
• Flow Control
• Whenever an entity produces items and another entity
consumes them, there should be a balance between
production and consumption rates.
• If the items are produced faster than they can be consumed,
the consumer can be overwhelmed and may need to discard
some items.
• If the items are produced more slowly than they can be
consumed, the consumer must wait, and the system becomes
less efficient.
• Flow control is related to the first issue. We need to prevent
losing the data items at the consumer site.
Buffers
• Although flow control can be implemented in several
ways, one of the solutions is normally to use two buffers;
one at the sending data-link layer and the other at the
receiving data-link layer.
• A buffer is a set of memory locations that can hold
packets at the sender and receiver.
• The flow control communication can occur by sending
signals from the consumer to the producer.
• When the buffer of the receiving data-link layer is full, it
informs the sending data-link layer to stop pushing
frames.
Error Control
• Error control at the data-link layer is normally very simple
and implemented using one of the following two methods.
• In both methods, a CRC is added to the frame header by
the sender and checked by the receiver.
• ❑ In the first method, if the frame is corrupted, it is silently
discarded; if it is not corrupted, the packet is delivered to
the network layer. This method is used mostly in wired
LANs such as Ethernet.
• ❑ In the second method, if the frame is corrupted, it is
silently discarded; if it is not corrupted, an
acknowledgment is sent (for the purpose of both flow and
error control) to the sender.
Connectionless and Connection-Oriented
• A DLC protocol can be either connectionless or
connection-oriented
• Connectionless Protocol
• In a connectionless protocol, frames are sent from
one node to the next without any relationship
between the frames; each frame is independent.
• The frames are not numbered and there is no
sense of ordering. Most of the data-link protocols
for LANs are connectionless protocols.
• Connection-Oriented Protocol
• a logical connection should first be established
between the two nodes (setup phase).
• After all frames that are somehow related to
each other are transmitted (transfer phase),
the logical connection is terminated
(teardown phase).
• In this type of communication, the frames are
numbered and sent in order.
• If they are not received in order, the receiver needs
to wait until all frames belonging to the same set
are received and then deliver them in order to the
network layer.
• Connection oriented protocols are rare in wired
LANs, but we can see them in some point-to-point
protocols, some wireless LANs, and some WANs.
DATA-LINK LAYER PROTOCOLS
• A simple protocol
• The behavior of a data-link-layer protocol can be
better shown as a finite state machine (FSM).
• An FSM is thought of as a machine with a finite
number of states.
• The machine is always in one of the states until an
event occurs. Each event is associated with two
reactions: defining the list (possibly empty) of
actions to be performed
• and determining the next state (which can be the
same as the current state).
Stop and wait
Sequence and Acknowledgment Numbers
• We saw a problem in Example 11.3 that needs to be addressed and
corrected. Duplicate packets, as much as corrupted packets, need to
be avoided.
• As an example, assume we are ordering some item online. If each
packet defines the specification of an item to be ordered, duplicate
packets mean ordering an item more than once.
• To correct the problem in Example 11.3, we need to add sequence
numbers to the data frames and acknowledgment numbers to the
ACK frames. However, numbering in this case is very simple.
Sequence numbers are 0, 1, 0, 1, 0, 1, . . . ; the acknowledgment
numbers can also be 1, 0, 1, 0, 1, 0, …
• In other words, the sequence numbers start with 0, the
acknowledgment numbers start with 1
POINT-TO-POINT PROTOCOL (PPP)
• One of the most common protocols for point-
to-point access is the Point-to-Point Protocol
(PPP).
• Framing
• PPP uses a character-oriented (or byte-
oriented) frame
• A PPP frame starts and ends with a 1-byte flag with
the bit pattern 01111110.
• The address field in this protocol is a constant value
and set to 11111111 (broadcast address).
• This field is set to the constant value 00000011
• The protocol field defines what is being carried in
the data field: either user data or other information.
• This field is by default 2 bytes long, but the two
parties can agree to use only 1 byte.
• This field carries either the user data or other
information that we will discuss shortly.
• The data field is a sequence of bytes with the
default of a maximum of 1500 bytes; but this
can be changed during negotiation.
• The data field is byte-stuffed if the flag byte
pattern appears in this field.
• The frame check sequence (FCS) is simply a 2-
byte or 4-byte standard CRC.
• Services Provided by PPP
• PPP defines the format of the frame to be
exchanged between devices. It also defines how
two devices can negotiate the establishment of
the link and the exchange of data
• One interesting feature of PPP is that it provides
network address configuration. This is particularly
useful when a home user needs a temporary
network address to connect to the Internet.
• Services
• PPP does not provide flow control. A sender
can send several frames one after another
with no concern about overwhelming the
receiver.
• PPP has a very simple mechanism for error
control. A CRC field is used to detect errors. If
the frame is corrupted, it is silently discarded;
• The transition diagram, which is an FSM, starts with the
dead state. In this state, there is no active carrier (at the
physical layer) and the line is quiet.
• When one of the two nodes starts the communication,
the connection goes into the establish state.
• In this state, options are negotiated between the two
parties. If the two parties agree that they need
authentication (for example, if they do not know each
other), then the system needs to do authentication (an
extra step);
• otherwise, the parties can simply start communication.
• The link-control protocol packets, discussed shortly, are used
for this purpose. Several packets may be exchanged here.
• Data transfer takes place in the open state. When a
connection reaches this state, the exchange of data packets
can be started.
• The connection remains in this state until one of the
endpoints wants to terminate the connection.
• In this case, the system goes to the terminate state. The
system remains in this state until the carrier (physical-layer
signal) is dropped, which moves the system to the dead
state again.