1 / 35

Layer 2 Data Link Layer

Is responsible for Framing Addressing Flow and Error Control Media access control. Layer 2 Data Link Layer. Unit 2: DATA LINK CONTROL. Overview. Framing Flow and Error Control Protocols Noiseless Channels Simplest Protocol Stop and Wait Noisy Channels

linda-pratt
Download Presentation

Layer 2 Data Link Layer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Is responsible for • Framing • Addressing • Flow and Error Control • Media access control Layer 2 Data Link Layer

  2. Unit 2: DATA LINK CONTROL Overview • Framing • Flow and Error Control Protocols • Noiseless Channels • Simplest Protocol • Stop and Wait • Noisy Channels • Stop-and-Wait Automatic Repeat Request (ARQ) • Go-back-N Automatic Repeat Request, • Selective repeat Automatic Repeat Request • HDLC (High-level Data Link Control)

  3. Data Link Layer

  4. Data Link Layer • Main functions of the data link layer are data link control and media access control. • Provides a well-defined service interface to the network layer. • Determines how the bits of the physical layer are grouped into frames (framing). • Deals with transmission errors (CRC and ARQ). • Regulates the flow of frames. • Performs general link layer management.

  5. FRAMING The data link layer needs to pack bits into frames, so that each frame is distinguishable from another. Our postal system practices a type of framing. The simple act of inserting a letter into an envelope separates one piece of information from another; the envelope serves as the delimiter. • Frames are the packets of information at the Data Link Layer • Frames are logical delineations in data • helps flow and error control • Frames contain • Data • Source and Destination address information • Error detection or correction information

  6. FRAMING Frame Size • A frame could contain an entire data message but this is not efficient. • An error in a large frame could require retransmission, wasting time and bandwidth • Forward error correction is too difficult using large frames Frame Orientation • Character (8-bit/single byte) oriented protocol • Bit-oriented protocol

  7. FRAMING A frame in a character-oriented protocol • Frame begins and ends with a predefined 8-bit configuration. • Frames are delimited by flags. • The header normally carries the source address and the trailer which carries error detection or correction bits • To separate frame Flag is added at the beginning and end of the frame. • Byte stuffing is required to prevent misinterpretation of the flag pattern appearing in the data.

  8. Byte stuffing and unstuffing • Byte stuffing is the process of adding 1 extra byte whenever there is a flag or escape character in the text. • This byte is usually escape character (ESC)

  9. Byte stuffing and unstuffing DLE STX Transparent Data ETX DLE Before DLE STX A B DLE H W ETX DLE Stuffed DLE STX A B DLE DLE H W ETX DLE Unstuffed DLE STX A B DLE H W ETX DLE DLE-Data link Escape, STX-Start of Text, ETX- End of Text

  10. Bit Oriented Protocol A frame in a bit-oriented protocol • Data section is a sequence of bits. • The standard start and end flag consists of these 8 bits: 01111110 • Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data, so that the receiver does not mistake the pattern 01111110 for a flag.

  11. Bit stuffing and unstuffing

  12. Flow & Error Control Flow Control • Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment. • Flow control is the regulation of the sender’s data rate so that the receiver buffer does not become overwhelmed. Error Control • Error control is both error detection and error correction. • Error control in the data link layer is based on automatic repeat request, which is the retransmission of data.

  13. Protocols NOISELESS CHANNELS In these protocols it is assumed as an ideal channel in which no frames are lost, duplicated, or corrupted.

  14. Simplest Protocol The design of the simplest protocol with no flow or error control • 1 Event at transmitter and 1 event at receiver

  15. Simplest Protocol Sender-site algorithm for the simplest protocol Receiver-site algorithm for the simplest protocol

  16. Simplest Protocol Flow diagram • The sender sends a sequence of frames to the receiver. • To send three frames, three events occur at the sender site and three events at the receiver site. • Note that the data frames are shown by tilted boxes; the height of the box defines the transmission time difference between the first bit and the last bit in the frame.

  17. Stop-and-Wait Protocol • If frames are arrived at the receiver before processing, frames must be stored. • Normally receiver does not have sufficient storage space. • This may discard the next arrival frames. • To prevent this : • Source transmits single frame • Wait for ACK • If received frame damaged, discard it • If no ACK, retransmit • If ACK damaged, transmitter will not recognize it • Transmitter will retransmit • Receiver gets two copies of frame

  18. Stop-and-Wait Protocol Design of Stop-and-Wait Protocol • 2 Events at transmitter and 1 event at receiver

  19. Stop-and-Wait Protocol Sender-site algorithm for Stop-and-Wait Protocol

  20. Stop-and-Wait Protocol Receiver-site algorithm for Stop-and-Wait Protocol

  21. Stop-and-Wait Protocol Flow diagram • The sender sends one frame and waits for feedback from the receiver. • When the ACK arrives, the sender sends the next frame. • Sending two frames in the protocol involves the sender in four events and the receiver in two events.

  22. NOISY CHANNELS The Stop-and-Wait Protocol gives us an idea of how to add flow control to its predecessor, noiseless channels are nonexistent.

  23. Error Detection • Additional bits added by transmitter for error detection code • Parity • Value of parity bit is such that character has even (even parity) or odd (odd parity) number of ones • Even number of bit errors goes undetected Error Control • Detection and correction of errors • Lost frames • Damaged frames • Automatic repeat request • Error detection • Positive acknowledgment • Retransmission after timeout • Negative acknowledgement and retransmission

  24. Stop-and-Wait Automatic Repeat Request (ARQ) Protocol

  25. Stop-and-Wait Automatic Repeat Request (ARQ) Protocol • Stop-and-Wait ARQ adds a error control mechanism to Stop-and-Wait • Error correction is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires. • Sequence numbers are used to number the frames. • The sequence numbers are based on modulo-2 arithmetic. • The acknowledgment number always announces in modulo-2 arithmetic the sequence number of the next frame expected. • Sender keeps the copy of the last frame transmitted until it receives an ACK for that frame. • Data frame uses seq No; an ACK uses an ack No. • Sender has a control variable Sn that holds the sequence No for the next frame to be sent (0 or 1) • Receiver has a control variable Rn that holds the sequence number for the next frame to be expected (0 or 1)

  26. Stop-and-Wait ARQ Protocol • Sequence Numbering. • Protocol specifies that frames need to be numbered and process is called Sequence Numbering. • The sequence numbers are modulo 2m, where m is the size of the sequence number field in bits. • Sequence numbers start from 0 to 2m-1 and then repeated. • Protocol need only x and x+1 sequence number (not x+2) • x=0 and x+1=1 i.e., sequence is 0,1,0,1 (Modulo-2 arithmetic) • Acknowledgement Numbering. • Acknowledgement numbers always announce the sequence number of the next frame expected by the receiver • If frame 0 has arrived safe and sound, receiver sends an ACK frame with acknowledgement 1 (meaning frame 1 is expected next)

  27. OperationofStop-and-Wait ARQ • Normal Operation • Frame is lost • Acknowledgment is lost • Acknowledgment is delayed Normal Operation

  28. OperationofStop-and-Wait ARQ Frame is lost

  29. OperationofStop-and-Wait ARQ Lost ACK frame • In Stop-and-Wait ARQ, numbering frames prevents the retaining of duplicate frames.

  30. Stop-and-Wait ARQ, delayed ACK • The value of R at the receiver site is still 1, which means the receiver expects to see frame 1. • Numbered acknowledgments are needed if an acknowledgment is delayed and the next frame is lost.

  31. Stop-and-Wait ARQ Protocol • 3 Events at transmitter and 1 event at receiver

  32. Stop-and-Wait ARQ Protocol Sender-site algorithm for Stop-and-Wait ARQ

  33. Stop-and-Wait ARQ Protocol Sender-site algorithm for Stop-and-Wait ARQ

  34. Stop-and-Wait ARQ Protocol Receiver-site algorithm for Stop-and-Wait ARQ Protocol

  35. Stop-and-Wait ARQ Protocol Flow diagram Frame 0 is sent and acknowledged. Frame 1 is lost and resent after the time-out. The resent frame 1 is acknowledged and the timer stops. Frame 0 is sent and acknowledged, but the acknowledgment is lost. The sender has no idea if the frame or the acknowledgment is lost, so after the time-out, it resends frame 0, which is acknowledged.

More Related