Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bit stuffing example

I'm going over an example that reads

Bit Stuffing. Suppose the following bit string is received by the data link layer from the network layer: 01110111101111101111110. What is the resulting string after bit stuffing? Bold each bit that has been added.

Answer:

0111011110111110011111010
               ^      ^  

How is this answer reached? My understanding is that bit stuffing works by inserting a certain sequence of bits (known as a flag value) at the beginning and end of a frame. What I don't get is:

  1. We aren't told the flag value!
  2. We aren't told how big a frame is, so how do we know where to put the flag?

Aditional Information: I think this network is Ethernet.

Aditional Information 2: The bit flag is 01111110

Honestly I think I understand but isn't the answer incomplete because they didn't add the flag 01111110 to the end or beginging? They just took care of when that pattern of bits appeared in the message.

Other example: here they do it too.

like image 724
Celeritas Avatar asked Oct 04 '12 08:10

Celeritas


3 Answers

For framing in the network in the data link layer, there are some approaches that the bit-oriented is one of them.

It should be a way to know the start and the end of a frame which is transmitting on the link in the receiver side, so there are some format for framing like HDLC. You can see this.

In the many types of frame formats there are begging sequence (shows the start of frame) and ending sequence (shows the end of frame) and the body of frame which is the data. The problem that might be occur is the appearance of the ending sequence in the body which may make discern of frame end incorrect.

For preventing from this problem, the sender of frame stuff some bit on the body for disarranging the pattern of ending sequence, this technique known as bit stuffing.

Look at this example:

bit sequence: 110101111101011111101011111110 (without bit stuffing)

bit sequence: 110101111100101111101010111110110 (with bit stuffing)

after 5 consecutive 1-bits, a 0-bit is stuffed.

stuffed bits are marked bold.

like image 104
Meysam PH Avatar answered Nov 12 '22 01:11

Meysam PH


Bit Stuffing:

Input Stream:        0110111111100111110111111111100000
Stuffed Stream:     01101111101100111110011111011111000000
Unstuffed Stream: 0110111111100111110111111111100000

like image 31
user9197045 Avatar answered Nov 12 '22 02:11

user9197045


Consider: 0111011110111110*0111110*10

After it finds a 0 and then five consecutive 1 bits it stuffs with a 0. This assumes 0 bit stuffing which is common.

like image 11
mani deepak Avatar answered Nov 12 '22 01:11

mani deepak