Unit-5
Unit-5
Framing
Error Detection methods: Parity, Checksum , CRC
Data Link Protocols
A simplex stop and wait protocol
Sliding window protocols
A One Bit Sliding Window Protocol
A Protocol Using Go Back N
A Protocol Using Selective Repeat
Data Link Layer
It is the second layer of OSI Reference Model.
It transfer data from network layer of one machine to the network layer of
another. That is this layer is responsible for hop to hop delivery
It convert raw bit stream of physical layer into group of bits (frames).
Data link layer hides the details of underlying hardware and represent itself to
upper layer as the medium to communicate.
At sending side, Data link layer is responsible for converting data stream to
signals bit by bit and to send that over the underlying hardware.
Whereas in receiving side, Data link layer picks up data from hardware which
are in the form of electrical signals, assembles them in a recognizable frame
format and serve it to upper layer.
It makes the physical layer appear error-free to the upper layer
Data Link Layer
Data Link Layer
Functions of data link layer:
1. It provides service to network layer.
2. Framing: This layer divides the stream of bits received from network layer
into manageable data units called frames.
3. Frame synchronization: The source machine sends data in blocks called
frame to the destination machine. The starting and ending of each frame
should be recognized by the destination machine. This ensure that signals
transmitted from one participant of the communication can be correctly
decoded by the receiver. For this certain timinig information must be
passed to the receiver like where communication units begins and end.
4. Flow control: If the rate at which the data are absorbed by the receiver is
less than the rate at which data are produced in the sender, the data link
layer imposes a flow control mechanism to avoid overwhelming the
receiver. The source machine must not send data frames at the rate faster
than destination machine can accept them.
Data Link Layer
Functions of data link layer:
5. Error Control: Errors made in bits during transmission from source to
destination machines must be detected and corrected. Error control can be
achieved from a trailer added to the end of the frame.
6. Addressing: ON a multipoint line like many devices connected together (i.e.
LAN), the identity of individual machines must be specified while
transmitting the data frames.
Data Link Layer
The data link layer has two sublayers:
a. the logical link control (LLC) sublayer
b. the media access control (MAC) sublayer.
LLC sublayer provides the logic for the data link. Thus it controls the
synchronization, flow control and error checking and notification functions of
data link layer.
Media Access Control (MAC) sublayer provides control for accessing transmission
medium. It is responsible for moving data packets from one hop to another,
across a shared transmission medium. Physical addressing is handled at MAC sub
layer. MAC is also handled at this layer. This refers to the method used to allocate
network access to computers and prevent them from transmitting at the same
time, causing data collisions.
Data Link Layer
Two common MAC layer types include Ethernet IEEE 802.3and 802.11 wireless
specifications.
IEEE 802.3 is a set of standards and protocols that define Ethernet based
networks. Ethernet technologies are primarily used in LANs, though they can be
used in MANs and even WANs. IEEE 802.3 defines the physical layer and the
medium access control (MAC) sub layer of the data link layer for wired Ethernet
networks.
IEEE 802.11 is part of the IEEE 802 set of LAN technical standards and specifies
the set of medium access control and physical layer protocols for implementing
wireless LAN computer communication.
Error Detection and Correction Techniques
Network must be able to transfer data from one device to another with
acceptable accuracy. For most applications, a system must guarantee that the
data received are identical to the data transmitted.
Anytime data are transmitted from one node to another, they can become
corrupted in passage.
Error is a condition when the receiver’s information does not matches with the
sender’s information.
Whenever bits flow from one point to another, they are subject to unpredictable
changes due to interference, noise, distortion or attenuation.
These imparities can alter the shape of the signal.
Error Detection and Correction Techniques
Types of error:
a. Single bit error: A single bit in a block of bits is changed and all other bits in
the block are unchanged. It is occurred from extremely short duration
interference called spike. Single bit error are least likely type of errors in serial
data transmission. However, a single bit error can happen if we are having
parallel data transmission. For example, if 16 wires are used to send all 16
bits of word at the same time and one of the wires is noisy, one bit is
corrupted in each word.
Error Detection and Correction Techniques
Types of error:
b. Burst error: Two or more bits in a block of bits are changed from 0 to 1 or
vice versa. Brust error doesnot necessarily means that error occurs in
consecutive bits. The length of brust error is measured from the first
corrupted bit to the last corrupted bit. However some bits in between may
not be corrupted. It is caused from longer duration interference. Brust error
are most likely to happen in serial transmission. The number of bits affected
depends on the data rate and duration of noise.
c. Erasure: The signal that arrives at receiver is ambiguous the this error type is
erasure. Sometimes a signal is neither clearly 1 nor clearly 0 but falls in an
ambiguous region which is known as erasure.
Error Detection and Correction Techniques
Types of error:
b. Burst error: Two or more bits in a block of bits are changed from 0 to 1 or
vice versa. Brust error doesnot necessarily means that error occurs in
consecutive bits. The length of brust error is measured from the first
corrupted bit to the last corrupted bit. However some bits in between may
not be corrupted. It is caused from longer duration interference. Brust error
are most likely to happen in serial transmission. The number of bits affected
depends on the data rate and duration of noise.
Error Detection and Correction Techniques
Types of error:
c. Erasure: The signal that arrives at receiver is ambiguous the this error type is
erasure. Sometimes a signal is neither clearly 1 nor clearly 0 but falls in an
ambiguous region which is known as erasure.
Error Detection and Correction Techniques
Error Detecting Codes
The basic approach used for error detection is the use of redundancy, where
additional bits are added to facilitate detection and correction of errors. To
detect error or correct errors we need to send some extra bits with our data.
These extra bits are added by sender and removed by the receiver. Redundant
bits allow the receiver to detect and correct the corrupted bits. However it may
have drawback:
a. Sends n-redundant bits for n bit message
b. Many errors are undetected if both the copies are corrupted.
Error Detection and Correction Techniques
Error Detecting Codes
The basic approach used for error detection is the use of redundancy, where
additional bits are added to facilitate detection and correction of errors. To
detect error or correct errors we need to send some extra bits with our data.
These extra bits are added by sender and removed by the receiver. Redundant
bits allow the receiver to detect and correct the corrupted bits. However it may
have drawback:
a. Sends n-redundant bits for n bit message
b. Many errors are undetected if both the copies are corrupted.
Some of the popular error detecting techniques are:
a. Simple parity check
b. Two dimensional parity check
c. Checksum
d. Cyclic Redundancy Check (CRC)
Error Detection and Correction Techniques
Error Detecting Codes: Simple parity check
One extra bit is sent along with original bits to make number of 1’s either even in
case of even parity or odd in case of odd parity. The sender while creating a
frame counts the number of 1’s in it. If number of 1’s is even then one parity bit
with value 0 is added. If the number of 1’s is odd, to make even a bit with value 1
is added.
The receiver simply counts the number of 1s in it. If the count of 1s is even and
even parity is used, the frame is considered to be not corrupted and is accepted.
If the count of 1’s is odd and odd parity is used, the frame is still not corrupted.
The drawback of this technique is that if more than one bits are erroneous, it is
very difficult for the receiver to detect the error.
Error Detection and Correction Techniques
Error Detecting Codes: Simple parity check
One extra bit is sent along with original bits to make number of 1’s either even in
case of even parity or odd in case of odd parity. The sender while creating a
frame counts the number of 1’s in it. If number of 1’s is even then one parity bit
with value 0 is added. If the number of 1’s is odd, to make even a bit with value 1
is added.
The receiver simply counts the number of 1s in it. If the count of 1s is even and
even parity is used, the frame is considered to be not corrupted and is accepted.
If the count of 1’s is odd and odd parity is used, the frame is still not corrupted.
The drawback of this technique is that if more than one bits are erroneous, it is
very difficult for the receiver to detect the error.
Error Detection and Correction Techniques
Error Detecting Codes: Simple parity check
Error Detection and Correction Techniques
Error Detecting Codes: Two Dimension parity check
Performance can be improved by using two dimensional parity check in which the block of
bits are organizes in the form of a table.
Parity check bits are calculated for each row, which is equivalent to a simple parity check
bit. Parity check bits are also calculated for all columns then both are sent along with the
data.
At receiving end these are compared with the parity bits calculated on received data.
Error Detection and Correction Techniques
Error Detecting Codes: Two Dimension parity check
Performance can be improved by using two dimensional parity check in which the block of
bits are organizes in the form of a table.
Parity check bits are calculated for each row, which is equivalent to a simple parity check
bit. Parity check bits are also calculated for all columns then both are sent along with the
data.
At receiving end these are compared with the parity bits calculated on received data.
Error Detection and Correction Techniques
Error Detecting Codes: Two Dimension parity check
Drawback of two dimensional parity check are:
a. If two bits in one data unit are corrupted and two bits exactly the same position in
another data unit are also corrupted then it will not be able to detect the error.
b. This technique cannot be used to detect the 4 bit error or more in some cases.
Error Detection and Correction Techniques
Error Detecting Codes: Checksum
In checksum error detection sche me, the data is divided into k segments each of m bits.
In the sender’s end the segment are added using 1’s complement arithmetic to get sum.
The sum is complemented to get the checksum. The checksum is sent along with the data
segments.
At the receiver’s end, all received segments are added using 1’s complement arithmetic to
get the sum. The sum is complemented. If the result is zero, the received data is accepted,
otherwise it is discarded.
The checksum can detects all errors involving an odd number of bits and also detects most
errors involving even number of bits.
Error Detection and Correction Techniques
Error Detecting Codes: Checksum
Error Detection and Correction Techniques
Error Detecting Codes: Cyclic Redundancy Check (CRC)
Unlike checksum scheme, which is based on addition, CRC is based on binary division.
In CRC, a sequence of redundant bits called cyclic redundancy check bits are appended to
the end of data unit so that the resulting data unit becomes exactly divisible by a second,
predetermined binary number.
At the destination, the incoming data unit is divided by the same number. If at this step
there is no remainder, the data unit is assumed to be correct and is therefore accepted.
A remainder indicates that the data unit has been damaged in transit and therefore must
be rejected.
Error Detection and Correction Techniques
Error Detecting Codes: Cyclic Redundancy Check (CRC)
Techniques:
If a k bit message is to be transmitted, the transmitter generates an r-bit sequence known
as Frame Check Sequence (FCS) so that the (k+r) bits are actually being transmitted.
Now, this r-bit FCS is generated by dividing the original number, appended by r zeros, by a
predetermined number.
The number which is (r+1) bit in length can also be considered as the coefficients of a
polynomial called generator polynomial. The remainder of this division process generates
the r-bit FCS. On receiving the packet, the receiver divides the (k+r) bit frame by the same
predetermined number and if it produces no remainder, it can be assumed that no error
has occurred during the transmission.
Error Detection and Correction Techniques
Error Detecting Codes: Cyclic Redundancy Check (CRC)
Error Detection and Correction Techniques
Error Detecting Codes: Cyclic Redundancy Check (CRC)
Techniques:
Let us divide a sample 4 bit number by the coefficient of the generator polynomial x3+x+1,
then the data will be 1011, using the modulo-2 arithmetic. Modulo-2 arithmetic is a binary
addition process without any carry over, which is just the XOR operation.
Suppose K=1101. Hence we have divide 1101000 (i.e. k appended by 3 zeros) by 1011,
which produces the remainder r=-001, so that the bit frame (k+r)=1101001 is actually
being transmitted through the communication channel.
At receiving end, if the received number i.e. 1101001 is divided by the same generator
polynomial 1011 to get the remainder as 000, it can be assumed that the data is error free.
Error Detection and Correction Techniques
Error Detecting Codes: Cyclic Redundancy Check (CRC)
Techniques:
Let us divide a sample 4 bit number by the coefficient of the generator polynomial x3+x+1,
then the data will be 1011, using the modulo-2 arithmetic. Modulo-2 arithmetic is a binary
addition process without any carry over, which is just the XOR operation.
Suppose K=1101. Hence we have divide 1101000 (i.e. k appended by 3 zeros) by 1011,
which produces the remainder r=-001, so that the bit frame (k+r)=1101001 is actually
being transmitted through the communication channel.
At receiving end, if the received number i.e. 1101001 is divided by the same generator
polynomial 1011 to get the remainder as 000, it can be assumed that the data is error free.
Error Detection and Correction Techniques
Error Detecting Codes: Cyclic Redundancy Check (CRC)
Techniques:
Error Detection and Correction Techniques
Error Detecting Codes: Cyclic Redundancy Check (CRC)
Advantages:
- CRC can detect all single bit errors
- CRC can detect all double bit errors
- CRC can detect any odd number of errors (X+1)
- CRC can detect all burst errors of less than degree of the polynomial
- CRC detects most of the larger burst errors with a high probability.
- For example CRC-12 detects 99.97% of errors with a length 12 or more.
Data link layer protocol
Simplest Protocol
- It has no flow or error control.
- It is a unidirectional protocol in which frames travels in only one direction from sender
to receiver.
- The receiver can immediately handle any frame it receives with a processing time that is
small enough to be negligible.
- The data link layer of the receiver immediately removes the header from the frame and
hands the data packet to network layer which can also accept the packet immediately.
Flow Control
- It is a set of procedures that tells the sender how much data it can transmit before the
data overwhelms the receiver.
- The receiving device has limited speed and limited memory to store the data. So, the
receiving device should inform sending device to stop the transmission temporarily
before the limits are reached. For this two methods have been deployed to control the
flow of data.
- Stop and wait
- Sliding Window.
Flow Control
Stop and Wait
- In this, the sender waits for an acknowledgement after every frame it sends. When
acknowledgement is received, then only next frame is sent. The process of alternately
sending and waiting of a frame continues until the sender transmits the EOT (End of
Transmission Frame)
Advantages:
- It is simple as each frame is checked and acknowledged before the next frame is sent.
Disadvantages
- It is inefficient to use as each frame must travel all the way to the receiver and an
acknowledgement travels all the way before the next frame is sent. Each frame sent and
received uses the entire time needed to traverse the link.
Flow Control
Stop and Wait
Flow Control
Sliding Window
- To remove the drawbacks of stop and wait protocol, sliding window came into
existence. It allow multiple frames to be transmitted before receiving an
acknowledgment.
- In this, both the sender and receiver has finite sized buffers called windows. Both
sender and receiver agrees on the number of frames to be send based on the buffer
size.
- The sender sends multiple frames in a sequence, without waiting for acknowledgement.
When its sending window is filled, it waits for acknowledgement. On receiving
acknowledgement, it advances window and transmit the next frames, according to the
acknowledgment received.
Error Control
- Error control is a mechanism for error detection and retransmission.
- When data frame is transmitted, there is a chance of lost of data frame or it may be
received corrupted.
- In either of the cases, the receiver cannot receive the correct data. And also sender
doesnot know anything about any loss. In such both sender and receiver have some
protocol that help them to detect transmit errors like loss of data frame so that the
sender could retransmits the data frame or the receiver may request to resend the
previous data frame.
Why error control mechanism is required?
- Error Detection
- Positive ACK
- Negative ACK
- Retransmission
The sender maintains a clock and sets a timeout period. If acknowledgement of a data
frame previously transmitted doesnot arrive before the timeout the sender retransmits the
frame, thinking that the frame or its acknowledgement is lost during transmission.
Error Control
1. Stop and Wait ARQ(Automatic Repeat Request)
- It a technique used to retransmit the data in case of damaged or lost frames.
- It is based on Stop and Wait mechanism where sender will not transmit the next frame until
it receives the acknowledge of the last transmitted frame.
- To detect and correct corrupted frames, we need to add redundancy bits to our data frame.
When frame arrives at the receiver site, it is checked and if it is corrupted, it is silently
discarded.
- The detection of the error in this protocol is manifested by the silence of the receiver. Since
lost frames are difficult to handle than corrupted ones. If frame was received, frame could
be correct one or duplicate or a frame out of order. So the solution is to number the
frames. When the receiver receives a data frame that is out of order, this means that
frames were either lost or duplicated.
- Then the corrupted and lost frames need to be resent in this protocol.
- Error correction in stop and wait ARQ is done by keeping a copy of the sent frame and
retransmitting of the frame when the timer expires.
- Since the protocol uses the stop and wait mechanism, there is only one specific frame that
need an ACK even though several copies of the same frame can be in the network.
Error Control
1. Stop and Wait ARQ(Automatic Repeat Request): Normal Operation
- Senders keep a copy of the last frame until it receives acknowledgement. For identification,
both data frames and acknowledgement (ACK) frames are numbered alternatively 0 and 1.
- Sender has a control Variable S that holds the number of recently send frame (0 or 1).
- Receiver has a control variable R that holds the number of next frame expected (0 or 1).
- Sender starts a timer when it sends a frame. If an ACK is not received within an allocated
time period, the sender assumes that the frame was lost or damaged and resends it.
Receiver send only Positive ACK if frame is correctly received. ACK number always defines
the number of next expected frame.
Error Control
1. Stop and Wait ARQ(Automatic Repeat Request)
Possibilities of the retransmission
a. Lost Frame: When 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.
b. Lost ACK: 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 the frame1.
c. Delayed ACK: The ACK can be delayed at the receiver or due to some problem. It is
received after the time 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.
Error Control
Stop and Wait ARQ(Automatic Repeat Request)
Error Control
Stop and Wait ARQ(Automatic Repeat Request)
Pipelining
- When a task begun before the previous task has ended then this is known as pipelining.
- There is no pipelining in Stop and Wait ARQ as we need to wait for a frame to reach the
destination and be acknowledged before the next frame can be sent.
- Pipelining improves the efficiency of transmission if the number of bits in transition is large
with respect to the bandwidth delay (Bandwidth delay is a measurement of how many bits
can fill up a network link. It gives maximum amount of data that can be transmitted by the
sender at a given time before waiting for acknowledgement. Therefore it is the maximum
amount of unacknowledged data.)
Error Control
2. Sliding Window ARQ(Automatic Repeat Request)
- It ensure the reliable and sequential delivery of data frames. It is used in TCP.
- In this protocol, multiple frames can be sent by a sender at a time before receiving an
acknowledgement from the receiver.
- Sliding window method is also known as windowing.
- In this, the sender has a buffer called sending window and the receiver has buffer called
receiving window.
- The size of the sending window determines the sequence number of the outbound frames.
If the sequence number of the frames is an n-bit field, then the range of sequence numbers
that can be assigned is 0 to 2n – 1.
- If the window size is 4, then sequence numbers will be 0,1, 2,3,0,1,2,3, and so on. The
number of bits in the sequence number is 2 to generate the binary sequence 00,01,10,11.
- The size of receiving window is the maximum number of frames that the receiver can
accept at a time.
Error Control
2. Sliding Window ARQ(Automatic Repeat Request)
- Sliding window can be categorized into two types:
- Go-Back-N ARQ
- Selective Repeat ARQ
Go-Back-N ARQ
- Go-Back-N ARQ provides for sending multiple frames before receiving the
acknowledgement for the first frame.
- It uses the concept of sliding window, and so is called sliding winding protocol.
- There are finite number of frames and the frames are numbered in a sequential manner.
- The number of frames that can be sent depends on the window size of the sender.
- If the acknowledgement of a frame is not received within the time period, all frames, in the
current window are transmitted starting from that frame are retransmitted.
- So we have to keep a copy of these frames until acknowledgement arrives.
Selective Repeat ARQ
- This protocol is also based on sliding window ARQ, can send multiple frames before
receiving the acknowledgement for the first frame.
- Here, only erroneous or lost frames are retransmitted