Difference between Byte stuffing and Bit stuffing

Computer EngineeringComputer NetworkMCA

The differences between byte stuffing and bit stuffing can be done under the following heads −

What are byte stuffing and bit stuffing?

Byte stuffing is a mechanism to convert a message formed of a sequence of bytes that may contain reserved values such as frame delimiter, into another byte sequence that does not contain the reserved values.

Bit stuffing is the mechanism of inserting one or more non-information bits into a message to be transmitted, to break up the message sequence, for synchronization purpose.

Purposes of byte stuffing and bit stuffing

In Data Link layer, the stream of bits from physical layer are divided into data frames. The data frames can be of fixed length or variable length. In variable - length framing, the size of each frame to be transmitted may be different. So, a pattern of bits is used as a delimiter to mark the end of one frame and the beginning of the next frame. However, if the pattern occurs in the message, then mechanisms needs to be incorporated so that this situation is avoided.

The two common approaches are −

  • Byte - Stuffing − A byte is stuffed in the message to differentiate from the delimiter. This is also called character-oriented framing.

  • Bit - Stuffing − A pattern of bits of arbitrary length is stuffed in the message to differentiate from the delimiter. This is also called bit - oriented framing.

Data link layer frames in byte stuffing and bit stuffing

A data link frame has the following parts −

  • Frame Header − It contains the source and the destination addresses of the frame.

  • Payload field − It contains the message to be delivered. In bit stuffing it is a variable sequence of bits, while in byte stuffing it is a variable sequence of data bytes.

  • Trailer − It contains the error detection and error correction bits.

  • Flags − Flags are the frame delimiters signalling the start and end of the frame. In bit stuffing, flag comprises of a bit pattern that defines the beginning and end bits. It is generally of 8-bits and comprises of six or more consecutive 1s. In byte stuffing, flag is of 1- byte denoting a protocol - dependent special character.

Mechanisms of byte stuffing versus bit stuffing

Byte Stuffing Mechanism

If the pattern of the flag byte is present in the message byte sequence, there should be a strategy so that the receiver does not consider the pattern as the end of the frame. Here, a special byte called the escape character (ESC) is stuffed before every byte in the message with the same pattern as the flag byte. If the ESC sequence is found in the message byte, then another ESC byte is stuffed before it.

Bit Stuffing Mechanism

Here, the delimiting flag sequence generally contains six or more consecutive 1s. Most protocols use the 8-bit pattern 01111110 as flag. In order to differentiate the message from the flag in case of same sequence, a single bit is stuffed in the message. Whenever a 0 bit is followed by five consecutive 1bits in the message, an extra 0 bit is stuffed at the end of the five 1s. When the receiver receives the message, it removes the stuffed 0s after each sequence of five 1s. The un-stuffed message is then sent to the upper layers.

raja
Published on 31-Dec-2018 05:43:15
Advertisements