Line Discipline is a functionality of the Data link layer that provides the coordination among the link systems. It determines which device can send, and when it can send the data. Line discipline method confirms existence and capability of receiver before data is sent by sender.
Line discipline function looks after
establishment of link between sender and receiver and takes care of right of
particular device to transmit data at a given time.
Line Discipline can be
achieved in two ways:
- ENQ/ACK (Enquiry/Acknowledgement )
- Poll/select
1. Enquiry/Acknowledgement
(ENQ/ACK) :
- This method is
used when there is dedicated link between sender and receiver.
- This method is
used in peer-to-peer communication.
- It coordinates
which device may start transmission and whether receiver is ready to
accept data or not.
Working of ENQ/ACK
The transmitter transmits the frame called an
Enquiry (ENQ) asking whether the receiver is available to receive the data or
not.
The receiver responses either with the positive
acknowledgement(ACK) or with the negative acknowledgement(NACK) where positive
acknowledgement means that the receiver is ready to receive the transmission
and negative acknowledgement means that the receiver is unable to accept the
transmission.
Following are the responses
of the receiver:
- If the response
to the ENQ is positive, the sender will transmit its data, and once all of
its data has been transmitted, the device finishes its transmission with
an EOT (END-of-Transmission) frame.
- If the response
to the ENQ is negative, then the sender disconnects and restarts the
transmission at another time.
- If the response
is neither negative nor positive, the sender assumes that the ENQ frame
was lost during the transmission and makes three attempts to establish a
link before giving up.
2. Poll/Select
The Poll/Select method of
line discipline works with those topologies where one device is designated as a
primary station, and other devices are secondary stations.
Working
of Poll/Select
In this method, a primary device and multiple
secondary devices consist of a single transmission line, and all the exchanges
are made through the primary device even though the destination is a secondary
device.
The primary device has control over the
communication link, and the secondary device follows the instructions of the
primary device.
The primary device determines which device is
allowed to use the communication channel. It is an initiator of the session.
Poll
If the primary device wants to receive the data
from the secondary device, it asks the secondary device to send data; this
process is known as polling.
Firstly, the primary asks (poll) the first
secondary device, if it responds with the NACK (Negative Acknowledgement) means
that it has nothing to send. Now, it approaches the second secondary device, it
responds with the ACK means that it has the data to send. The secondary device
can send more than one frame one after another or sometimes it may be required
to send ACK before sending each one, depending on the type of the protocol
being used.
Select
If the primary device wants to send some data to
the secondary device, then it tells the target secondary to get ready to
receive the data, this process is known as selecting.
When the primary device wants to send some data,
then it alerts the secondary device for the upcoming transmission by
transmitting a Select (SEL) frame, one field of the frame includes the address
of the intended secondary device.
The secondary device receives the SEL frame, it
sends an acknowledgement that indicates the secondary ready status. If the
secondary device is ready to accept the data, then the primary device sends two
or more data frames to the intended secondary device.
Once the data has been transmitted, the
secondary sends an acknowledgement specifies that the data has been received.