Computer network (7th Edition) - Xie Xiren after-school exercise 3-26

3-26

Ethernet only two stations, which transmit data simultaneously, resulting in a collision. Then press the truncated binary exponential backoff algorithm for retransmission. Retransmission times referred to as i, i = 1,2,3, ... Calculate first retransmission failure probability, the second probability of failure in retransmission, a third retransmission the probability of failure, and a station successfully sent the average number of retransmissions of data before the I .

  • In the truncated binary exponential backoff algorithm, the time taken since the backoff is substantially a contention period, so long as the two stations take different r value, the predetermined retransmission time separated by at least 2 [tau] , the first station may retransmit rush in another station prior to retransmission of the data, again to avoid a collision.

  • In other words, if a collision again, described two stations taken r value is the same . Then there are:

  • First retransmission fails, stand two {0,1} are taken are taken 0 or 1, a probability of 1/2.
    Second retransmission fails, two standing {0,1,2, 3} selected as a probability of 1/4.
    third retransmission fails, two standing {0,1, ..., 7} is selected as a probability of 1/8.
    ...
    tenth collision, two standing {0,1, ..., 1023} selected the same, the probability of 1/1024.
    from the eleventh, has been to the sixteenth, two standing {0,1, ..., 1023 } selected the same, the probability of 1/1024.

  • Assuming m-th transmitting station before the failure, m + 1 times in the first transmission successfully. Probability of retransmission of previous failed m, i.e. this station successfully transmitted data:
    Here Insert Picture Description

  • The average number of retransmissions retransmission = 1 + success in front of retransmissions average number of failures (calculated here I am using matlab count, specific code on my last article):
    Here Insert Picture Description


matlab code for calculating the average number of retransmissions fail

%计算失败的平均重传次数
avg=0; %初始化为0
for m=1:15  %失败的重传次数,从115都有可能,既然是发送成功前的重传次数,第16次总得成功吧
    P_failed_m=1;   %重传失败的概率,初始化为1
    if (m<10)
        for i=1:m %m<10,按次数来计算概率
            P_failed_m=P_failed_m/2^i; %第m次失败的概率
        end
        P_success=1-1/(2^(m+1)); %第m+1次成功的概率
    else %m>=10,概率和10是一样的
        for j=1:m
            if (i<10)
                P_failed_m=P_failed_m/2^j;
            else
                P_failed_m=P_failed_m/2^10; %10次及10次以后失败的概率
            end
        end
        P_success=1-1/(2^10);
    end
    avg = avg + m*P_success*P_failed_m; %加上第i次重传失败的概率加权
end
avg

operation result
Here Insert Picture Description

Published 26 original articles · won praise 32 · views 10000 +

Guess you like

Origin blog.csdn.net/Clover_pofu/article/details/105061957