Report for Probabilistic Verification to the GBN Protocol

Total Page:16

File Type:pdf, Size:1020Kb

Report for Probabilistic Verification to the GBN Protocol

Report for Probabilistic Verification to the GBN Protocol Zhen Qiu (zq2130), Yuanhui Luo (yl3026), Ziwei Zhang (zz2282), Yih-Nin Lai (yl3030)

1. Protocol description

We define our GBN protocol as follows

(1) Sender will transmit all the messages that have not been transmitted in the 4-size window immediately.

(2) As soon as the sender receives an ACK, the window base will move to the next message to the one numbered by this ACK.

(3) If receiver accepts the expected message, it will put a corresponding ACK in the reverse channel.

(4) Receiver will not put ACK in the channel if this message is not the expected one. It will discard this message.

(5) It is impossible for sender to receive an ACK with the number smaller than the one it expects. If it receives a larger one, sender believes that all the messages before are successfully transmitted.

(6) If there comes a timeout, all the four messages in the window will be transmitted.

(7) The propagation time, of both messages and ACKs, is not specified.

2. Assumptions

(1) The protocol only allows to lose up to 3 packets.

(2) We define this situation a timeout that both the forward channel and reverse channel are empty.

(3) If there are messages and ACKs in the forward and reverse channel, we assume the first message and first ACK have equal probability to be received earlier.

(4) We only consider the first elements in both channels. Disregarding the empty channel occasion, four different states may occur: first message received; first ACK received; first message lost; first ACK lost. (state means the combination of the sender’s, receiver’s and two channel’s individual state, in the format of )

(5) We take these as stopping point when the first 4 messages are successfully transmitted and 4 packets are lost.

3. Stopping points

As what we mentioned above, when we successfully transmit the first 4 messages or any 4 packets are lost, we believe that it is the right place to stop our program. That is so say, the furthest message our program can deal with is message 6, when M3 or A3 is lost, while A2 is received by sender. The window base will move to message 3, then transmit M4~M6 immediately. Since the probability of losing 4 packets is 10-16, which is sufficiently low (which is also the requirement of the problem), it is reasonable to stop here. On the other hand, successful transmission of first 4 messages is a typical performance of our protocol. The following work will just be the repetition of it. So we choose it as another stopping point.

4. Examples

Figure 1 Examples of Next States from Current State

From the figure above, the states <13(34)(12)> and <22(2345)E> are of high probability to occur, while the other two are of 10-4 to occur.

Figure 2 Five cases that could happen on the transition from one state to next

5. Part of table

Table 1 First 3 Steps of the Table

State Service Seq initial 0 0 [E] [E] ------step: 1 pop: 0 0 [] [] ------0 0 [0,1,2,3] [] 0 Get 0 1 2 3 ------step: 2 pop: 0 0 [0,1,2,3] [] ------0 1 [1,2,3] [0] 0 Get 0 1 2 3 Acpt 0 0 0 [1,2,3] [] 1 Get 0 1 2 3 ------step: 3 pop: 0 1 [1,2,3] [0] ------0 2 [2,3] [0,1] 0 Get 0 1 2 3 Acpt 0 Acpt 1 1 1 [1,2,3,4] [] 0 Get 0 1 2 3 Acpt 0 Get 4 0 0 [1,2,3] [] 1 Get 0 1 2 3 0 1 [2,3] [0] 1 Get 0 1 2 3 Acpt 0 0 1 [1,2,3] [] 1 Get 0 1 2 3 Acpt 0 ------We use four separate stacks to store states with different probabilities, p=0, p=1, p=2, p=3.

Firstly, we push the initial state <00EE> to stack0 and pop it, then push the next states into the corresponding stacks. After the sender transmits all the 4 messages in the window [0,1,2,3], it’s the state <00[0,1,2,3][]> with p=0. We push it into stack0 and pop it. The next states of <00[0,1,2,3][]> are two states, <01[1,2,3][0]> with p=0 (receiver accepts M1 and puts A1 in the reverse channel)and <00[1,2,3][]> with p=1 (M1 is lost). So we push them into stack0 and stack1 separately, then pop the one in stack0 (the one with higher probability), so on and so forth.

In terms of the four stacks, we will always pop states in the order of stack0, stack1, stack2, stack3. That is to say, the state with higher probability should be pop earlier.

6. Pseudo code

Stack ; //define a stack structure

T.Push(initial);

For{

t2=T.pop(); //pop out the data saved in the top of stack

Generate_state(t2);

} Table T

{

int s, r; //sender, receiver

int sizef, sizeb; //size of forward and reverse channel

int[4]=chf,chb; //define forward channel and reverse channel

int p=0; //intiate error rate

}

//sender receives ack

Generate_state{

If(t2.sizeb>0)

{

new T.t; //create new table to save new state

x=chb[0]; //first element in backward channel queue

t.sizef=t2.sizef;

t.sizeb=t2.sizeb-1;

t.chf=t2.chf;

for(i=0, i

{t.chb[i]=t2.chb[i+1];}

t.p=t2.p;

t.r=t2.r

if(t.s<=x) //if expected ack no larger than recieved ack

t.s=x+1; for(j=0,j

t.chf[t2.sizef+j] = t.s + j + 4; //moving window base forward

t.sizef ++;

} }

//sender loses ack

Generate_state{

if(t2.sizeb>0)

{

new T.t; //create new table to save new state

x=chb[0]; //first element in backward channel queue

t.sizef=t2.sizef

t.sizeb=t2.sizeb-1;

t.chf=t2.chf

for(i=0, i

{t.chb[i]=t2.chb[i+1];}

t.p=t2.p;

t.r=t2.r; //The status of receiver and sender will not

t.s=t2.s; //change

t.p++; //error rate will increase

}

}

//receiver receive message

Generate_state{

if(t2.sizef>0)

{

new T.t; //create new table to save new state

x=chf[0]; //first element in forward channel queue

t.sizef=t2.sizef-1; t.sizeb=t2.sizeb;

t.chb=t2.chb;

for(i=0, i

{t.chf[i]=t2.chf[i+1];}

t.p=t2.p;

t.s=t2.s;

t.r=t2.r;

if(t.r=x) // expect message equal to message channel t.r++; //receiver expected number +1 t.chb[t.sizeb+1] = x; t.sizeb ++;

}

}

//receiver lose message

Generate_state{

if(t2.sizef>0)

{ new T.t //create new table to save new state x=chf[0] // first element in forward channel queue t.sizef=t2.sizef-1 t.sizeb=t2.sizeb t.chb=t2.chb for(i=0, i

{t.chf[i]=t2.chf[i+1]} t.p=t2.p t.s=t2.s t.r=r2.r }

}

if(t2.chf==NULL && t2.chb==NULL) //timeout

{

t=t2;

for (i=0, i<4,i=++)

{t1.chf[i]=t2.s+i;}

}

We finish our design by using the above pseudo code. We design four functions and timeout for different cases which would happen in the GBN protocol. The first one is when the sender correctly receive the ACK which is no less than the expected value. The second one is when the receiver receives the message. The following two are error statuses, losing the message or ack. The last one is timeout case when both of forward channel and backward channel are empty.

7. If messages are transmitted on the average of once every second, what is the lower bound on the average time between protocol failures.

For the last problem of this GBN design requirement, there would have no protocol failure in our design. In our program, if there’s no stop-points, the program will continue to implement the whole sequence in GBN protocol. Since there’s no deadlock in this design, protocol failure would not happen.

Recommended publications