Algorithm as in the one-on-group simulation applet.

This version of the one-on-group communication algortihm is used in the interface of the one-on-group simulation. The purpose of this algorithm is to give insight in the simulation that shows how the sliding window and the acknowledgement mechanism works. It is a simplified version of the general algorithm and the incoming and outgoing packages side of the algorithm for the sender are combined to one algorithm for the sender. The same is the case for the algorithm for the receiver. The form of the packages used in the simulation are simplified as wel. The form of the packages of the general algorithm:

Ksource(destination,checksum,group,position,window_size,data)

has been reduced to:

(position,data,destination).

An explanation of the fields that are used in this version of the algorithm.

position position of the data from the input tape;
data data that has to be transmitted;
destination destination port of package [S,Ri].

Sender

1   windowSize:=4
     {Initialize the the size of the window.}
2   offset:=0
     {Initialize the first position of the window.}
3   while true
     {While true, start sending the tape ... [18]}
4   do i:=offset
     {Set pointer at the offset of the window.}
5       while not (i=offset+windowSize)
         {While the pointer is not at the end of the window ... [16]}
6       do read(i,x)
         {... read the package from the window at postion '1'.}
7           if not (i,@,r1) then send(i,x,r1)
             {If r1 did not acknowledge package 'i', (re)send the package.}
8           if not (i,@,r2) then send(i,x,r2)
             {If r2 did not acknowledge package 'i', (re)send the package.}
9           if not (i,@,r3) then send(i,x,r3)
             {If r3 did not acknowledge package 'i', (re)send the package.}
10          i:=i+1
             {Increment pointer 'i'.}
11          max:=HighestAckAllReceivers()
             {Calculate the highest common consecutive acknowledgement.}
12          if offset_windowSize = max+1
             {If all packages from the window have been acknowledged ...}
13          then offset:=offset_WindowSize
             {... slide the window ...}
14              1:=offset
                 {... set the pointer at the beginning of the slided window.}
15          end
             {... window has moved one windowSize up.}
16      end
         {[5] ... packages of the window have been (re)sent.}
17      waitlong
         {Wait a while for acknowledgements end start (re)sending.}
18  end
     {[3] ... end.}

Receiver 1

1   when received(0,x,r1)
     {The first package has been received.}
2   lastAck:= 0
     {Initialize the highest consecutive received package.}
3   while true
     {While true ... [10]}
4   do write(lastAck,x,_)
     {Write the received package to your output tape.}
5       while not(received(lastAck+1,x,r1))
         {While not received the next package ...}
6       do waitshort
         {.. wait a while ...}
7           send(lastAck,@,s)
             {.. (re)send acknowledgement of highest consecutive recieved package.}
8       end
         {Next package hs been received.}
9       lastAck:=lastAck+1
         {Increment acknowledgement.}
10  end
     {[3] ... end.}

Receiver 2 and 3

The algorithms for receiver 2 and 3 are analogous to the algorithm for receiver 1