DATA LINK LAYERBy Dr. Nawaporn Wisitpongphan
INTRODUCTION TO SOME RANDOM TOPIC IN COMPUTER NETWORK
EPIDEMIC ROUTING
OUTLINE
5
DATA LINK CONTROL PROTOCOLS
Data Link Control Protocols
LineDiscipline
FlowControl
ErrorControl
Who shouldSend now?
How much dataCan be sent?
How can errorbe corrected?
6
DATA LINK CONTROL PROTOCOLS
Line Discipli
nePoll/Selec
t
ENQ/ACK
•In half-duplex transmissions, it is essential 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 coordination of half-duplex transmission is part of a procedure called line discipline.
ENQ/ACK
ENQ/ACK coordinates which device may start a transmission and whether or not the intended recipient is ready and enabled. See fig 10.4
Using ENQ/ACK, a session can be initiated by either station on a link as long as both are of equal rank.
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? Refer fig. 10.5
7
ENQ/ACK
POLL/SELECT
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.
Multipoint systems must coordinate several nodes, not just two.
The question to be determined 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?
POLL/SELECT : HOW DOES IT WORK? Whenever multipoint link consists of a primary
device and multiple secondary devices using a single transmission line, all exchanges must be made through primary device.
The primary device controls the link; the secondary device follow its instructions.
It is up to the primary to determine which device is allowed to use the channel at a given time
The primary, therefore is always the initiator of a session.
If the primary wants to receive data and send data. It apply function called poll and select respectively.
ADDRESSING IN POLL/SELECT
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.
POLL
The polling function is used by the primary device to solicit transmission from the secondary devices.
As noted, 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, the multipoint system guarantees that only one transmission can occur at a time, thereby ensuring against signal collision.
When the primary is ready to receive data, it must ask (poll) each device in turn if it has anything to send.
When the first secondary is approached, it responds either with a NAK frame if it has nothing to send or with data (in the form of a data frame) if it does.
POLL (CONT)
There are two possibilities for terminating the exchange: either the secondary sends all its data, finishing with an 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 remaining devices
14
POLL
SELECT The select mode is used whenever the
primary device has something to send. But first, it must ensure that the target device
is prepared to receive. So the primary must alert the secondary to
the upcoming transmission and wait for an acknowledgment of the secondary’s ready status.
Before sending data, the primary, the primary creates and transmits a select (SEL) frame, one field of which includes the address of the intended secondary.
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.
16
SELECT
17
DATA LINK CONTROL PROTOCOLS
Data Link Control Protocols
LineDiscipline
FlowControl
ErrorControl
Who shouldSend now?
How much dataCan be sent?
How can errorbe corrected?
18
FLOW CONTROL/ STOP & WAIT
Flow Control
Sliding WindowStop-and-WaitSend 1 frame
at a timeSend several
frames at a time
19
STOP-AND-WAIT FLOW CONTROL Procedure
1. Source transmits frame2. Destination receives frame and replies
with acknowledgement (ACK)3. Source waits for ACK before sending
the next frame4. Destination can stop flow by not send
ACK
Works well for a few large frames
Stop and wait becomes inadequate if large block of data is split into small frames
20
STOP-AND-WAIT FLOW CONTROL
21
STOP-AND-WAIT LINK UTILIZATION
Transmission Time is normalized to 1, Propagation Delay is expressed as ‘a’
22
FLOW CONTROL/ SLIDING WINDOW
Flow Control
Sliding WindowStop-and-WaitSend 1 frame
at a timeSend several
frames at a time
SLIDING-WINDOWS FLOW CONTROLAllows multiple frames to be in transit
Receiver has buffer for W frames
Transmitter sends up to W frames once without ACK from receiver
ACK includes sequence number of next frame expected
Sequence number is bounded by size of field (k)
frames are numbered modulo 2k
giving max window size of up to 2k - 123
SLIDING-WINDOWS FLOW CONTROL Receiver can ACK frames without permitting
further transmission (Receive Not Ready)
Must send a normal acknowledgment to resume data transmission
Can use Piggyback ACKs in Full Duplex Links Send data and ACK together in 1 frame If a station has only ACK to send (No data) : Send
a separate ACK frame (RR/RNR) If a station has only data to send (No new ACK) :
Send a repeat (as previous) ACK frame
24
25
SLIDING-WINDOW DIAGRAM
26
SLIDING-WINDOW EXAMPLE
27
DATA LINK CONTROL PROTOCOLS
Data Link Control Protocols
LineDiscipline
FlowControl
ErrorControl
Who shouldSend now?
How much dataCan be sent?
How can errorbe corrected?
ERROR CONTROL
Detection and correction of errors such as: Lost frames Damaged frames
Common techniques use: Error detection : CRC Positive acknowledgment Retransmission after timeout Negative acknowledgement & retransmission
28
29
AUTOMATIC REPEAT REQUEST (ARQ)
Collective name for such error control mechanisms, including: Stop-and-Wait Go-back-N Selective-Reject (selective retransmission)
STOP-AND-WAIT ARQ Based on Stop-and-Wait Flow Control Source transmits single frame & wait for ACK If received frame damaged, discard it
Transmitter has timeout If no ACK within timeout, retransmit
If ACK is damaged, transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame - Discard Use alternate numbering and ACK0 / ACK1
30
31
STOP-AND-WAIT ARQ
Possible Transmission Errors Data Lost ACK Lost
Pros Simple
Cons inefficient
GO-BACK-N ARQ Based on Sliding-Window Flow Control
If no error, ACK as usual
Use window to control number of outstanding frames
If error, reply with rejection Discard that frame and all future frames until
error frame received correctly Transmitter must go back and retransmit that
frame and all subsequent frames 32
GO-BACK-N – HANDLING ERROR Damaged Frame
Error in frame i so receiver rejects frame i
Transmitter retransmits frames from i
Lost FrameFrame i lost and either
Transmitter sends i+1 and receiver gets frame i+1 out of sequence and rejects frame i
Or transmitter times out and send ACK with P-bit set which receiver responds to with ACK i
Transmitter then retransmits frames from i 33
GO-BACK-N - HANDLING Damaged Acknowledgement
Receiver gets frame i, sends ACK (i+1) which is lost
ACKs are cumulative, so next ACK (i+n) may arrive before transmitter times out on frame i
If transmitter times out, it sends ACK with P-bit set
Can be repeated a number of times before a reset procedure is initiated
Damaged RejectionReject for damaged frame is lostHandled as for lost frame when
transmitter times out 34
SELECTIVE-REJECT ARQ
Also called Selective-Retransmission Only rejected frames are retransmitted Subsequent frames are accepted by
the receiver and buffered Minimizes retransmission Receiver must maintain large enough
buffer More complex logic in transmitter Hence less widely used Useful for satellite links with long
propagation delays35
36
GO BACK N VS.SELECTIVE REJECT
PREVIEW OF THE NEXT CLASS
38
EVOLUTION OF CONTENTION PROTOCOLS
Developed in the 1970s for a packet radio network
Aloha
SlottedAloha
Improvement: Start transmission only at fixed times (slots)
CSMA
CSMA = Carrier Sense Multiple AccessImprovement: Start transmission only if no transmission is ongoing
CD = Collision DetectionImprovement: Stop ongoing transmission if a collision is detected (e.g. Ethernet)
CSMA/CD