next up previous contents
Next: Implementation Up: System structure Previous: Message structure   Contents

Node Process Control Block (PCB) and local variables

PCB structure
Each node has some standard local information included in a C structure called PCB. Node i can refer to its PCB as PCB[i] in a protocol. The format of the PCB is presented below.

    typedef  struct  {
           int      state ; (*)
           int      id ; (*)
           int      adjacents; (*)
           PORT     *adjust ;
           int      step_dur [3] ;
           MESSAGE  *mes_buf ;
           TIMER    clock[5] ;
           int      loc_clock ;
           double   dr_loc_clock ;
           int      wake_time ;
           int      sy_init_time ;
           int      dpq ;
           double   dr_dpq ;
           int      step ;
           int      cycle ;
           int      idle ;
           int      init_time ;
    }  PCBS ;

Local Variables
Each node may contain some protocol-defined local variables. These variables must be given by the user, in the action file (cf. section on protocol creation), as a C structure e.g.

          typedef struct {
                int parent ;
                LIST ack ;
                .......
          } REGISTERS ;

          REGISTERS *REG ;
Each node i can then refer to its local variable parent as REG[i].parent

These local variables may be initialized in a procedure init() and must be allocated enough memory for them in a procedure reg_alloc() (these should be taken care of in the action file, at the creation of the protocol; cf. section on protocol creation) e.g.


          reg_alloc()
          {
              REG = (REGISTERS *)malloc (processes * sizeof (REGISTERS));
          }

Global Variables and Structures
There are also some read-only globle variables most of which are regularly used by the user.

Moreover, there are also available routines in LYDIAN which are useful for the user (see Section 7.2

Now, we have enough information to implement the protocol of the Broadcast with ACK algorithm.


next up previous contents
Next: Implementation Up: System structure Previous: Message structure   Contents
Ha Hoai Phuong
2002-11-11