We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 21
SECTION 10.5. SUMMARY — 321
unacknowledged. In most cases, the receiver will recognize any duplications and dis-
card them.
«Comparison between Go-Back-n and Selective-Reject
Although retransmitting only specific damaged or lost frames may seem more efficient
than resending undamaged frames as well, it is in fact less so. Because of the complex-
ity ofthe sorting and storage required by the receiver, andthe extra logic needed bythe
specific frames for retransmission, selective-reject ARQ is expensive
and not often used. In other words, selective reject gives better performance, but in
practice itis usually discarded in favor of go-back-n for simplicity of implementation.
indow protocol with a
10.4. KEY TERMS AND CONCEPTS
acknowledgment (ACK)
automatic repeat request (ARQ)
buffer
end of transmission (EOT)
cenquiry/acknowledgment (ENQ/ACK)
error control
flow control
go-back-n ARQ
line discipline
negative acknowledgment (NAK)
poll
poll/select
primary station
secondary station
select
selective-reject ARQ.
sliding window
sliding window ARQ
stop-and-wait
stop-and-wait ARQ
10.5 SUMMARY
The second layer in the OSI model, the data link layer, has three main functions:
line discipline, flow control, and error control.
Line discipline establishes the status of a device (sender or receiver) on a link.
ENQ/ACK is a line discipline method used in point-to-point connections.a0
CHAPTER 10 DATA LINK CONTROL.
igure 10.22 Selective-reject, damaged data frame
Senuler Receyver
0
rata]
Dat >|
Data [2
Error in Frame 2
NAK2
Data [3
Data [4
Resent
Data [5
v
Time Time
specific frame indicated but of all previous frames, frames received after the error
frame cannot be acknowledged until the damaged frames have been retransmitted. In
the figure, the receiver accepts data 3, 4, and 5 while waiting for a new copy of data 2
When the new data 2 arrives, an ACK 5 can be returned, acknowledging the new data 2
and the original frames 3, 4, and 5. Quite a bit of logic is required by the receiver to sort
out-of-sequence retransmissions and to keep track of which frames are still missing and
which have yet to be acknowledged.
Lost Frames Although frames can be accepted out of sequence, they cannot be
acknowledged out of sequence. If a frame is lost, the next frame will arrive out of
sequence. When the receiver tries to reorder the existing frames to include it, it will
discover the discrepancy and return a NAK. Of course, the receiver will recognize the
omission only if other frames follow. If the lost frame was the last of the transmission.
the receiver does nothing and the sender treats the silence like a lost acknowledgment.
Lost Acknowledgment Lost ACK and NAK frames are treated by selective-reject
ARQ just as they are by go-back-n ARQ. When the sending device reaches either the
Capacity of its window or the end of its transmission, it sets a timer. If no acknowledg-
ment arrives in the time allotted, the sender retransmits all of the frames that remainSECTION 10.3 ERROR CONTROL — 319
Figure 10.21 Go-hack-n, low ACK
Sender receiver
|
}
Tata
- Data
2 [Date
é Lot € TR
a
Time Time
The sending device must contain a searching mechanism that allows it to find and
select only the requested frame for retransmission,
A buffer in the receiver must keep all previously received frames on hold until all
retransmissions have been sorted and any duplicate frames have been identified
and discarded.
m To aid selectivity, ACK numbers, like NAK numbers, must refer to the frame
received (or lost) instead of the next frame expected.
This complexity requires a smaller window size than is needed by the go-back-n
method if it is to work efficiently. It is recommended that the window size be less
than or equal to (n + 1)/2, where n ~ 1 is the go-back-n window size.
Damaged Frames (Figure 10.22 shows a situation in which a damaged frame is
received. As you can see, frames 0 and | ave received but not acknowledged. Data 2
arrives and is found to contain an error, so a NAK 2 is returned, Like NAK frames in
go-back-n error correction, a NAK here both acknowledges tHe intact receipt of any
previously unacknowledged data frames and indicates an error in the current frame. In
the figure, NAK 2 tells the sender that data 0 and data 1 have been accepted, but that
data 2 must be resent. Unlike the receiver in a go-back-n system, however, the receiver
\in a selective-reject system continues to accept new frames while waiting for an error to
be corrected However, because an ACK implies the successful receipt not only of theMS CHAPTER 10 DATA LINK CONTROL
0.20, Goshuek-n, lost data frame
Pig
Semler
Ifthe ACK (or, especially, if the NAK) sent by the receiver has been lost, the sender
could wait forever. To avoid tying up both devices, the sender is equipped with a timer
that begins counting whenever the window capacity is reached. If an acknowledgment
has not been received within the time limit, the sender retransmits every frame trans-
mitted since the last ACK.
Figure 10.21 shows a situation in which the sender has transmitted all of its frames
and is waiting for an acknowledgment that has been lost along the way. The sender
waits a predetermined amount of time, then retransmits the unacknowledged frames.
‘The receiver recognizes that the new transmission is a repeat of an earlier one, sends
another ACK, and discards the redundant data,
4 Selective-Reject ARQ
(In selective-reject ARQ, only the specific damaged or lost frame is retransmitted. If a
frame is corrupted in transit, a NAK is returned and the frame is resent out of sequenc
‘The receiving device must be able to sort the frames it has and insert the retransmitt
frame into its proper place in the sequence. To make such selectivity possible, a selective-
reject ARQ system differs from a go-back-n ARQ system in the following ways:
The receiving device must contain sorting logic to enable it to reorder frames
received out of sequence, It must also be able to store frames received after a NAK
has been sent until the damaged frame has been replaced.f@
Sle
SECTION 10.3 ERROR CONTROL — 317
gure 10.19 | Go-hack-n, damaged data frame
Sener
Error, Discarded
|i a ‘ACK 3
Discarded
3
Discarded
Resent
Resent 7
Reset |__y 7
Time Time
transit, the next frame to arrive at the receiver will be out of sequence. The receiver
checks the idéntifying number on each frame, discovers that one or more have been
skipped, and returns a NAK for the first missing frame. A NAK frame does not indicate
whether the frame has been lost or damaged, just that it needs to be resent. The sending
device then retransmits the frame indicated by the NAK, as well as any frames that it
had transmitted after the lost one.
In Figure 10.20, data 0 and data [ arrive intact but data 2 is lost. The next frame to
arrive at the receiver is data 3, The receiver is expecting data 2 and so considers data 3
to be an error, discards it, and returns a NAK 2, indicating that 0 and | have been
accepted but 2 is in error (in this case lost). In this example, because the sender has
transmitted data 4 before receiving the NAK 2, data 4 arrives at the destination out of
sequence and is therefore discarded. Once the sender receives the NAK 2, it retransmits,
all three pending frames (2. 3. and 4).
Lost Acknowledgment The sender is not expecting to receive an ACK frame for
every data frame it sends. It cannot use the absence of sequential ACK numbers to
identify lost ACK.or NAK frames, Instead. it uses a timer. The sending device can send
as many frames as the window allows before waiting for an acknowledgment. Once
that limit has been reached or the sender has no more frames to send, it must waiteIaw
M6 CHAPTER 10 DATA LINK CONTROL
receiver expects next. Note that data frames that are received without errors do not
have to be acknowledged individually. If the last ACK was numbered 3, an ACK 6
acknowledges the receipt of frames 3 and 4 as well as frame 5, Every damaged
frame, however, must be acknowledged. If data frames 4 and 5 are received dam-
aged, both NAK 4 and NAK 5 must be returned. However. a NAK 4 tells the sender
ived intact
frames received before frame 4 have a
Like stop-and-wait ARQ, the sending device in sliding window ARQ is equipped
‘with a timer to enable it to handle lost acknowledgments. In sliding window ARQ,
n= 1 frames (the size of the window) may be sent before an acknowledgment must
be received. In ~ | frames are awaiting acknowledgment, the sender starts a timer
and waits before sending any more. If the allotted time has run out with no
acknowledgment, the sender assumes that the frames were not received and re-
transmits one or all of the frames depending on the protocol. Note that as with
stop-and-wait ARQ. the sender here has no way of knowing whether the lost
yes are data, ACK. or NAK frames. By retransmitting the data frames, two pos-
sibilities are covered: lost data and lost NAK. Ifthe lost frame was an ACK frame,
the receiver can recognize the redundancy by the number on the frame and discard
the redundant data.
wGo-Back-n ARQ
In this sliding window go-back-n ARQ method, if one frame is lost or damaged, all
frames sent since the last frame acknowledged are retransmitted.
Damaged Frame What if frames 0, 1, 2, and 3 have been transmitted, but the first
acknowledgment received is a NAK 3? Remember that a NAK means two things: (1) a
positive acknowledgment of all frames received prior to the damaged frame and (2) a
negative acknowledgment of the frame indicated. If the first acknowledgment is a NAK 3,
it means that data frames 0, 1, and 2 were all received in good shape. Only frame 3 must
be resent.
What if frames 0 through 4 have been transmitted before a NAK is received for
frame 2? As soon as the receiver discovers an error, it stops accepting subsequent frames
until the damaged frame has been replaced correctly. In the scenario above, data 2 arrives
damaged and so is discarded, as are data 3 and data 4 whether or not they have arrived
intact. Data 0 and data 1, which were received before the damaged frame, have already
been accepted, a fact indicated to the sender by the NAK 2 frame. The retransmis
therefore consists of frames 2, 3, and 4.
Figure 10.19 gives an example where six frames have been transmitted before an
error is discovered in frame 3. In this case, an ACK 3 has been returned, telling the
sender that frames 0, 1, and 2 have all been accepted. In the figure, the ACK 3 is sent
before data 3 has arrived, Data 3 is discovered to be damaged, so a NAK 3 is sent
immediately and frames 4 and 5 are discarded as they come in, The sending device
retransmits all three frames (3, 4, and 5) sent since the last acknowledgment, and the
process continues, The receiver discards frames 4 and 5 (as well as any subsequent
frames) until it receives a good data 3.
Lost Data Frame Sliding window protocols require that data frames be transmitted
sequentially. It one or more frames are so noise corrupted that they become lost in)
Ss
(es
ty
SECTION 10.3 ERROR CONTROL 315
Lost Acknowledgment In this case, the data frame has made it to the receiver and
has been found to be either acceptable or not acceptable. But the ACK or NAK frame
returned by the receiver is lost in transit. The sending device waits until its timer goes
off, then retransmits the data frame, The receiver checks the number of the new data
frame. If the lost frame was a NAK, the receiver accepts the new copy and returns the
appropriate ACK (assuming the copy arrives undamaged). If the lost frame was an
ACK, the receiver recognizes the new copy as a duplicate, acknowledges its receipt,
then discards it and waits for the next frame (see Figure 10.18).
Figure 10.18 | Stop-and-wait ARQ, lost ACK frame
Sender
Time out
Time Time
we Sliding Window ARQ
Among the several popular mechanisms for continuous transmission error control, two
protocols are the most popular: go-back-n ARQ and selective-reject ARQ, both based
on sliding window flow control. To extend sliding window to cover retransmission of
lost or damaged frames, three features are added to the basic flow control mechanism:
The sending device keeps copies of all transmitted frames until they have been
acknowledged. If frames 0 through 6 have been transmitted, and the last acknowl-
edgment was for frame 2 (expecting 3), the sender keeps copies of frames 3
through 6 until it knows that they have been received undamaged.
@ _Inaddition to ACK frames, the receiver has the option of returning a NAK frame if
the data have been received damaged. The NAK frame tells the sender to retransmit
a damaged frame. Because sliding window is a continuous transmission mecha-
nism (as opposed to stop-and-wait), both ACK and NAK frames must be numbered
for identification. ACK frames, you will recall, carry the number of the next frame
expected. NAK frames, on the other hand, carry the number of the damaged frame
itself. In both cases, the message to the sender is the number of the frame that the10 DATA LINK CONTROL,
Figure 10.16 Stop-and-wait ARQ, damaged frame
Senter Reccver
CI CI
S AS
ta To "|
. REET
Data [1 }—— >
|, {ack
Data [> }—_____,
Error in Frame 0
Le NAK
Data a
ACKT
\< *
v v
Time Time
Figure 10.17 Stop-and-wait ARQ, lost data frame
Time out
Time
TimeSECTION 10.4 ERROR CONTROL, —- 313
@ For identification purposes, both data frames and ACK frames are numbered alter-
nately Q and 1, A data 0 frame is acknowledged by an ACK I frame, indicating that
the receiver has gotten data 0 and is now expecting data 1. This numbering allows
for identification of data frames in case of duplicate transmission (important in the
case of lost acknowledgments, as we will see below).
If an error is discovered in a data frame, indicating that it has been corrupted in
transit, a NAK frame is returned. NAK frames, which are not numbered, tell the
sender to retransmit the last frame sent. Stop-and-wait ARQ requires that the
sender wait until it receives an acknowledgment for the last frame transmitted
before it transmits the next one, When the sending device receives a NAK, it re-
sends the frame transmitted after the last acknowledgment, regardless of number.
The sending device is equipped with a timer. If an expected acknowledgment is not
received within an allotted time period, the sender assumes that the last data frame
was lostin transit and sends it again.
«Damaged Frames
When a frame is discovered by the receiver to contain an error, it returns a NAK frame
and the sender retransmits the last frame. For example, in Figure 10.16, the sender trans-
mits a data frame: data 0. The receiver returns an ACK 1. indicating that data 0 arrived
undamaged and it is now expecting data 1. The sender transmits its next frame: data 1. It
arrives undamaged, and the receiver returns ACK 0. The sender transmits its next frame:
data 0. The receiver discovers an error in data 0 and returns a NAK. The sender retrans-
mits data 0. This time data 0 arrives intact, and the receiver retums ACK 1.
"Yést Frame
Any of the three frame types can be lost in transit.
Lost Data Frame Figure 10.17 shows how stop-and-wait ARQ handles the loss of a
data frame. As noted above, the sender is equipped with a timer that starts every time a
data frame is transmitted. If the frame never makes it to the receiver, the receiver can
never acknowledge it, positively or negatively. The sending device waits for an ACK or
NAK frame until its timer goes off, at which point it tries again. It retransmits the last
data frame, restarts its timer, and waits for an acknowledgment.CHAPTER 10 DATA LINK CONTROL
seven placeholder frames in the receiver window), The frames within the windows are
numbered 0 through 7 and are part of a larger data buffer, 13 of which are shown here,
More about Window Size
In the sliding window method of flow control, the size of the window is one less than
the modulo range so that there is no ambiguity in the acknowledgment of the received
frames, Assume that the frame sequence numbers are modulo-8 and the window size is
also 8, Now imagine that frame 0 is sent and ACK 1 is received. The sender expands its
window and sends frames 1, 2,3, 4, 5, 6, 7, and 0. If it now receives an ACK 1 again, it
is not sure if this is a duplicate of the previous ACK 1 (duplicated by the network) or a
new ACK | confirming the most recently sent eight frames. But if the window size is 7
(instead of 8), this scenario could not happen.
,< 10.3 ERROR CONTROL
In the data link layer, the term error control refers primarily to methods of error detec-
tion and retransmission,
Automatic Repeat Request (ARQ)
Error correction in the data link layer is implemented simply: anytime an error is
detected in an exchange, a negative acknowledgment (NAK) is returned and the speci-
fed frames are retransmit, This process is called automatic repeat request (ARQ).
Error control in the data link layer is based on automatic repeat request (ARQ), which means
retransmission of data in three cases: damaged frame, lost frame, and lost acknowledgment.
It sometimes happens that a frame is so damaged by noise during transmission that
the receiver does not recognize it as a frame at all. In those cases, ARQ allows us to say
that the frame has been lost. A second function of ARQ is the automatic retransmission
of lost frames, including lost ACK and NAK frames (where the loss is detected by the
sender instead of the receiver).
ARQ error control is implemented in the data link layer as an adjunct to flow con-
trol. In fact, stop-and-wait flow control is usually implemented as stop-and-wait ARQ
and sliding window is usually implemented as one of two variants of sliding window
ARQ, called go-back-n or selective-reject (see Figure 10.15).
Stop-and-Wait ARQ
Stop-and-wait ARQ is a form of stop-and-wait flow control extended to include re-
transmission of data in case of lost or damaged frames. For retransmission to work,
four features are added to the basic flow control mechanism:
The sending device keeps a copy of the last frame transmitted until it receives an
acknowledgment for that frame. Keeping a copy allows the sender to retransmit
lost or damaged frames until they are received correctly.we
SECTION 10.2, FLOW CONTROL 311
Conceptually, the sliding window of the receiver shrinks from the left when fra
received. The sliding window of the receiver expands to the right when acknowledgments are
sent
As cach ACK is sent out, the receiving window expands to include as many new
placeholders as newly acknowledged frames. The window expands to include a number
of new frame spaces equal to the number of the most recently acknowledged frame
minus the number of the previously acknowledged frame. In a seven-frame window. if
the prior ACK was for frame 2 and the current ACK is for frame 5, the window expands
by three (5 — 2). If the prior ACK was for frame 3 and the current ACK is for frame 1,
the window expands by six (1 +8 ~ 3),
An Example
Figure 10.14 shows ion that uses sliding window flow control with a
window of seven frames. In this example, all frames arrive undamaged. As we will see
in the next section, if errors are found in received frames, or if one or more frames are
lost in transit, the process will become more complex.
a sample transmis
Figure 10.14 Example of sliding window
Sender Receiver
Da
Data
Data
ACKG
At the beginning of the transmission, both sender and receiver windows are fully
expanded to include seven frames (seven transmittable frames in the sender window,ele Wd
30
CHAPTER 10 DATA LINK CONTROL.
Figure 10.12. Sender sliding window
Sender window
MEE E EPP EEE
J Direction K+ Direction
‘This wall moves tothe right } [This wall moves tothe right
when a frame is sent when an ACK is received,
to include the next four frames in its buffer. At this point, the sender’s window contains
six frames (numbers 5, 6, 7, 0, 1, 2). If the received ACK had been numbered 2, the
sender's window would have expanded by only two frames, to contain a total of four.
Conceptually, the sliding window of the sender shrinks from the left when frames of data are
sent. The sliding window of the sender expands to the right when acknowledgments are
received
Receiver Window
At the beginning of transmission, the receiver window contains not n ~ I frames but
n= 1 spaces for frames. As new frames come in, the size of the receiver window
shrinks. The receiver window therefore represents not the number of frames received
but the number of frames that may still be received before an ACK must be sent. Given
a window of size w, if three frames are received without an acknowledgment being
returned, the number of spaces in the window is w 3. As soon as an acknowledgment
is sent, the window expands to include places for a number of frames equal to the num-
ber of frames acknowledged. Figure 10.13 shows a receiving window of size 7. In the
figure, the window contains spaces for seven frames, meaning that seven frames may
be received before an ACK must be sent. With the arrival of the first frame, the receiv
ing window shrinks, moving the boundary from space 0 to 1. The window has shrunk
by one, so the receiver may now accept six frames before itis required to send an ACK.
If frames 0 through 3 have arrived but have not been acknowledged, the window will
contain three frame spaces.
Figure 10.13 Receiver sliding window
Receiver window
TERETE
Direction Direction
‘This wall moves to the right
‘This wall moves to the right
when a frame is received.
‘when an ACK is sent.SECTION 10.2. FLOW CONTROL — 309
that the link can carry several frames at once and its capacity can be used efficiently. The
receiver acknowledges only some of the frames, using a single ACK to confirm the
receipt of multiple data frames,
Tn the sliding window method of flow control, several frames can be in transit at a time.
The sliding window refers to imaginary boxes at both the sender and the receiver.
‘This window can hold frames at either end and provides the upper limit on the number
of frames that can be transmitted before requiring an acknowledgment. Frames may be
acknowledged at any point without waiting for the window to fill up and may be trans-
mitted as long as the window is not yet full. To keep track of which frames have been
transmitted and which received, sliding window introduces an identification scheme
based on the size of the window. The frames are numbered modulo-n, which means
they are numbered from 0 to n ~ 1. For example, if n = 8, the frames are numbered 0, 1,
2, 3,4, 5,6, 7.0, 1,2, 3,4, 5, 6,7, 0,1, .. « The size of the window is n — 1 (in this case,
7), In other words, the window cannot cover the whole module (8 frames); it covers one
frame less. The reason for this will be discussed at the end of this section.
‘When the receiver sends an ACK, it includes the number of the next frame it
expects to receive. In other words, to acknowledge the receipt of a string of frames end-
ing in frame 4, the receiver sends an ACK containing the number 5. When the sender
sees an ACK with the number 5, it knows that all frames up through number 4 have
been received.
The window can hold n ~ 1 frames at either end; therefore, a maximum of n—1
frames may be sent before an acknowledgment is required. Figure 10.11 shows the
relationship of a window to the main buffer.
Figure 10.11 Sliding window
Window
sisP RRBs
[710
Sender Window
At the beginning of a transmission, the sender's window contains n —1 frames. As
frames are sent out, the left boundary of the window moves inward, shrinking the size
of the window. Given a window of size ws, if three frames have been transmitted since
the last acknowledgment, then the number of frames left in the window is w ~ 3.
Once an ACK arrives, the window expands to allow in a number of new frames equal
to the number of frames acknowledged by that ACK. Figure 10.12 shows a sender
sliding window of size 7.
Given a window of size 7, as shown in Figure 10.12, if frames 0 through 4 have
been sent and no acknowledgment has been received, the sender’s window contains two
frames (numbers 5 and 6). Now, if an ACK numbered 4 is received, four frames
(O through 3) are known to have arrived undamaged and the sender’s window expands308
CHAPTER 10. DATA LINK CONTROL
egos and-Wait
Ina stop-and-wait method of flow control, the sender waits for an acknowledgment
after every frame it sends (see Figure 10.10). Only when an acknowledgment has been
received is the next frame sent. This process of alternately sending and waiting repeats
until the sender transmits an end of transmission (EOT) frame. Stop-and-wait can be
compared to a picky executive giving dictation: she says a word, her assistant says
“OK.” she says another word, her assistant says "OK," and so on.
In the stop-and-wait method of flow control, the sender sends one frame and waits for an
acknowledgment before sending the next frame.
Figure 10.10. Stop-and-wait
Receiver
Time
Time
‘The advantage of stop-and-wait is simplicity: each frame is checked and acknow!-
edged before the next frame is sent. ThE disadvantage is inefficiency: stop-and-wait is
slow. Each frame must travel all the way to the receiver and an acknowledgment must
travel all the way back before the next frame can be sent. In other words, each frame is
alone on the line. Each frame sent and received uses the entire time needed to traverse
the link. If the distance between devices is long, the time spent waiting for ACKs
between each frame can add significantly to the total transmission time.
Sliding Window
In the sliding window method of flow control, the sender can transmit several frames
before needing an acknowledgment. Frames can be sent one right after another, meaningSECTION 10.2. FLOW CONTROL 307
Figure 10.8 Poll
Secondary Secondary Secondary
Primary ‘’‘ D c
=
le TAR
of such processing is often slower than the rate of transmission, For this reason, each
receiving device has a block of memory, called a buffer, reserved for storing incoming
data until they are processed. If the buffer begins to fill up, the receiver must be able to
tell the sender to halt transmission until it is once again able to receive.
Flow control refers to a set of procedures used to restrict the amount of data the sender can.
send before waiting for acknowledgment.
‘Two methods have been developed to control the flow of data across communica-
tions links: stop-and-wait and sliding window (see Figure 10.9).
iowS009 Categories of low control
Send one frame at atime Send several frames at a time
Siding windowOe AES NORTE CIES
Figure 10.7. Select
Secondary Secondary Secondary
Primary A B 7
2S
1
the multipoint system guarantees that only one transmission can occur at a time.
thereby ensuring against signal collisions without requiring elaborate precedence pro-
tocols. When the primary is ready to receive data, it must ask (poll) each device in tara
if it has anything to send. When the first secondary is approached, it responds eit
with a NAK frame if it has nothing to send or with data (in the form of a data frame) if
itdoes.
If the response is negative (a NAK frame), the primary then polls the next seconé-
ary in the same way until it finds one with data to send. When the response is positive (2
data frame), the primary reads the frame and returns an acknowledgment (ACK frame)
verifying its receipt. The secondary may send several data frames one after the other. =
it may be required to wait for an ACK before sending each one, depending on the prote-
col being used.
There are two possibilities for terminating the exchange: either the secondary
sends all its data, finishing with an end of transmission (EOT) frame, or the primary
says, “Time’s up.” Which of these occurs depends on the protocol and the length of the
message. Once a secondary has finished transmitting, the primary can poll the remais-
ing devices (see Figure 10.8).
0 FLOW CONTROL
The second aspect of data link control is flow control. In most protocols, flow control is
a set of procedures that tells the sender how much data it can transmit before it must
wait for an acknowledgment from the receiver. The flow of data must not be allowed
overwhelm the receiver. Any receiving device has a limited speed at which it can pro-
cess incoming data and a limited amount of memory in which to store incoming dats
The receiving device must be able to inform the sending device before those limits #2
reached and to request that the transmitting device send fewer frames or stop emi=—
rarily. Incoming data must be checked and processed before they can be used. The #SECTION 10.1 LINE DISCIPLINE 308
ure 10.6 Pollselect discipline
tothe channel?
Primary Secondary Secondary Secondary
A
Addresses For point-to-point configurations, there is no need for addressing; any
transmission put onto the link by one device can be intended only for the other. For the
primary device in a multipoint topology to be able to identify and communicate with a
specific secondary device, however, there must be an addressing convention. For this
reason, every device on a link has an address that can be used for identification,
Polliselect protocols identify each frame as being either to or from a specific device
on the link. Each secondary device has an address that differentiates it from the others.
Inany transmission, that address will appear in a specified portion of each frame, called
an address field or header depending on the protocol. If the transmission comes from
the primary device, the address indicates the recipient of the data. If the transmission
‘comes from a secondary device, the address indicates the originator of the data. We will
discuss addressing further when we discuss specific protocols in Chapter 12.
Select The select mode is used whenever the primary device has something to send.
Remember that the primary controls the link. If the primary is not either sending or
receiving data, it knows the link is available. If it has something to send, it send:
What it does not know, however, is whether the target device is prepared to receive
(usually, prepared to receive means on). So the primary must alert the secondary to the
‘upcoming transmission and wait for an acknowledgment of the secondary’s ready sta-
tus. Before sending data, the primary creates and transmits a select (SEL) frame, one
field of which includes the adress of the intended secondary. Multipoint topologies
usea single link for several devices, which means that any frame on the link is available
toevery device. As a frame makes its way down the link, each of the secondary devices
checks the address field, Only when a device recognizes its own address does it open
the frame and read the data. In the case of a SEL frame, the enclosed data consist of an
alert that data are forthcoming.
If the secondary is awake and running, it returns an ACK frame to the primary. The
primary then sends one or more data frames, each addressed to the intended secondary.
Figure 10.7 illustrates this procedure.
Poll The polling function is used by the primary device to solicit transmissions from
the secondary devices, As noted above, the secondaries are not allowed to transmit data
unless asked (don’t call us—we'll call you). By keeping all control with the primary,
NinCHAPTER 10 DATA LINK CONTROL
Figure 10.5 ENQ/ACK line discipline
ae —_
EN
Exbishment 2 =>
ACK
le
Data >|
ACK
<
Data
- —>|
Data transfer ACK
>|
|, —____{ ace }-
Termination FOr
fermi =n
Time Time
«PolSelect
The poll/select method of line discipline works with topologies where one device is
designated as a primary station and the other devices are secondary stations. Multi-
point systems must coordinate several nodes, not just two. The question to be deter-
mined in these cases, therefore, is more than just, Are you ready? It is also, Which of
the several nodes has the right to use the channel?
How It Works | Whenever a multipoint link consists of a primary device and multiple
secondary devices using a single transmission line, all exchanges must be made
through the primary device even when the ultimate destination is a secondary device.
(Although the illustrations that follow show a bus topology, the concepts are the same
for any multipoint configuration.) The primary device controls the link; the secondary
devices follow its instructions. It is up to the primary to determine which device is
allowed to use the channel at a given time (see Figure 10.6). The primary, therefore, is
always the initiator of a session, If the primary wants to receive data, it asks the second-
aries if they have anything to send; this function is called polling. If the primary wants
to send data, it tells the target secondary to get ready to receive; this function is called
selecting.SECTION 10.1 LINE DISCIPLINE 303
Figure 10.3 Line discipline categories
ENQIACK
Polliselet
ENQ/ACK coordinates which device may start a transmission and whether or not
the intended recipient is ready and enabled (see Figure 10.4). Using ENQUACK, a ses
sion can be initiated by either station on a link as long as both are of equal rank—
printer, for example, cannot initiate communication with a CPU,
Figure 10.4 Line discipline concept: ENQ/ACK
‘Who should stan?
How can one station be sure that
the other is ready?
Staton A Station B
In both half-duplex and full-duplex transmission, the initiating device establishes
the session, In half-duplex, the initiator then sends its data while the responder waits.
‘The responder may take over the link when the initiator is finished or has requested a
response. In full-duplex, both devices can transmit simultaneously once the session has
been established.
How It Works The initiator first transmits a frame called an enquiry (ENQ) asking if
the receiver is available to receive data. The receiver must answer either with an
acknowledgement (ACK) frame if itis ready to receive or with a negative acknowl-
‘edgement (NAK) frame if it is not. By requiring a response even if the answer is nega-
tive, the initiator knows that its enquiry was in fact received even if the receiver is
currently unable to accept a transmission. If neither an ACK nor a NAK is received
within a specified time limit, the initiator assumes that the ENQ frame was lost in tran-
sit, disconnects, and sends a replacement, An initiating system ordinarily makes three
such attempts to establish a link before giving up.
If the response to the ENQ is negative for three attempts, the initiator discon-
nects and begins the process again at another time, If the response is positive, the ini-
tiator is free to send its data. Once all of its data have been transmitted, the sending
system finishes with an end of transmission (EOT) frame. This process is illustrated
in Figure 10.5,ae
2= 302 CHAPTER 10. DATA LINK CONTROL
w&
w -B> Line discipline coordinates the link systems. It determines which device can send
and when it can send.
#~ Flow control coordinates the amount of data that can be sent before receiving
acknowledgment. It also provides the receiver's acknowledgment of frames
received intact, and so is linked to error control.
Error control means error detection and correction. It allows the receiver to inform
the sender of any frames lost or damaged in transmission and coordinates the
retransmission of those frames by the sender (see Figure 10.2).
Figure 10.2 Data link layer functions
Data Link controt
5 Flow
discipline control control
Whoshould send How much data__-How ean errors be
now? may besent? detected and corrected?
10.1 LINE DISCIPLINE
Whatever the system, no device in it should be allowed to transmit until that device has
evidence that the intended receiver is able to receive and is prepared to accept the trans-
mission, What if the receiving device does not expect a transmission, is busy, or is out
of commission? With no way to determine the status of the intended receiver, the trans-
mitting device may waste its time sending data to a nonfunctioning receiver or may
interfere with signals already on the link. The line discipline functions of the data link
layer oversee the establishment of links and the right of a particular device to transmit
at a given time,
Line discipline answers the question, Who should send now?
Line disc'pline can be done in two ways: enquiry/acknowledgment (ENQ/ACK)
and poll/select. The first method is used in peer-to-peer communication; the second
‘method is used in primary~secondary communication (see Figure 10.3).
a ENQ/ACK
Enquiry/acknowledgment (ENQ/ACK) is used primarily in systems where there is
‘no question of the wrong receiver getting the transmission, that is, when there is a ded-
) icated link between two devices so that the only device capable of receiving the trans-
mission is the intended one.CHAPTER 10
Data Link Control
Up to this point, we have been examining the structure and transmission of signals
across media links. But unless accurately received by a second device, a signal trans-
mitted over a wire is just so much wasted electricity. With transmission alone we can
put a signal onto a line, but we have no way of controlling which of several devices
attached to that line will receive it, no way of knowing if the intended receiver is ready
and able to receive it, and no way of keeping a second device on the line from transmit-
ting at the same time and thereby destroying our signal. In the physical layer of the OSI
model, we have transmission but we do not yet have communication.
Communication requires at least two devices working together, one to send and
one to receive. Even such a basic arrangement requires a great deal of coordination for
an intelligible exchange to occur. For example, in half-duplex transmission, it is essen-
tial that only one device transmit at a time. If both ends of the link put signals on the
line simultaneously, they collide, leaving nothing on the line but noise. The coordina-
tion of half-duplex transmission is part of a procedure called line discipline, which is
‘one of the functions included in the second layer of the OSI model, the data link layer.
In addition to line discipline, the most important functions in the data link layer are
flow control and error control (see Figure 10.1). Collectively, these functions are
‘known as data link control.
|
I
|
|
| Figure 10.1. Datalink layer
2. Flow control
3. Error control
301
lio PANIES