分布式计算-Finn算法

1、进程P维持进程标识的两个集合,Incp和NIncp。Incp是进程q的集合,满足:q中的事件在p中最近事件之前发生,NIncp是进程q的集合,满足对于所有q的近邻r,r中的事件在p中最近事件之前发生。

2、算法

var Incp  :set of processes init {p};

      NIncp:set of processes init φ;

      recp[q] :boolean for q∈Inp init false;

begin if p is initiator then

          forall r∈Outp do send <sets,Incp,NIncp> to r;

     while Incp≠NIncp do

              begin receive <sets,Inc,NInc> from q0;

                        Incp:=Incp∪Inc;NIncp:=NIncp∪NInc;

                        recp[q0]:=true;

                        if 所有的q∈Inp:recp[q] then NIncp:=NIncp∪{p}

                        if Incp or NIcp has changed then

                              forall r∈Outp do send <sets,Incp,NIncp> to r

              end;

   decide

end

你可能感兴趣的:(算法)