Data Link Layer – Main Functions• Data Link Control – procedures for node tonode communications• Framing• Error Control• Flow Control• Media Access Control – procedures to sharethe link
11.3FRAMINGFRAMINGThe data link layer needs to pack bits intoThe data link layer needs to pack bits into framesframes, so, sothat each frame is distinguishable from another. Ourthat each frame is distinguishable from another. Ourpostal system practices a type of framing. The simplepostal system practices a type of framing. The simpleact of inserting a letter into an envelope separates oneact of inserting a letter into an envelope separates onepiece of information from another; the envelope servespiece of information from another; the envelope servesas the delimiter.as the delimiter.
11.8FLOW AND ERROR CONTROLFLOW AND ERROR CONTROL• Two important responsibilities of the data link layerTwo important responsibilities of the data link layerareare flow controlflow control andand error controlerror control..• Flow control refers to a set of procedures used torestrict the amount of data that the sender cansend before getting an acknowledgment.• Error control in the data link layer are proceduresbased on automatic repeat request (ARQ), which isthe retransmission of data.
11.9PROTOCOLSPROTOCOLSNow let us see how the data link layer can combineNow let us see how the data link layer can combineframing, flow control and error control to achieve theframing, flow control and error control to achieve thedelivery of data from one node to another. Thedelivery of data from one node to another. Theprotocols are normally implemented in software byprotocols are normally implemented in software byusing one of the common programming languages. Tousing one of the common programming languages. Tomake our discussions language-free, we have writtenmake our discussions language-free, we have writtenin pseudocode a version of each protocol thatin pseudocode a version of each protocol thatconcentrates mostly on the procedure instead ofconcentrates mostly on the procedure instead ofdelving into the details of language rules.delving into the details of language rules.
11.10Types of protocols discussed in this chapter
11.11NOISELESS CHANNELSNOISELESS CHANNELSLet us first assume we have an ideal channel in whichLet us first assume we have an ideal channel in whichno frames are lost, duplicated, or corrupted. Weno frames are lost, duplicated, or corrupted. Weintroduce two protocols for this type of channel.introduce two protocols for this type of channel.
11.12The design of the simplest protocol with no flow or error control
11.13Sender-site algorithm for the simplest protocol1. Procedure an infinite loop.2. 3-9 repeated forever.3. Event driven.4. Unspecified time between 3 & 4.5. 6-8 on event.
11.14Receiver-site algorithm for the simplest protocol6-8 on event.
11.15Figure shows an example of communication using thisprotocol. It is very simple. The sender sends a sequence offrames without even thinking about the receiver. To sendthree frames, three events occur at the sender site andthree events at the receiver site. Note that the data framesare shown by tilted boxes; the height of the box definesthe transmission time difference between the first bit andthe last bit in the frame.Example
11.16Flow diagram for ExampleAssumption in simplest protocol ?Besides the ideal channel, receiver also ideal, ie., canimmediately process all transmitted frames.
11.17Design of Stop-and-Wait Protocol – to prevent overflow at receiver, ie. flow control.
11.18Algorithm Sender-site algorithm for Stop-and-Wait Protocol2 Events driven
11.19Algorithm Receiver-site algorithm for Stop-and-Wait Protocol6-9 on Event
11.20Figure shows an example of communication using thisprotocol. It is still very simple. The sender sends oneframe and waits for feedback from the receiver. When theACK arrives, the sender sends the next frame. Note thatsending two frames in the protocol involves the sender infour events and the receiver in two events.Example
11.21Flow diagram for Exampleie. Flow control has been added to the Simpest protocol.
11.22NOISY CHANNELSNOISY CHANNELSAlthough the Stop-and-Wait Protocol gives us an ideaAlthough the Stop-and-Wait Protocol gives us an ideaof how to add flow control to its predecessor, noiselessof how to add flow control to its predecessor, noiselesschannels are nonexistent. We discuss three protocolschannels are nonexistent. We discuss three protocolsfor noiseless channels that use flow and error control.for noiseless channels that use flow and error control.• Stop-and-Wait Automatic Repeat Request• Go-Back-N Automatic Repeat Request• Selective Repeat Automatic Repeat Request
11.23Error correction in Stop-and-Wait ARQis done by keeping a copy of the sentframe and retransmission of the framewhen the timer expires.Note
11.24Sequence Numbers of FramesSequence Numbers of Frames
11.25In Stop-and-Wait ARQ, we use sequencenumbers to number the frames.The sequence numbers are based onmodulo-2 arithmetic, ie. The sequence is0, 1, 0, 1, 0, 1 … .Note
11.26In Stop-and-Wait ARQ, theacknowledgment number alwaysannounces in modulo-2 arithmetic thesequence number of the next frameexpected.Note
11.28Algorithm Sender-site algorithm for Stop-and-Wait ARQ(continued)
11.29Algorithm Sender-site algorithm for Stop-and-Wait ARQ (continued)
11.30Algorithm Receiver-site algorithm for Stop-and-Wait ARQ Protocol
11.31Figure shows an example of Stop-and-Wait ARQ.Frame 0 is sent and acknowledged. Frame 1 is lost andresent after the time-out. The resent frame 1 isacknowledged and the timer stops. Frame 0 is sent andacknowledged, but the acknowledgment is lost. Thesender has no idea if the frame or the acknowledgmentis lost, so after the time-out, it resends frame 0, which isacknowledged.Example
11.33Assume that, in a Stop-and-Wait ARQ system, thebandwidth of the line is 1 Mbps, and 1 bit takes 20 ms tomake a round trip. What is the bandwidth-delay product?If the system data frames are 1000 bits in length, what isthe utilization percentage of the link?SolutionThe bandwidth-delay product isExampleThe bandwidth-delay product definesthe number of bits that can fill the link.
11.34The system can send 20,000 bits during the time it takesfor the data to go from the sender to the receiver and thenback again. However, the system sends only 1000 bits. Wecan say that the link utilization is only 1000/20,000, or 5percent. For this reason, for a link with a high bandwidthor long delay, the use of Stop-and-Wait ARQ wastes thecapacity of the link.Example (continued)
11.35What is the utilization percentage of the link inprevious Example if we have a protocol that can sendup to 15 frames before stopping and worrying aboutthe acknowledgments?SolutionThe bandwidth-delay product is still 20,000 bits. Thesystem can send up to 15 frames or 15,000 bits during around trip. This means the utilization is 15,000/20,000, or75 percent. Of course, if there are damaged frames, theutilization percentage is much less because frames haveto be resent.Example
11.37In the Go-Back-N Protocol, the sequencenumbers are modulo 2m, where m is the size ofthe sequence number field in bits, ie. for a 4bit field, the sequence numbers can be 0 to 15inclusive. The sequence can then be repeated.Note
11.38The send window is an abstract conceptdefining an imaginary box of size 2m− 1with three variables: Sf, Sn, and Ssize.Note
11.40The send window can slide oneor more slots when a validacknowledgment arrives.Note
11.41The receive window is an abstractconcept defining an imaginary boxof size 1 with one single variable Rn.The window slideswhen a correct frame has arrived;sliding occurs one slot at a time.Note
11.50ExampleFigure shows an example of Go-Back-N. This is anexample of a case where the forward channel is reliable,but the reverse is not. No data frames are lost, but someACKs are delayed and one is lost. The example alsoshows how cumulative acknowledgments can help ifacknowledgments are delayed or lost. After initialization,there are seven sender events. Request events aretriggered by data from the network layer; arrival eventsare triggered by acknowledgments from the physicallayer. There is no time-out event here because alloutstanding frames are acknowledged before the timerexpires. Note that although ACK 2 is lost, ACK 3 servesas both ACK 2 and ACK 3. There are four receiver events.
11.52Figure shows what happens when a frame is lost. Frames0, 1, 2, and 3 are sent. However, frame 1 is lost. Thereceiver receives frames 2 and 3, but they are discardedbecause they are received out of order. The senderreceives no acknowledgment about frames 1, 2, or 3. Itstimer finally expires. The sender sends all outstandingframes (1, 2, and 3) because it does not know what iswrong. Note that the resending of frames 1, 2, and 3 is theresponse to one single event. When the sender isresponding to this event, it cannot accept the triggering ofother events. This means that when ACK 2 arrives, thesender is still busy with sending frame 3.Example
11.53The physical layer must wait until this event is completedand the data link layer goes back to its sleeping state. Wehave shown a vertical line to indicate the delay. It is thesame story with ACK 3; but when ACK 3 arrives, thesender is busy responding to ACK 2. It happens againwhen ACK 4 arrives. Note that before the second timerexpires, all outstanding frames have been sent and thetimer is stopped.Example (continued)