Error Detection Correction
Error Detection Correction
1. What are the basic functionalities a data link layer has to provide? (or Design Issues of DLL) [02]
i) Services to Upper layer: Providing a well-defined service interface to the network layer.
ii) Error Control: Dealing with transmission errors.
iii) Flow Control: Regulating the flow of data so that slow receivers are not swamped by fast senders.
(Framing is done for error control and flow control).
2. List various types of services the data link layer provides to network layer. Give appropriate examples. [03]
i) Unacknowledged Connectionless service: Used on reliable networks (like fiber optics) where error rate is low.
Appropriate for voice, where delay is worse than bad data.
ii) Acknowledged Connectionless service: Useful on unreliable medium like wireless. Acknowledged mails etc.
iii) Acknowledged Connection-Oriented service: Most reliable service. File Transfer etc.
3. List out all four Framing techniques. Explain Character Count Technique. [04]
i) Character count.
ii) Flag bytes with byte stuffing.
iii) Starting and ending flags, with bit stuffing.
iv) Physical layer coding violations.
Character Count:
This framing method uses a field in the header to specify the number of characters in the frame.
When the data link layer at the destination sees the character count, it knows how many characters follow and
hence where the end of the frame is.
This technique is shown in figure (a)
for four frames of sizes 5, 5, 8, and 8
characters, respectively.
Advantage: easiest method to be
applied.
Disadvantage: the count character
can be garbled by a transmission
error, resulting in receiver out of
synchronization with sender.
As shown in figure (b): count
character for second frame is
changed from 5 to 7 creates all
frames following it, out of
synchronization.
A major disadvantage of using Byte Stuffing framing method is that it is closely tied to the use of 8-bit
characters. Not all character codes use 8-bit characters. For example. UNICODE uses 16-bit characters.
As networks developed, the disadvantages of embedding the character code length in the framing mechanism
became more and more obvious, so a new technique had to be developed to allow arbitrary sized characters.
In new technique each frame begins and ends with a
special bit pattern, 01111110 (in fact, a flag byte).
Whenever the sender's data link layer encounters five
consecutive 1s in the data, it automatically stuffs a 0 bit
into the outgoing bit stream. This technique is called bit
stuffing.
It is analogous to byte stuffing, Just like FLAG here
frame starts and ends with flag byte 01111110. And
instead of an escape byte is stuffed into the outgoing
character stream before a flag byte in the data, here 0 is
stuffed after five consecutive 1s in into the outgoing
data stream, so that it guarantees that it does not
contain flag byte in between the frame.
When the receiver sees five consecutive incoming 1
bits, followed by a 0 bit, it automatically destuffs (i.e.,
deletes) the 0 bit. If the user data contain the flag
pattern, 01111110, this flag is transmitted as
011111010 but stored in the receiver's memory as 01111110.
6. How Encoding Violation Framing technique works? [02]
In encoding violation technique, a single bit is sent as some combination of signal pattern.
E.g. In Manchester encoding, for instance, 1-bits are represented by a high-low sequence and 0-bits by low-
high sequences. The start/end of a frame could be represented by the signal low-low or high-high.
The advantage of encoding violations is that no extra bandwidth is required as in bit or character stuffing. The
IEEE 802.4 standard uses this approach.
(ii) Burst Error: A burst error means that 2 or more bits in the data unit have changed.
Data #1's in data Parity Bit Codeword (data and P) Total # 1's (data and P)
110110 4 (Even) 0 1101100 4 (Even)
11111 5 (Odd) 1 111111 6 (Even)
1010100 3 (Odd) 1 10101001 4 (Even)
1111111 7 (Odd) 1 11111111 8 (Even)
When receiver receives a data unit, it checks for parity of word. If parity holds correct then it is
assumed to be correct transmission. Otherwise error is detected and retransmission should be done.
Advantages: With the minimum number of redundancy bit, this method detects error in data for odd
numbers of time. (i.e. if 1,3,5,7,… etc bits are inverted during transmission then error can be detected)
Disadvantage: This method is failed if even number of error occurs. Also, the method can detects
error only and cannot correct it.
Modified versions of Parity Method are used: The method shown here also called LRC (Longitudinal Redundancy
check). Another is VRC (Vertical Redundancy Check) method, in which the parity bit is set vertically. i.e., Data send in
column-by-column manner. For each column parity is maintained.
Letter Ascii- 7-bit Parity bit (LRC)
As shown in table, both VRC/LRC are applied in H 1001000 0
Two-Dimensional Parity Method. Using this E 1000101 1
method one can correct single error in a row or L 1001100 1
column. Again, if more than one error in row or L 1001100 1
column, then it cannot be corrected, but can be O 1001111 0
detected. Parity Bit (VRC) 1000010 0
(ii) CRC (Cyclic Redundancy Check) Method: In Cyclic redundancy Check method, One divisor (called
generator ) is selected for generation of codeword.
Here, if mB/(m+r)B block coding scheme is selected
(i.e. with m-bit data r-bit redundancy) then in any data
word r zeros are appended at end of dataword. The
newly augmented data-word is then divided by
generator.
Finally, the reminder is then added to augmented
dataword and answer is considered as codeword to be
send.
E.g. As shown in figure 4B/7B block coding scheme is
given.
Data to be send: 1001
Generator: 1011
Final Codeword : 1001110
When this codeword is received at receiver end, receiver will divide the same code with same generator.
(Generator is agreed by both sender and receiver using some algorithm.)
If reminder is zero, code is accepted and data word is extracted from code.
Else, codeword is rejected.
E.g.
INTERNET CHECKSUM: Traditionally, the Internet has been using a 16-bit checksum.
Sender site:
a. The message is divided into 16-bit words.
b. The value of the checksum word is set to O.
c. All words including the checksum are added ushtg one's complement addition.
d. The sum is complemented and becomes the checksum.
e. The checksum is sent with the data.
Receiver site:
a. The message (including checksum) is divided into 16-bit words.
b. All words are added using one's complement addition.
c. The sum is complemented and becomes the new checksum.
d. If the value of checksum is 0, the
message is accepted; otherwise, it is
rejected.
E.g.
11. Explain Error Correction Techniques [08]
Error Correction Techniques:
(i) Two Dimensional Parity Bit Method (VRC/LRC Method).
(ii) Hamming Code Method.
Now, one can even correct bit at position 7. i.e. original code again.
Advantages: We want to be able to correct error with less overhead than 2D parity
Hamming codes correct all single bit errors with only log(m) (where m=number of data bits) extra bits and
detect double bit errors .
Disadvantage: If more than one bit is in error, then a Hamming code cannot correct it.
(Require 2m+1 bit to correct more errors) Hamming codes, like parity bits, are only useful on short messages.
12. Do this yourself:
(i) Examples of Hamming Code Techniques (correction and detection). [04]
(ii) Examples of CRC Method (generate checksum and detect errors). [04]
(iii) Examples of checksum method and internet checksum method. [04]
13. What is Flow Control? List types of flow control available. [02]
Flow control is the process for match the speed of the sender too that of the receiver. This is a dynamic process, as
the receiving speed depends on such changing factors as the load, and availability of buffer space.
There are two type of flow controls are available:
(i) Feedback-based flow control: Receiver send information back to sender (given permission to give more or
telling its condition)
(ii) Rate-based flow control: Use a built-in mechanism to limit the rate.
14. Remember: Protocol.h file.
15. Remember: Unrestricted Simplex Protocol.
Assumption Taken in Unrestricted Simplex Protocol are:
The physical layer, data link layer, and network layer are independent processes that communicate by passing
messages back and forth.
Machine A wants to send a long stream of data to machine B, using a reliable, connection-oriented service. Data
are transmitted in one direction only.
A is assumed to have an infinite supply of data ready to send and never has to wait for data to be produced.
Both the transmitting and receiving network layers are always ready. Processing time can be ignored. Infinite
buffer space is available.
Machines do not crash. That is, these protocols deal with communication errors, but not the problems caused by
computers crashing and rebooting.
16. Explain Simplex Stop and wait protocol. [05]
In this protocol we assume that:
(i) Data are transmitted in one direction only
(ii) No errors occur
(iii) The receiver can only process the received information at a finite rate
These assumptions imply that the transmitter cannot send frames at a rate faster than the receiver can
process them.
The problem here is how to prevent the sender from flooding the receiver.
A general solution to this problem is to have the receiver provide some sort of feedback to the sender. The
process could be as follows: The receiver send an acknowledge frame back to the sender telling the sender
that the last received frame has been processed and passed to the host; permission to send the next frame is
granted. The sender, after having sent a frame, must wait for the acknowledge frame from the receiver before
sending another frame. This protocol is known as stop-and-wait.
17. Explain Simplex Protocol for a Noisy Channel. [05]
In this protocol the unreal “error free” assumption in protocol 2 is dropped. Frames may be either damaged or lost
completely. We assume that transmission errors in the frame are detected by the hardware checksum.
One suggestion is that the sender would send a frame, the receiver would send an ACK frame only if the frame is
received correctly. If the frame is in error the receiver simply ignores it; the transmitter would time out and would
retransmit it.
One fatal flaw with the above scheme is that if the ACK frame is lost or damaged, duplicate frames are accepted at the
receiver without the receiver knowing it. Imagine a situation where the receiver has just sent an ACK frame back to the
sender saying that it correctly received and already passed a frame to its host. However, the ACK frame gets lost
completely, the sender times out and retransmits the frame. There is no way for the receiver to tell whether this
frame is a retransmitted frame or a new frame, so the receiver accepts this duplicate happily and transfers it to the
host. The protocol thus fails in this aspect.
To overcome this problem it is required that the receiver be able to distinguish a frame that it is seeing for the first
time from a retransmission. One way to achieve this is to have the sender put a sequence number in the header of
each frame it sends. The receiver then can check the sequence number of each arriving frame to see if it is a new
frame or a duplicate to be discarded.
The receiver needs to distinguish only 2 possibilities: a new frame or a duplicate; a 1-bit sequence number is sufficient.
At any instant the receiver expects a particular sequence number. Any wrong sequence numbered frame arriving at
the receiver is rejected as a duplicate. A correctly numbered frame arriving at the receiver is accepted, passed to the
host, and the expected sequence number is incremented by 1 (modulo 2)
18. Give Names of Sliding Window Protocol. [02]
A One-Bit Sliding Window Protocol
A Protocol Using Go Back N
A Protocol Using Selective Repeat
Assume that computer A is trying to send its frame 0 to computer B and that B is trying to send its frame 0 to A.
Suppose that A sends a frame to B, but A's timeout interval is a little too short. Consequently, A may time out
repeatedly, sending a series of identical frames, all with seq = 0 and ack = 1.
When the first valid frame arrives at computer B, it will be accepted and frame_expected will be set to 1. All the
subsequent frames will be rejected because B is now expecting frames with sequence number 1, not 0.
Furthermore, since all the duplicates have ack = 1 and B is still waiting for an acknowledgement of 0, B will not
fetch a new packet from its network layer.
After every rejected duplicate comes in, B sends A a frame containing seq = 0 and ack = 0. Eventually, one of these
arrives correctly at A, causing A to begin sending the next packet. No combination of lost frames or premature
timeouts can cause the protocol to deliver duplicate packets to either network layer, to skip a packet, or to
deadlock.
However, a peculiar situation arises if both sides simultaneously send an initial packet. This synchronization
difficulty is illustrated by following figure. In part (a), the normal operation of the protocol is shown. In (b) the
peculiarity is illustrated.
Two scenarios for One-Bit Sliding Window Protocol. (a) Normal case. (b) Abnormal case. The notation is (seq, ack,
packet number). An asterisk indicates where a network layer accepts a packet.
If B waits for A's first frame before sending one of its own, the sequence is as shown in (a), and every frame is
accepted.
However, if A and B simultaneously initiate communication, their first frames cross, and the data link layers then
get into situation (b).
In (a) each frame arrival brings a new packet for the network layer; there are no duplicates.
In (b) half of the frames contain duplicates, even though there are no transmission errors.
Similar situations can occur as a result of premature timeouts, even when one side clearly starts first. In fact, if
multiple premature timeouts occur, frames may be sent three or more times.
22. What is pipelining?
Pipelining allows a sender to send out multiple packets without waiting for acknowledgment. But all packets that have
been sent must be retained until they are acknowledged in case they need to be resent. To limit the number of
packets that need to be retained, pipelined protocols need to set a bound on the number of packets in the pipeline
(sent but not yet acknowledged). This bound imposes a "window" on the sequence numbers for packets in the
pipeline.
To avoid this a gap is introduced in the sequence numbers to ensure no overlap, i.e.:
the sender sends frames 0 to 6
the receiver receives each frame (0 to 6) in turn and passes message to the host, advances its
window and sends an ack
the acks for frames 0 to 6 are all lost (lightning strike on comms line)
the receiver now is expecting frame sequence number 7
after timeout the sender resends frames 0 to 6
the receiver discards all these frames (outside its window) but sends acks
the sender gets acks for 0 to 6 and sends frame 7, etc.
24. What is ARQ? [01]
The general strategy of using acknowledgements and timeouts to implement reliable delivery is called
automatic repeat request (ARQ).
25. Explain Selective Repeat Protocol. [06]
In this protocol rather than discard all the subsequent frames following a damaged or lost frame, the receiver's
data link layer simply stores them in buffers.
When the sender does not receive an acknowledgement for the first frame it's timer goes off after a certain time
interval and it retransmits only the lost frame.
Assuming error - free transmission this time, the sender's data link layer will have a sequence of a many correct
frames which it can hand over to the network layer.
Thus there is less overhead in retransmission than in the case of Go Back n protocol.
In case of selective repeat protocol the window size may be calculated as follows.
Assume that the size of both the sender's and the receiver's window is w.
So initially both of them contain the values 0 to (w-1).
Consider that sender's data link layer transmits all the w frames, the receiver's data link layer receives
them correctly and sends acknowledgements for each of them.
However, all the acknowledgements are lost and the sender does not advance it's window.
The receiver window at this point contains the values w to (2w-1).
To avoid overlap when the sender's data link layer retransmits, we must have the sum of these two
windows less than sequence number space.
Hence, we get the condition
Maximum Window Size = Sequence Number Space / 2
26. In selective repeat explain the dilemma of window size. (OR, why window size of sender is selected half of sequence
number in selective repeat protocol). [04]
DO IT YOUR SELF
27. What is the key idea of Stop & Wait Protocol?
After transmitting one frame, the sender waits for an acknowledgment before transmitting the next frame. If the
acknowledgement does not arrive after a certain period of time, the sender time out and retransmits the original
frame.
28.