+ All Categories
Home > Documents > Computer Communications 2.pdf

Computer Communications 2.pdf

Date post: 14-Apr-2018
Category:
Upload: mustafa-alobeidi
View: 220 times
Download: 0 times
Share this document with a friend

of 14

Transcript
  • 7/27/2019 Computer Communications 2.pdf

    1/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    43

    Dr.Eng.Ziyad Tariq Al-Ta'i

    Data Link Control

    Introduction:

    Communication requires at least two devices workingtogether, one to send and one to receive. Even such a basicarrangement requires a great deal of coordination an exchange tooccur. For example, in half duplex transmission, it is essentialthat only one device transmit at a time. If both ends of the link putsignals on the line simultaneously, they collide, leaving nothingon the line but noise. The coordination of half duplex

    transmission is part of a procedure called line discipline. Inaddition to line discipline, data link control includes thefunctions: flow control and error control.

    Line Discipline:

    Line discipline answers the question, who should sendnow?

    Line discipline can be done in two ways:

    1- ENQuiry/ACKnowledgment (ENQ/ACK):

    ENQ/ACK is used primarily in systems where there is noquestion of the wrong receiver getting the transmission, that is,when there is a dedicated link between two devices so that theonly device capable of receiving the transmission is the intendedone.

    ENQ/ACK coordinates which device may start atransmission and whether or not the intended recipient is readyand enabled.

    How it Works:The initiator first transmits a frame called an enquiry (ENQ)

    asking if the receiver is available to receive data. The receivermust answer either with an acknowledgement (ACK) frame if it isready to receive or with a negative acknowledgment (NAK) frameif it is not. By requiring a response even if the answer is negative,

    the initiator knows that its enquiry was in fact received even if thereceiver is currently unable to accept a transmission. If neither an

  • 7/27/2019 Computer Communications 2.pdf

    2/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    44

    Dr.Eng.Ziyad Tariq Al-Ta'i

    ACK nor a NAK is received within a specified time limit, theinitiator assumes that the ENQ frame was lost in transmit,disconnects, and sends a replacement. An initiating systemordinarily makes three such attempts to establish a link before

    giving up.If the response to the ENQ is negative for three attempts, the

    initiator disconnects and begins the process again at anothertime. If the response is positive, the initiator is free to send itsdata. Once all of its data have been transmitted, the sendingsystem finishes with an end of transmission (EOT) frame. Thisprocess is illustrated in following figure.

    Station A Station B

    Establishment

    .Data Transfer .

    .

    Termination

    Time Time

    ACK

    Data

    ACK

    Data

    ACK

    Data

    ACK

    ENQ

    EOT

  • 7/27/2019 Computer Communications 2.pdf

    3/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    45

    Dr.Eng.Ziyad Tariq Al-Ta'i

    2- Poll/Select:

    The poll/select method of line discipline works withtopologies where one device is designed as a primary station and

    the other devices are secondary stations. Multipoint systemsmust coordinate several nodes, not just two. The question to bedetermined in these cases, therefore, is more than just, Are youready? It is also, which of the several nodes has the right to usethe channel?

    How it Works:

    Whenever a multipoint link consists of a primary device and

    multiple secondary devices using a single transmission line, allexchanges must be made through the primary device even whenthe ultimate destination is a secondary device. The primarydevice controls the link; the secondary devices follow itsinstructions. It is up to the primary to determine which device isallowed to use the channel at a given time as shown in followingfigure.

    Primary Secondary Secondary SecondaryA B C

    Who has the right to the channel?

    The primary, therefore, is always the initiator of a session. Ifthe primary wants to receive data, it asks the secondaries if theyhave anything to send; this function is called polling. If theprimary wants to send data, it tells the target secondary to getready to receive; this function is called selecting.

    Every device on a link has an address that can be used foridentification. Poll/select protocols identify each frame as beingeither to or from a specific device on the link. Each secondary

    device has an address that differentiate it from the others.

  • 7/27/2019 Computer Communications 2.pdf

    4/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    46

    Dr.Eng.Ziyad Tariq Al-Ta'i

    Flow Control:

    Flow control refers to a set of procedures used to restrictthe amount of data the sender can send waiting for

    acknowledgment. Two methods have been developed to controlthe flow of data across communications links:

    1- Stop and Wait:

    In the stop and wait method of flow control, the sendersends one frame and waits for an acknowledgment beforesending the next frame, as shown in following figure.

    Sender Receiver

    Wait Time

    Wait Time

    Wait Time

    Time Time

    The advantage of stop and wait is simplicity: each frame ischecked and acknowledged before the next frame is sent. Thedisadvantage is inefficiency: stop and wait is slow. Each frame isalone on the line. If the distance between devices is long, the timespent waiting for ACKs between each frame can add significantlyto the total transmission time.

    ACK

    Data

    ACK

    Data

    ACK

    Data

  • 7/27/2019 Computer Communications 2.pdf

    5/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    47

    Dr.Eng.Ziyad Tariq Al-Ta'i

    2- Sliding Window:

    In the sliding window method of flow control, several framescan be in transmit at a time. The sliding window refers to

    imaginary boxes at both the sender and receiver. This windowcan hold frames at either end and provides the upper limit on thenumber of frames that can be transmitted before requiring anacknowledgment. Frames may be acknowledged at any pointwithout waiting for the window to fill up and may be transmittedas long as the window is not yet full. To keep track of whichframes have been transmitted and which received, sliding windowintroduces an identification scheme based on the size of thewindow. The frames are numbered modulo-n, which means they

    are numbered from 0 to n-1. For example, if n=8, the frames arenumbered 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 windowcannot cover the whole modulo (8 frames); it covers one frameless.

    When the receiver sends an ACK, it includes the number ofthe next frame it expects to receive. In other words, toacknowledge the receipt of a string of frames ending in frame 4,the receiver sends an ACK containing the number 5. When the

    sender an ACK with the number 5, it knows that all frames upthrough 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 acknowledgementis required.

    Conceptually, the sliding window of the sender shrinks fromthe left when frames of data are sent. The sliding window of thesender expands to the right when acknowledgment are received.

    Conceptually, the sliding window of the receiver shrinksfrom the left when frames of data are received. The slidingwindow of the receiver expands to the right whenacknowledgment are sent.

    Example:The following figure shows a sample transmission that uses

    sliding window flow control with a window of seven frames. Inthis example, all frames arrive undamaged.

  • 7/27/2019 Computer Communications 2.pdf

    6/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    48

    Dr.Eng.Ziyad Tariq Al-Ta'i

    Sender Receiver

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20

    Data 0

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20Data 1

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20ACK 2

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20

    Data 2

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20

    ACK 3

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20

    Data 3

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20

    Data 4

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20

    Data 5

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20

    ACK 6

    3 4 5 6 7 02 1 2 31 4 ..

    0

    1 432 0765 ..

    431 20

  • 7/27/2019 Computer Communications 2.pdf

    7/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    49

    Dr.Eng.Ziyad Tariq Al-Ta'i

    At the beginning of transmission, both sender and receiverwindows are fully expanded to include seven frames ( seventransmittable frames in the sender window, seven placeholderframes in the receiver window). The frames within the window are

    numbered 0 through 7 and are part of larger data buffer, 13 ofwhich are shown here.

    Error Control:

    Error correction is implemented simply: anytime an error isdetected in an exchange, a negative acknowledgement (NAK) isreturned and the specified frames are retransmitted. This process

    is called Automatic Repeat Request (ARQ).Error control refers to methods of error detection and

    retransmission. Error control is based on Automatic RepeatRequest (ARQ), which means retransmission of data in threecases: damaged frame, lost frame, and lost acknowledgment.

    ARQ error control is implemented as an adjunct to flowcontrol. In fact, stop and wait flow control is usually implementedas stop and wait ARQ and sliding window is usually implementedas one of two variants of sliding window ARQ, called (go back n)

    or (selective reject).

    a- Stop and Wait ARQ:

    Is a form of stop and wait flow control extended to includeretransmission of data in case of lost or damaged frames. Forretransmission to work four features are added to the basic flowcontrol mechanism:

    1- The sending device keeps a copy of the last frame

    transmitted until it receives an acknowledgement for thatframe. Keeping a copy allows the sender to retransmit. Lostor damaged frames until they are received correctly.

    2- For identification purposes, both data frames and ACKframes are numbered alternately 0 and 1. A data frame isacknowledged by an ACK 1 frame, indicating that thereceiver has gotten data 0 and is now expecting data 1. Thisnumbering allows for identification of data frames in case ofduplicate transmission (important in the case of lostacknowledgements).

  • 7/27/2019 Computer Communications 2.pdf

    8/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    50

    Dr.Eng.Ziyad Tariq Al-Ta'i

    3- If an error is discovered in a data frame, indicating that ithas been corrupted in transit, a NAK frame is returned. NAKframes, which are not numbered. Tell the sender toretransmit the last frame sent.

    4- The sending device is equipped with a timer. If an expectedacknowledgment is not received within an allotted timeperiod, the sender assumes that the last data frame was lostin transit and sends it again.

    Damaged Frames:As shown in following figure:

    Sender Receiver

    Error in frame 0

    Time Time

    Lost Frame:An of the frame types can be lost in transit:

    Lost Data Frame:As shown in following figure:

    ACK 1

    Data 1

    ACK 0

    Data 0

    NAK

    Data 0

    Data 0

    ACK 1

  • 7/27/2019 Computer Communications 2.pdf

    9/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    51

    Dr.Eng.Ziyad Tariq Al-Ta'i

    Sender Receiver

    Time out Lost

    Time Time

    Lost Acknowledgement:As shown in following figure:

    Sender Receiver

    Time out Lost

    Second Copy discarded

    Time Time

    Data 0

    ACK 1

    Data 0

    Data 0

    ACK 1

    Data 0

    ACK 1

  • 7/27/2019 Computer Communications 2.pdf

    10/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    52

    Dr.Eng.Ziyad Tariq Al-Ta'i

    b- Sliding Window ARQ:

    Among several popular mechanism for continuoustransmission error control, two protocols are the most popular:

    go back n and selective reject ARQ, both based on slidingwindow flow control. To extend sliding window to coverretransmission of lost or damaged frames, three features areadded to the basic flow control mechanism:

    1- The sending device keeps copies of all transmittedframes until they have been acknowledged. If frames 0through 6 have been transmitted, and the lastacknowledgement was for frame 2 (expecting 3), thesender keeps copies of frames 3 through 6 until it know

    that they have been received undamaged.2- In addition to ACK frames, the receiver has the option ofreturning a NAK frame if the data have been receiveddamaged. The NAK frame tells the sender to transmit adamaged frame. Because sliding window is a continuoustransmission mechanism (as apposed to stop and wait),both ACK and NAK frames must be numbered foridentification. ACK frames, you will recall, carry thenumber of the damaged frame expected. NAK frames, onthe other hand, carry the number of the damaged frameitself. In both cases, the message to the sender is thenumber of the frame that the receiver expects next. Notethat data frames that are received without errors do nothave to be acknowledged individually.

    3- Like stop and wait ARQ, the sending device in slidingwindow ARQ is equipped with a timer to enable it tohandle lost acknowledgements. In sliding window ARQ,n-1 frames (the size of the window) may be sent before anacknowledgement must be received. If the allotted time

    has run out with no acknowledgement, the senderassumes that the frames were not received andretransmits one or all of the frames depending on theprotocol.

    Go Back n ARQ:

    In this sliding window go back n ARQ method, if one frameis lost or damaged, all frames sent since the last frame

    acknowledged are retransmitted.

  • 7/27/2019 Computer Communications 2.pdf

    11/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    53

    Dr.Eng.Ziyad Tariq Al-Ta'i

    Damaged Frames:As shown in following figure:

    Sender Receiver

    Error,Discarded

    Discarded

    Discarded

    Resent

    Resent

    Resent

    Time Time

    Lost Data Frame:As shown in following figure:

    Data 1

    Data 2

    Data 3

    Data 4

    Data 5

    Data 0

    Data 3

    Data 4

    ACK 3

    NAK 3

    Data 5

  • 7/27/2019 Computer Communications 2.pdf

    12/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    54

    Dr.Eng.Ziyad Tariq Al-Ta'i

    Sender Receiver

    Lost

    Discarded

    Discarded

    Time Time

    Lost Acknowledgement Frame:As shown in following figure:

    Data 1

    Data 2

    Data 3

    Data 4

    Data 0

    Data 2

    Data 3

    NAK 2

    Data 4

  • 7/27/2019 Computer Communications 2.pdf

    13/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    55

    Dr.Eng.Ziyad Tariq Al-Ta'i

    Sender Receiver

    Time out

    Lost

    Time Time

    Selective Reject ARQ:

    In selective reject ARQ, only the specific damaged or lostframe is retransmitted. If a frame is corrupted in transit, a NAK isreturned and the frame is resent out of sequence. The receivingdevice must be able to sort the frames it has and insert theretransmitted frame into its proper place in the sequence. Tomake such selectivity possible, a selective reject ARQ systemdiffers from a go back n ARQ system in the following ways:

    1- The receiving device must contain sorting logic toenable it to reorder frames received out of sequence. Itmust also be able to sort frames received after a NAKhas been sent until the damaged frame has beenreplaced.

    Data 1

    Data 2

    Data 0

    Data 0

    Data 1

    Data 2

    ACK 3

  • 7/27/2019 Computer Communications 2.pdf

    14/14

    Lecture Notes of Computer Communications and Networks

    Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i

    56

    Dr.Eng.Ziyad Tariq Al-Ta'i

    2- The sending device must contain a searchingmechanism that allows it to find and select only therequested frame for retransmission.

    3- A buffer in the receiver must keep all previously

    received frames on hold until all retransmissions havebeen sorted and any duplicate frames have beenidentified and discarded.

    4- To aid selectivity, ACK numbers, like NAK numbers,must refer to the frame received (or lost) instead of thenext frame expected.

    5- This complexity requires a smaller window size than isneeded by the go back n method if it is to workefficiently. It is recommended that the window size be

    less than or equal to (n+1)/2, where n-1 is the go back nwindow size.


Recommended