3a data link layer

434
-1

Published on

all about data link layer in OSI model

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
434
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

3a data link layer

  1. 1. 9.1Data Link ControlNetworking Fundamentals
  2. 2. 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
  3. 3. 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.
  4. 4. 11.4lecture
  5. 5. 11.5A frame in a bit-oriented protocol
  6. 6. 11.6Bit stuffing is the process of adding oneextra 0 whenever five consecutive 1sfollow a 0 in the data, so that thereceiver does not mistakethe pattern 01111110 for a flag.Note
  7. 7. 11.7Bit stuffing and unstuffing
  8. 8. 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.
  9. 9. 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.
  10. 10. 11.10Types of protocols discussed in this chapter
  11. 11. 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.
  12. 12. 11.12The design of the simplest protocol with no flow or error control
  13. 13. 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.
  14. 14. 11.14Receiver-site algorithm for the simplest protocol6-8 on event.
  15. 15. 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
  16. 16. 11.16Flow diagram for ExampleAssumption in simplest protocol ?Besides the ideal channel, receiver also ideal, ie., canimmediately process all transmitted frames.
  17. 17. 11.17Design of Stop-and-Wait Protocol – to prevent overflow at receiver, ie. flow control.
  18. 18. 11.18Algorithm Sender-site algorithm for Stop-and-Wait Protocol2 Events driven
  19. 19. 11.19Algorithm Receiver-site algorithm for Stop-and-Wait Protocol6-9 on Event
  20. 20. 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
  21. 21. 11.21Flow diagram for Exampleie. Flow control has been added to the Simpest protocol.
  22. 22. 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
  23. 23. 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
  24. 24. 11.24Sequence Numbers of FramesSequence Numbers of Frames
  25. 25. 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
  26. 26. 11.26In Stop-and-Wait ARQ, theacknowledgment number alwaysannounces in modulo-2 arithmetic thesequence number of the next frameexpected.Note
  27. 27. 11.27Design of the Stop-and-Wait ARQ Protocol
  28. 28. 11.28Algorithm Sender-site algorithm for Stop-and-Wait ARQ(continued)
  29. 29. 11.29Algorithm Sender-site algorithm for Stop-and-Wait ARQ (continued)
  30. 30. 11.30Algorithm Receiver-site algorithm for Stop-and-Wait ARQ Protocol
  31. 31. 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
  32. 32. 11.32Flow diagram for Example
  33. 33. 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.
  34. 34. 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)
  35. 35. 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
  36. 36. 11.36
  37. 37. 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
  38. 38. 11.38The send window is an abstract conceptdefining an imaginary box of size 2m− 1with three variables: Sf, Sn, and Ssize.Note
  39. 39. 11.39Send sliding window for Go-Back-N ARQ
  40. 40. 11.40The send window can slide oneor more slots when a validacknowledgment arrives.Note
  41. 41. 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
  42. 42. 11.42Receive sliding window for Go-Back-N ARQ
  43. 43. 11.43
  44. 44. 11.44Design of Go-Back-N ARQ
  45. 45. 11.45Window size for Go-Back-N ARQ
  46. 46. 11.46In Go-Back-N ARQ, the size of the sendwindow must be less than 2m;the size of the receiver windowis always 1.Note
  47. 47. 11.47Algorithm Go-Back-N sender algorithm(continued)
  48. 48. 11.48Algorithm Go-Back-N sender algorithm (continued)
  49. 49. 11.49Algorithm Go-Back-N receiver algorithm
  50. 50. 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.
  51. 51. 11.51Flow diagram for Example
  52. 52. 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
  53. 53. 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)
  54. 54. 11.54Flow diagram for Example
  55. 55. 11.55Stop-and-Wait ARQ is a special case ofGo-Back-N ARQ in which the size of thesend window is 1.Note

×