Report on data link layer
Upcoming SlideShare
Loading in...5

Report on data link layer






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Report on data link layer Report on data link layer Document Transcript

  • DATA LINK LAYER TOPIC: Error control & Flow controlSubmitted to : Submitted by:Prof Manraj Singh Pattar Alisha Korpal Nancy Jain Nivea Jain Sharuti Jain 1|Page
  • INDEXS no Topic Page no 1 Introduction to data link layer 3 2 Services provided to network layer 4 3 Services 6 4 Framing 7 5 Error detection 8 6 Error correction 15 7 Flow control 16 8 Error control 19 9 References 24 2|Page
  • INTRODUCTIONData Link Layer Design IssuesThe data link layer has a number of specific functions it can carry out. These functionsinclude 1. Providing a well-defined service interface to the network layer. 2. Dealing with transmission errors. 3. Regulating the flow of data so that slow receivers are not swamped by fast senders.To accomplish these goals, the data link layer takes the packets it gets from the network layerand encapsulates them into frames for transmission. Each frame contains a frame header, apayload field for holding the packet, and a frame trailer. 3|Page
  • Services Provided to the Network LayerThe function of the data link layer is to provide services to the network layer. The principalservice is transferring data from the network layer on the source machine to the network layeron the destination machine. On the source machine is an entity, call it a process, in thenetwork layer that hands some bits to the data link layer for transmission to the destination.The job of the data link layer is to transmit the bits to the destination machine so they can behanded over to the network layer there. 1. Unacknowledged connectionless service. 2. Acknowledged connectionless service. 3. Acknowledged connection-oriented serviceUnacknowledged Connectionless ServiceUnacknowledged connectionless service consists of having the source machine sendindependent frames to the destination machine without having the destination machineacknowledge them. No logical connection is established beforehand or released afterward. If aframe is lost due to noise on the line, no attempt is made to detect the loss or recover from itin the data link layer. This class of service is appropriate when the error rate is very low sothat recovery is left to higher layers. It is also appropriate for real-time traffic, such as voice,in which late data are worse than bad data. Most LANs use unacknowledged connectionlessservice in the data link layer.Acknowledged Connectionless serviceWhen this service is offered, there are still no logical connections used, but each frame sent isindividually acknowledged. In this way, the sender knows whether a frame has arrivedcorrectly. If it has not arrived within a specified time interval, it can be sent again. Thisservice is useful over unreliable channels, such as wireless systems. 4|Page
  • Connection Oriented ServiceWith this service, the source and destination machines establish a connection before any dataare transferred. Each frame sent over the connection is numbered, and the data link layerguarantees that each frame sent is indeed received. Furthermore, it guarantees that each frameis received exactly once and that all frames are received in the right order. Withconnectionless service, in contrast, it is conceivable that a lost acknowledgement causes apacket to be sent several times and thus received several times. Connection-oriented service,in contrast, provides the network layer processes with the equivalent of a reliable bit stream. 5|Page
  • SERVICES 1. Framing 2. Error control 3. Flow control 4. Access Control 5. Physical Addressing 6|Page
  • FramingTo provide service to the network layer, the data link layer must use the service provided to itby the physical layer. What the physical layer does is accept a raw bit stream and attempt todeliver it to the destination. This bit stream is not guaranteed to be error free. The number ofbits received may be less than, equal to, or more than the number of bits transmitted, and theymay have different values. It is up to the data link layer to detect and, if necessary, correcterrors.The usual approach is for the data link layer to break the bit stream up into discrete framesand compute the checksum for each frame. (Checksum algorithms will be discussed later inthis chapter.) When a frame arrives at the destination, the checksum is recomputed. If thenewly-computed checksum is different from the one contained in the frame, the data linklayer knows that an error has occurred and takes steps to deal with it (e.g., discarding the badframe and possibly also sending back an error report).Breaking the bit stream up into frames is more difficult than it at first appears. One way toachieve this framing is to insert time gaps between frames, much like the spaces betweenwords in ordinary text. However, networks rarely make any guarantees about timing, so it ispossible these gaps might be squeezed out or other gaps might be inserted duringtransmission. Since it is too risky to count on timing to mark the start and end of each frame,other methods have been devised. In this section we will look at four methods: 1. Character count. 2. Flag bytes with byte stuffing. 3. Starting and ending flags, with bit stuffing. 4. Physical layer coding violations. 7|Page
  • Error ControlHaving solved the problem of marking the start and end of each frame, we come to the nextproblem: how to make sure all frames are eventually delivered to the network layer at thedestination and in the proper order. Suppose that the sender just kept outputting frameswithout regard to whether they were arriving properly. This might be fine forunacknowledged connectionless service, but would most certainly not be fine for reliable,connection-oriented service.The usual way to ensure reliable delivery is to provide the sender with some feedback aboutwhat is happening at the other end of the line. Typically, the protocol calls for the receiver tosend back special control frames bearing positive or negative acknowledgements about theincoming frames. If the sender receives a positive acknowledgement about a frame, it knowsthe frame has arrived safely. On the other hand, a negative acknowledgement means thatsomething has gone wrong, and the frame must be transmitted again.An additional complication comes from the possibility that hardware troubles may cause aframe to vanish completely (e.g., in a noise burst). In this case, the receiver will not react atall, since it has no reason to react. It should be clear that a protocol in which the sendertransmits a frame and then waits for an acknowledgement, positive or negative, will hangforever if a frame is ever lost due to, for example, malfunctioning hardware • Error Detection • Error Correction 8|Page
  • Error DetectionWhen data is being transmitted from one machine to another, it may possible that databecome corrupted on its way. Some of the bits may be altered, damaged or lost duringtransmission. Such a condition is known as error.The error may occur because of noise on line, attenuation and delay distortion. For reliablecommunication, it is important that errors are detected and corrected. Types of errors • Single bit error • Burst errorSingle bit errorIt means only one bit of data unit is changed from 1 to 0 or from 0 to 1. Single bit error canhappen in parallel transmission where all the data bits are transmitted using separate wires.Single bit error is least likely type of errors in serial transmission.Burst ErrorIt means two or more bits in data unit are changed from 1 to 0 or from 0 to 1. In burst error, itis not necessary that only consecutive bits are changed. The length of burst error is measuredfrom first changed bit to last changed bit. 9|Page
  • TechniquesError detection means inspecting the data so as to check whether or not data is changed duringthe transmission. An error detection system is needed at the receiver end that should check theincoming data and report the number and type’s errors that define have occurred. The mostcommon technique used for error detection is redundancy.Redundancy  Redundancy is the method in which some extra bits are added to the data so as to check whether the data contain error or not.  These redundant bits are added by the sender and removed by the receiver as soon as the accuracy of the transmission has been determined  These redundant bits are then added to the data and data + redundant bits are transmitted to the receiverTypes 1. Vertical Redundancy check/parity check 2. Longitudinal Redundancy check 3. Cyclic Redundancy check 4. Checksum 10 | P a g e
  • Vertical Redundancy Check/Parity CheckThis method is also known as parity check. In this method, a redundant bit called parity bit isadded to each data unit. This method may include even parity or odd parity. Even paritymeans that total number of 1are even. Odd parity means the total no of 1 are odd.ExampleIf source wants to transmit a data unit 1100111 using even parity to the destination. Thesource will first pass this unit to even parity generator.The parity generator will count the number of 1 in data and will add parity bit. In thisexample, since the number of 1 in data unit is five, the parity generator appends a parity bit 1to this data unit making the total number of 1 even. 1 1 0 0 1 1 1 Even Parity generator 1 (Counts 1 in data) 1 1 0 0 1 1 1 1  VRC can detect all single bit error  It can also detect burst error but only in those cases where number of bits changed is odd.  The major disadvantage of this method is that it is not able to detect burst error if the numbers of bits are even. 11 | P a g e
  • Longitudinal Redundancy Check  In this method block of bits is divided into table or matrix of rows and columns.  In order to detect the error, a redundant row of bits is added to the whole block and this block is transmitted to the receiver.  The receiver uses this redundant row to detect error. After checking the data for errors, receivers accept the data and discard the redundant row of bits. Sender data 11001010 10101010 11001100 11100011 11001010 10101010 11001100 11100011 01001111 11001010 10101010 11001100 11100011 01001111 Receiver data  When this data reaches the destination, receiver uses LRC to detect error in data.  LRC is used to detect burst errors. For e.g. suppose 32 bit data plus LRC that was being transmitted is hit by burst error of length five and some bits are corrupted. 12 | P a g e
  • Cyclic Redundancy Check  CRC is more powerful than VRC and LRC in detecting errors.  It is not based on binary addition like VRC and LRC. Rather it is based on binary division.  At the sender side, the data unit to be transmitted is divided by a predetermined divisor (binary number) in order t obtain the remainder. This remainder is called CRC.  The CRC has one bit less than the divisor. It means that if CRC is of n bits, divisor is of n+ 1 bit.  The sender appends this bit CRC to the end of data unit such that the resulting data unit becomes exactly divisible by predetermined divisor i.e. remainder become zero. 1011 1011 1001000 1011 0100 0000 1000 1011 0110 0000 110 13 | P a g e
  • Checksum  Checksum is the error detection method used by upper layer protocols and is considered to be more reliable than LRC, VRC & CRC.  This method makes use of checksum generator on the sender side &checksum checker on the receiver side.  At the sender side, checksum generator divides the data into equal subunits of n bit length. This length is generally of 16 bits.For example If the data unit to be transmitted is 10101001 00111001, the following procedure is used at the sender & receiver site. Sender site: 10101001 (subunit 1) 00111001 (subunit 2) 11100010 (sum using 1 compliment) 00011101 check sum (compliment of sum ) 10101001 00111001 00011101 DATA Checksum Receiver site: 10101001 subunit 1 00111001 subunit 2 00011101 checksum 11111111 sum 14 | P a g e 00000000 sum compliment
  • Error CorrectionError correction means rectifying all the bits that have been altered or changed during thetransmission of data. Error correction can be done as follows:  By retransmission of data from sender to receiver.  By the use of error correction code at the receiver side.Hamming CodeHamming code is a technique developed by R.W. hamming for error correction. This methodcorrects the error by finding the state at which the error has occurred. 15 | P a g e
  • Flow ControlAnother important design issue that occurs in the data link layer (and higher layers as well) iswhat to do with a sender that systematically wants to transmit frames faster than the receivercan accept them. This situation can easily occur when the sender is running on a fast (orlightly loaded) computer and the receiver is running on a slow (or heavily loaded) machine.The sender keeps pumping the frames out at a high rate until the receiver is completelyswamped. Even if the transmission is error free, at a certain point the receiver will simply beunable to handle the frames as they arrive and will start to lose some. Clearly, something hasto be done to prevent this situation.Two approaches are commonly used. In the first one, feedback-based flow control, thereceiver sends back information to the sender giving it permission to send more data or atleast telling the sender how the receiver is doing. In the second one, rate-based flow control,the protocol has a built-in mechanism that limits the rate at which senders may transmit data,without using feedback from the receiver. In this chapter we will study feedback-based flowcontrol schemes because rate-based schemes are never used in the data link layer.Methods  Stop and Wait  Sliding window 16 | P a g e
  • Stop and Wait  In this method of flow control, the sender sends a single frame to receiver and waits for an acknowledgment.  The next frame is send by sender only when acknowledgment of previous frame is received.  This process of sending a frame & waiting for an acknowledgment continues as long as sender has data to send.  To end up the transmission sender transmits EOT frame  The main advantage is its accuracy. Next frame is transmitted only when the acknowledged is received.  So no chance of frame being lost Receiver Sender DATA ACK DATA EOT 17 | P a g e
  • Sliding WindowIn sliding window method, multiple frames are sent by sender at a time before needing anacknowledgment. Multiple frames sent by source are acknowledged by receiver using a singleACK frame. Sliding window refers to an imaginary boxes that hold the frames on both senderand receiver side. It provides the upper limit on the number of frames that can be transmittedbefore requiring an acknowledgment. Frames may be acknowledged by receiver at any pointeven window is not full on receiver side. Frames may be transmitted by source even whenwindow is not yet full on sender side. 6 7 0 1 2 3 4 5 Window 18 | P a g e
  • Error ControlError control function of data link layer detects the error in transmitted frames and retransmitsall the erroneous frames. Therefore error control function of data link layer helps in dealingwith data frames that are damaged in transmit, data frame lost in transmit and theacknowledgment frame that are lost in transmission. The method is used for error control iscalled Automatic Repeat Request (ARQ).Automatic Repeat Request (ARQ)If an error is detected in any frame, the receiver sends a negative acknowledgement (NAK)back to source and the specific frame is retransmitted.ARQ techniques:  Stop and Wait ARQ  Sliding window ARQ  Go - back - n  Selective – reject 19 | P a g e
  • Stop and Wait  The sending device keeps a copy of the last frame transmitted until it receives an acknowledgment for that frame. Keeping this copy helps the sender in retransmission of lost or damaged frames later on.  Both data frames and ACK frames are numbered alternately 0 and 1 for identification purpose.  Criteria used by stop and wait ARQ method:  Damaged data frames  Lost data frames  Lost acknowledged frames 20 | P a g e
  • Damaged data framesIf a data frame received by a receiver contains an error, it returns NAK frame to thesender. On receiving NAK frame, sender retransmits the last data frame. 21 | P a g e
  • Lost data frames  Every sending device is equipped with timer.  The sender starts this timer when it transmits data frame.  If a data frame is lost on its way, it will not be received by receiver. As a result the receiver can never acknowledge it, positively or negatively.  The sending device waits for an ACK and NAK frame until timer goes of. 22 | P a g e
  • Lost acknowledgment frames  When any data frame reaches the destination, the receiver acknowledges it either with ACK or with NAK.  If ACK or NAK frame returned by the receiver is lost in transmit, sending device retransmit the data frame that has not been acknowledged 23 | P a g e
  • References  a=v& s/Ch3DataLink.ppt+data+link+layer+- +error+control&hl=en&gl=in&pid=bl&srcid=ADGEESh7iihVLjzfFbz0gre7MU026m n1tthMC-nrjVDOhmlFyqp- EpbPP18Dz7PJTOo3lto10Jrgl1nkhxfKGMHEko4l92TcpWhWdwZ6NWFLwcgt8vL1 Rflnm2flNelUYRNLV8E9V-H&sig=AHIEtbR0cwRF6qCblrz1ZzC5FkQnUHZegA  +error+control&hl=en&biw=1280&bih=869&prmd=ivns&ei=x5yqTduNEIXqrAfs2Zi oCA&start=10&sa=N  a=v& %2520Layer.ppt+data+link+layer+- +erroe+control&hl=en&gl=in&pid=bl&srcid=ADGEESjvzCW9EVWHSCgLuNEgYr LN8SnUvi-OQgDHzumZNNbPe-08mHhM4hLYqcxF960wte5mZHm1vae0- qOmWu71x0w7bOq8M4iogycqPZP23VkXGkvzE3lb5FJDHjBjJf5funeJkYit&sig=A HIEtbTruvMLqEm3DYW-JmR6GPILqmFx_g  a=v& w-control.pdf+data+link+layer+- +erroe+control&hl=en&gl=in&pid=bl&srcid=ADGEEShXOPBrrzZXuk9J4MVuSzC UNdgifCxHo6B7UQHf_g49Cl6wsZ2gdb0dO- MsM0hcZzEE62PlsGcupxyd5Mh7676xNqU7MxtrutxhVWykBIypsiEu9Q1E1BZ87x 8Kup4M5pyJkV-F&sig=AHIEtbQIRNWpmfHTwyXPybAvYx5rs3G7YA  a=v& yer+- +error+control&hl=en&gl=in&pid=bl&srcid=ADGEESglDES4xEYhroZ5oQpGK5A _dK7xynEbzeK23jLHPHyZj7W1KkOe_2ef_zUDjgG6v12ovMiaazeR9y9tikfCvRoE 24 | P a g e
  • KQWLbnHnmlIyaMQmT-oX-0r60nw-dk8hhac3xKoK_iRy12cv&sig=AHIEtbQScSEyKt6bSxqC_02VfzUXFYWRew 25 | P a g e