next up previous contents
Next: System structure Up: Making new protocols Previous: Making new protocols   Contents

Design

From the algorithm, we need to identify how many external events can affect each process and how many states the process could have under these effects. For instance, the external events can be timeout interrupt or receiving a message, but not sending a message. Then, we make a table where the rows and columns correspond to the external affecting events and the states of the process, respectively.

  $state_1$ $state_2$ ... $state_n$
$event_1$        
$event_2$        
...        
$event_m$        

At the cell [$event_i$, $state_j$] the actions the process must do when its state is $state_j$ and it is affected by $event_i$ are filled in. The actions should be written in pseudo-code. After filling the table up, the algorithm becomes more clear to implement: each cell in the table is a procedure in the protocol source code. Of course, if two cells have the same content, only one procedure is enough. From the table, we can also identify how many local variables are necessary for each process.

For instance, from the Broadcast with ACK algorithm description in Section 3.2.1, we realize that there are at least two events: receiving a broadcast message and receiving a ACK message and two states: sleeping at the beginning and waiting for ACK messages. Therefore, we have the following table


Table 1: The design of algorithm Broadcast with ACK
  SLEEPING
WAITING DONE
BRD
if (the process is leaf) {reply with ACK; new_state=DONE;}
parent = sender;
send BRD to all other adjacent processes;
store receivers in set ack;
new_state = WAITING;
reply with ACK;

reply with ACK;
ACK Never delete sender from ack;
if(( ack == empty) and (parent != -1))
{send ACK to parent; new_state = DONE;}
if(( ack == empty) and (parent == -1)) finished!;
Never


Now, the design step where the algorithm is changed into clearer form is completed. However, to implement a protocol, the we needs to know which information he can get from system and which system variables we can use to implement our own protocol. Therefore, the next subsection will introduce available system information in LYDIAN, which is useful for users.


next up previous contents
Next: System structure Up: Making new protocols Previous: Making new protocols   Contents
Ha Hoai Phuong
2002-11-11