lecture 3 logical link layer
DESCRIPTION
Flow Control & Error ControlTRANSCRIPT
![Page 1: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/1.jpg)
Logical Link Layer
Prof. Hemang KothariAssistant Professor
Computer Engineering Department MEFGI, Rajkot.
Email: [email protected] Share: http://www.slideshare.net/hemangkothari
![Page 2: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/2.jpg)
Function Provided By Logical Link Layer
• Provide service interface to the network layer• Dealing with transmission errors• Regulating data flow– Slow receivers not swamped by fast senders
![Page 3: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/3.jpg)
Content
• Design Issue1. Framing. 2. Error control.3. Flow control.4. Error detection and correction.
• Elementary data link protocols: Simplex, Stop and Wait, Sliding window protocol, HDLC.
![Page 4: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/4.jpg)
Framing Methods
• Character Count.
• Starting & Ending Bytes (FLAG) With Byte Stuffing.
• Starting & Ending Bit Pattern (Flag) With Bit Stuffing.
![Page 5: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/5.jpg)
Character Count - Framing
• This method specifies the number of characters that are present in particular frame.
• This information is specified by using a special field in the header frame.
![Page 6: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/6.jpg)
A character stream. (a) Without errors. (b) With one error.
![Page 7: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/7.jpg)
Byte Stuffing – Framing
(a) A frame delimited by flag bytes.(b) Four examples of byte sequences before and after stuffing.
![Page 8: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/8.jpg)
Bit Stuffing
Bit stuffing(a) The original data.(b) The data as they appear on the line.(c) The data as they are stored in receiver’s memory after de-stuffing.
![Page 9: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/9.jpg)
Review
• In a data link protocol, the frame delimiter flag is given by 0111. Assuming that bit stuffing is employed, the transmitter sends the data sequence 01110110 as (A) 01101011(B) 011010110(C) 011101100(D) 0110101100
![Page 10: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/10.jpg)
Review
• The following data fragment occurs in the middle of a data stream for which the bytestuffing algorithm described in the text is used: A B ESC C ESC FLAG FLAG D. What is the output after stuffing?
• Answer : A B ESC ESC C ESC ESC ESC FLAG ESC FLAG D
![Page 11: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/11.jpg)
Review
• A bit string, 0111101111101111110, needs to be transmitted at the data link layer. What is the string actually transmitted after bit stuffing?
• Answer: The output is 011110111110011111010.
![Page 12: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/12.jpg)
Flow Control & Error Control
![Page 13: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/13.jpg)
Flow Control
• Flow control coordinates the amount of data that can be sent before receiving acknowledgement
• Flow control is a set of procedures that tells the sender how much data it can transmit before it must wait for an acknowledgement from the receiver.
• Receiver has a limited speed at which it can process incoming data and a limited amount of memory in which to store incoming data.
![Page 14: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/14.jpg)
Flow Control
• Receiver must inform the sender before the limits are reached and request that the transmitter to send fewer frames or stop temporarily.
• Since the rate of processing is often slower than the rate of transmission, receiver has a block of memory (buffer) for storing incoming data until they are processed.
Feedback is the breakfast of champions – Ken Blanchard
![Page 15: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/15.jpg)
Error Control
• Error control includes both error detection – correction and notification about error.
• It allows the receiver to inform the sender if a frame is lost or damaged during transmission and coordinates the retransmission of those frames by the sender.
• Error control in the data link layer is based on automatic repeat request (ARQ). Whenever an error is detected, specified frames are retransmitted.
![Page 16: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/16.jpg)
Error and Flow Control Mechanisms
• Stop-and-Wait
• Go-Back-N ARQ
• Selective-Repeat ARQ
![Page 17: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/17.jpg)
Stop and Wait • Sender keeps a copy of the last frame until it receives an acknowledgement.
• For identification, both data frames and acknowledgements (ACK) frames are numbered alternatively 0 and 1.
• Sender has a control variable (S) that holds the number of the recently sent frame. (0 or 1)
• Receiver has a control variable (R) that holds the number of the next frame expected (0 or 1).
• Sender starts a timer when it sends a frame. If an ACK is not received within a allocated time period, the sender assumes that the frame was lost or damaged and resends it
• Receiver send only positive ACK if the frame is intact.
• ACK number always defines the number of the next expected frame.
![Page 18: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/18.jpg)
Stop-and-Wait ARQ, Corrupt frame
• When a receiver receives a damaged frame, it discards it and keeps its value of R.
• After the timer at the sender expires, another copy of frame 1 is sent.
![Page 19: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/19.jpg)
Stop-and-Wait, lost ACK frame
• If the sender receives a damaged ACK, it discards it.
• When the timer of the sender expires, the sender retransmits frame 1.
• Receiver has already received frame 1 and expecting to receive frame 0 (R=0). Therefore it discards the second copy of frame 1.
![Page 20: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/20.jpg)
Stop-and-Wait, delayed ACK frame
• The ACK can be delayed at the receiver or due to some problem
• It is received after the timer for frame 0 has expired.
• Sender retransmitted a copy of frame 0. However, R =1 means receiver expects to see frame 1. Receiver discards the duplicate frame 0.
• Sender receives 2 ACKs, it discards the second ACK.
![Page 21: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/21.jpg)
Disadvantage of Stop-and-Wait
• In stop-and-wait, at any point in time, there is only one frame that is sent and waiting to be acknowledged.
• This is not a good use of transmission medium.• To improve efficiency, multiple frames should be in transition
while waiting for ACK.• Two protocol use the above concept,– Go-Back-N ARQ– Selective Repeat ARQ
![Page 22: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/22.jpg)
Mathematical Review of Stop & Wait
• The Stop and Wait protocol is executed on a 10km wire between your modem and your ISPs edge router. The propagation speed of an electrical signal on the wire is 200,000 km/sec. The packet size is 1000 bytes. The time to generate an acknowledgement by the receiver is 4 microseconds. The channel capacity is 100 Mbps (Mbps = megabit per second).
a) What is the propagation delay on the wire?b) What is the packet transmission delay? c) What is the maximum efficiency of the protocol (i.e., what maximum
percentage of time is your modem actually sending data)?
![Page 23: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/23.jpg)
Mathematical Review of Stop & Wait
• What is the propagation delay on the wire?
• Answer: 50 microseconds, or 0.00005 seconds – Propagation delay is equal to the distance that the data must travel, divided by the speed that data travels on the wire, which in this case turns out to be 10 km / 200000 km/sec.
![Page 24: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/24.jpg)
Mathematical Review of Stop & Wait
• What is the packet transmission delay?
• Answer: 80 microseconds, or 0.00008 seconds – Transmission delay is equal to the packet size divided by the channel capacity, which in this case turns out to be (1000 * 8) / 100,000,000. A common mistake was to forget to multiply the packet size by 8 because it is in bytes not bits, and also that 100 Mbps is equivalent to 100,000,000 bits per second.
![Page 25: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/25.jpg)
Mathematical Review of Stop & Wait
• What is the maximum efficiency of the protocol (i.e., what maximum percentage of time is your modem actually sending data)?
• Answer: 43.48% - The time that the modem is actually sending data is equivalent to the packet transmission delay. The total time consists of the transmission delay at the modem plus the propagation delay to get to the receiver plus the time it takes to create an acknowledgement plus the propagation delay to get back to the sender.
• so we are left with the equation T / (T + 2P + Ack) = (0.00008) / (0.00008 + 2 * 0.00005 + 0.000004).
![Page 26: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/26.jpg)
Sliding Window Protocols
![Page 27: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/27.jpg)
Sliding Window
Sender• Maintain sequence number of frames it is permitted to send -
Sending window
Receiver• Maintain sequence number of frames it is expected to accept -
Receiver window
Sliding window protocol allow us to send multiple packets together
![Page 28: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/28.jpg)
Go Back ARQ
• We can send up to W frames before worrying about ACKs.• We keep a copy of these frames until the ACKs arrive.• This procedure requires additional features to be added to Stop-
and-Wait ARQ. – Frames from a sender are numbered sequentially.– We need to set a limit since we need to include the sequence number of
each frame in the header.– If the header of the frame allows m bits for sequence number, the
sequence numbers range from 0 to 2 m – 1. for m = 3, sequence numbers are: 0,1, 2, 3, 4, 5, 6, 7.
![Page 29: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/29.jpg)
Sender Sliding Window – Go Back ARQ
• At the sending side, to hold the outstanding frames until they are acknowledged, we use the concept of a window.
• The size of the window is at most 2m -1 where m is the number of bits for the sequence number.
• The window slides to include new unsent frames when the correct ACKs are received
![Page 30: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/30.jpg)
Receiver Sliding Window – Go Back ARQ
• Size of the window at the receiving site is always 1 in this protocol.• Receiver is always looking for a specific frame to arrive in a specific
order.• Any frame arriving out of order is discarded and needs to be resent.
Receiver is waiting for frame 0 in part a.
![Page 31: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/31.jpg)
Acknowledgement• Receiver sends positive ACK if a frame arrived safe and in order. • If the frames are damaged/out of order, receiver is silent and discard all
subsequent frames until it receives the one it is expecting.• The silence of the receiver causes the timer of the unacknowledged frame to
expire.• Then the sender resends all frames, beginning with the one with the expired
timer.• For example, suppose the sender has sent frame 6, but the timer for frame 3
expires (i.e. frame 3 has not been acknowledged), then the sender goes back and sends frames 3, 4, 5, 6 again. Thus it is called Go-Back-N-ARQ
• The receiver does not have to acknowledge each frame received, it can send one cumulative ACK for several frames.
![Page 32: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/32.jpg)
Go-Back-N ARQ, normal operation
• The sender keeps track of the outstanding frames and updates the variables and windows as the ACKs arrive.
![Page 33: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/33.jpg)
Go-Back-N ARQ, lost frame• Frame 2 is lost• When the receiver
receives frame 3, it discards frame 3 as it is expecting frame 2 (according to window).
• After the timer for frame 2 expires at the sender site, the sender sends frame 2 and 3. (go back to 2)
![Page 34: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/34.jpg)
Go-Back-N ARQ, damaged/lost/delayed ACK
• If an ACK is damaged/lost, we can have two situations:• If the next ACK arrives before the expiration of any timer, there is no
need for retransmission of frames because ACKs are cumulative in this protocol.
• If ACK1, ACK2, and ACk3 are lost, ACK4 covers them if it arrives before the timer expires.
• If ACK4 arrives after time-out, the last frame and all the frames after that are resent.
• Receiver never resends an ACK (i.e. no timer is maintain for ACK) .• A delayed ACK also triggers the resending of frames.
![Page 35: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/35.jpg)
Go-Back-N ARQ, sender window size
• Size of the sender window must be less than 2 m. Size of the receiver is always 1. If m = 2, window size = 2 m – 1 = 3.
• Fig compares a window size of 3 and 4.
Accepts as the 1st frame in the next cycle-an error
![Page 36: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/36.jpg)
Selective Repeat ARQ
![Page 37: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/37.jpg)
Selective Repeat ARQ, lost frame • Frames 0 and 1 are accepted when received because they are in the range specified by the receiver window. Same for frame 3.
• Receiver sends a NAK2 to show that frame 2 has not been received and then sender resends only frame 2 and it is accepted as it is in the range of the window.
![Page 38: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/38.jpg)
In Selective Repeat ARQ, the size of the sender and receiver window must be at most one-half of 2m.
![Page 39: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/39.jpg)
Selective Repeat ARQ, sender window size• Size of the sender and receiver windows must be at most one-half of 2 m. If m = 2, window size should be
2 m /2 = 2. Fig compares a window size of 2 with a window size of 3. Window size is 3 and all ACKs are lost, sender sends duplicate of frame 0, window of the receiver expect to receive frame 0 (part of the window), so accepts frame 0, as the 1st frame of the next cycle – an error.
![Page 40: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/40.jpg)
Review
• Frames of 1000 bits are sent over a 1 Mbps satellite channel - propagation delay of 270 msec. Acknowledgements are always piggybacked onto data frames.. Headers are very short. Three bit sequence numbers are used. What is the maximum achievable channel utilization in frames per sec for (a) stop-and-wait protocol (b) protocol with go-back-n (c) protocol with selective-repeat ?
![Page 41: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/41.jpg)
Piggybacking
![Page 42: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/42.jpg)
Solution
• Let t = 0 denote the start of transmission. At t = 1 msec, the first frame has been fully transmitted. At t = 271 msec, the first frame has fully arrived.
• At t = 272 msec, the frame acknowledging the first one has been fully sent.
• At t = 542 msec, the acknowledgement-bearing frame has fully arrived.
• Thus, the cycle is 542 msec. A total of k frames are sent in 542 msec, for an efficiency of k/542.
![Page 43: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/43.jpg)
Approx Solution
(a) k = 1, efficiency = 1/542 = 0.18%
(b) k = 7, efficiency = 7/542 = 1.29%
(c) k = 4, efficiency = 4/542 = 0.74%
![Page 44: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/44.jpg)
Precise Solution
A. Channel utilization is 1 frame in 542 msec = 1.85 frames per sec
B. Pipeline 7 frames (3 bit seq number) with roundtrip of 548 msec giving channel utilization 7/548 = 12.77 frames per sec
C. pipeline 4 frames ( window size is sequence-size /2 ) in 545 msec giving channel utilization 4/545 = 7.34 frames per sec
![Page 45: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/45.jpg)
Error Detection & Correction
![Page 46: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/46.jpg)
Motivation
• Networks must be able to transfer data from one device to another with complete accuracy.
• Data can be corrupted during transmission.• For reliable communication, errors must be detected and
corrected
![Page 47: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/47.jpg)
Types of Error
![Page 48: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/48.jpg)
Single Bit Error
Multiple Bits Error
![Page 49: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/49.jpg)
Observation
• Single bit errors are the least likely type of errors in serial data transmission because the noise must have a very short duration which is very rare. However this kind of errors can happen in parallel transmission.
Example:• If data is sent at 1Mbps then each bit lasts only 1/1,000,000 sec.
or 1 μs.• For a single-bit error to occur, the noise must have a duration of
only 1 μs, which is very rare.
![Page 50: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/50.jpg)
Burst Error
![Page 51: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/51.jpg)
Observation
• Burst error is most likely to happen in serial transmission since the duration of noise is normally longer than the duration of a bit.
• The number of bits affected depends on the data rate and duration of noise.
Example:• If data is sent at rate = 1Kbps then a noise of 1/100 sec can affect
10 bits.(1/100*1000)• If same data is sent at rate = 1Mbps then a noise of 1/100 sec can
affect 10,000 bits.(1/100*106)
![Page 52: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/52.jpg)
Error Detection
• Error detection means to decide whether the received data is correct or not without having a copy of the original message.
• Error detection uses the concept of redundancy, which means adding extra bits for detecting errors at the destination.
To detect error you require some extra knowledge
![Page 53: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/53.jpg)
Redundancy
![Page 54: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/54.jpg)
Error Detection Schemes
• Single Parity Check• Two-Dimensional Parity Check• Cyclic Redundancy Check• Check Sum
![Page 55: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/55.jpg)
Single Parity Check - VRC
![Page 56: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/56.jpg)
Even Parity
• Add a parity bit to 7 bits of data to make an even number of 1’s
• 0110100
• 1011010
• How many bits of error can be detected by a parity bit?• What’s the overhead?
![Page 57: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/57.jpg)
Performance
• It can detect single bit error• It can detect burst errors only if the total number of
errors is odd.
![Page 58: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/58.jpg)
Two Dimension Parity Check
• Add one extra bit to a 7-bit code such that the number of 1’s in the resulting 8 bits is even (for even parity, and odd for odd parity)• Add a parity byte for the packet• Example: five 7-bit character packet,
even parity
0110100
1011010
0010110
1110101
1001011
![Page 59: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/59.jpg)
Two Dimension Parity Check
0110100 1
1011010 0
0010110 1
1110101 1
1001011 0
![Page 60: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/60.jpg)
Two Dimension Parity Check – Parity Byte
0110100 1
1011010 0
0010110 1
1110101 1
1001011 0___________________
1000110 1
![Page 61: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/61.jpg)
All 1 Bit Error Will Be Detected
![Page 62: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/62.jpg)
All 2 bit Error will be detected
![Page 63: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/63.jpg)
Exceptional Case – Error Undetected
0110100 1
1011010 0
0000111 1
1100100 1
1001011 0___________________
1000110 1
0110100 1
1011010 0
0010110 1
1110101 1
1001011 0___________________
1000110 1
![Page 64: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/64.jpg)
Performance Summary
• If two bits in one data units are damaged and two bits in exactly the same positions in another data unit are also damaged, the 2-D checker will not detect an error.
• It can detect multiple bit and burst errors.
![Page 65: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/65.jpg)
Review
• Assuming even parity, find the parity bit for each of the following data units.
a. 1001011b. 0001100 c. 1000000 d. 1110111
![Page 66: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/66.jpg)
Review
• Suppose the information content of a packet is the bit pattern 1110 1011 1001 1101 and an even parity scheme is being used. What would the value of the field containing the parity bits for the case of a two-dimensional parity scheme? (Hint: the input data should be represented by 4X4 2D array)
![Page 67: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/67.jpg)
Cyclic Redundancy Check
![Page 68: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/68.jpg)
Cyclic Redundancy Check
• Given a k-bit frame or message, the transmitter generates an n-bit sequence, known as a frame check sequence (FCS), so that the resulting frame, consisting of (k+n) bits, is exactly divisible by some predetermined number.
• The receiver then divides the incoming frame by the same number and, if there is no remainder, assumes that there was no error.
![Page 69: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/69.jpg)
![Page 70: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/70.jpg)
With & Without Error
![Page 71: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/71.jpg)
Review - CRC
• Consider the following message M=1010001101. The CRC for this message using the divisor polynomial x5 + x4 + x2 + 1 is
A. 01110B. 01011C. 10101D. 10110
![Page 72: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/72.jpg)
Example of Polynomial to Binary Form
![Page 73: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/73.jpg)
Review - CRC
GTU – 2012 / May• Show the calculation polynomial code checksum for a frame
1101011011 using the generator x4 + x + 1
![Page 74: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/74.jpg)
Check Sum
![Page 75: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/75.jpg)
Check Sum
![Page 76: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/76.jpg)
At Sender - Checksum
• The unit is divided into k sections, each of n bits.• All sections are added together using one’s
complement to get the sum.• The sum is complemented and becomes the
checksum.• The checksum is sent with the data
![Page 77: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/77.jpg)
At Receiver - Checksum
• The unit is divided into k sections, each of n bits.• All sections are added together using one’s
complement to get the sum.• The sum is complemented.• If the result is zero, the data are accepted:
otherwise, they are rejected.
![Page 78: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/78.jpg)
Internet Checksum Example
• Note
– When adding numbers, a carryout from the most significant bit needs to be added to the result
• Example: add two 16-bit integers
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 01 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 01 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Wraparound
SumChecksum
![Page 79: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/79.jpg)
Review
• You are using the IP (Internet Protocol) Checksum for Error Detection. Only, you do it based on 8 bit words, not 16 bits as in the real Internet. You must send the message 0011 1100 1010 0101 1001.
• Show what sender does to create the checksum. • Show what receiver does to verify no error occurs.
![Page 80: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/80.jpg)
Answer – Sender Work
1. Add zeros to get an integer number times 8 bits: 0011 1100 1010 0101 1001 0000
2. Add the three 8-bit ``words'' using one's complement: gives 0111 0010 .
3. Take one's complement: 1000 1101 . That is the checksum.
![Page 81: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/81.jpg)
Answer – Receiver Work
• The destination adds the four words 1000 1101 0011 1100 1010 0101 1001 0000
• Using (one's compl) and checks that the result is 1111 1111 and complement it gives 0000 0000. i.e. No Error
![Page 82: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/82.jpg)
Error Correction
![Page 83: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/83.jpg)
Types of Error Correction
• One is when an error is discovered; the receiver can have the sender retransmit the entire data unit. This is known as backward error correction.
• In the other, receiver can use an error-correcting code, which automatically corrects certain errors. This is known as forward error correction.
![Page 84: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/84.jpg)
Error Correction Concept
• For correcting an error one has to know the exact position of error, i.e. exactly which bit is in error (to locate the invalid bits).
• For example, to correct a single-bit error in an ASCII character, the error correction must determine which one of the seven bits is in error. To do this, we have to add some additional redundant bits.
• To calculate the numbers of redundant bits (r) required to correct d data bits. We use this relation 2r >= d + r + 1
![Page 85: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/85.jpg)
Hamming Code Based - Error Correction
![Page 86: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/86.jpg)
Redundant Bit Calculation
![Page 87: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/87.jpg)
Redundant Bit Calculation
![Page 88: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/88.jpg)
Example of Hamming Code Correction
![Page 89: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/89.jpg)
Single Bit Error Occurred
![Page 90: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/90.jpg)
Error Detection & Correction
![Page 91: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/91.jpg)
Review
• Let us consider an example for 7-bit data. Assume that during transmission bit 5 has been changed from 1 to 0 as shown in Figure. Find redundant bit and correct error.
![Page 92: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/92.jpg)
Review
• Sixteen-bit messages are transmitted using a Hamming code. How many check bits are needed to ensure that the receiver can detect and correct single-bit errors?
• Show the bit pattern transmitted for the message • Assume that even parity is used in the Hamming code.
![Page 93: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/93.jpg)
Answer
• Parity bits are needed at positions 1, 2, 4, 8, and 16, so messages that do not extend beyond bit 31 (including the parity bits) fit. Thus, 5 parity bits are sufficient.
• The bit pattern transmitted is 011010110011001110101.
![Page 94: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/94.jpg)
Extra Topics
![Page 95: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/95.jpg)
High Level Data Link Control Protocol
![Page 96: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/96.jpg)
HDLC Basic
• HDLC is a bit-oriented protocol.• It specifies a packitization standard for serial links. • It has been so widely implemented because it supports both half-
duplex and full-duplex communication lines, point-to-point (peer to peer) and multi-point networks, and switched or non-switched channels.
• HDLC supports several modes of operation, including a simple sliding-window mode for reliable delivery. Since Internet provides retransmission at higher levels (i.e., TCP), most Internet applications use HDLC's unreliable delivery mode.
![Page 97: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/97.jpg)
HDLC Stations and Configurations
• Primary & Secondary Station: Primary has the responsibility of controlling all other stations on the link (usually secondary stations).
• A primary issues commands and secondary issues responses. Despite this important aspect of being on the link, the primary station is also responsible for the organization of data flow on the link.
• The secondary station is under the control of the primary station. It has no ability, or direct responsibility for controlling the link. It is only activated when requested by the primary station.
• A combined station is a combination of a primary and secondary station.
![Page 98: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/98.jpg)
HDLC Configuration
• HDLC also defines three types of configurations for the three types of stations. The word configuration refers to the relationship between the hardware devices on a link.
• Following are the three configurations defined by HDLC: – Unbalanced Configuration – Balanced Configuration – Symmetrical Configuration
![Page 99: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/99.jpg)
![Page 100: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/100.jpg)
![Page 101: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/101.jpg)
HDLC Operation Modes
• A mode in HDLC is the relationship between two devices involved in an exchange; the mode describes who controls the link. HDLC offers three different modes of operation. These three modes of operations are: –Normal Response Mode (NRM) –Asynchronous Response Mode (ARM) –Asynchronous Balanced Mode (ABM)
![Page 102: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/102.jpg)
Summary of Modes
![Page 103: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/103.jpg)
HDLC Frames Types – I frame
• The function of the information command and response frame is to transfer sequentially numbered frames, each containing an information field, across the data link.
![Page 104: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/104.jpg)
HDLC Frames Types – S frame
• Supervisory (S) commands and responses frames are used to perform numbered supervisory functions such as acknowledgment, polling, temporary suspension of information transfer, or error recovery. Frames with the S format control field cannot contain an information field.
![Page 105: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/105.jpg)
HDLC Frames Types – U frame
• The unnumbered format commands and responses frames are used to extend the number of data link control functions. The unnumbered format frames have 5 modifier bits, which allow for up to 32 additional commands and 32 additional response functions.
![Page 106: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/106.jpg)
Control Field of Frame
![Page 107: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/107.jpg)
Code Field in Control Part
![Page 108: Lecture 3 logical link layer](https://reader033.vdocuments.net/reader033/viewer/2022061210/54909df0b479594f368b4681/html5/thumbnails/108.jpg)
Thank You