The algorithm for the initialization
Interface
Data Structures:
L : List of co-ordinators forming the ARC ring, each entry of the
list is of the
type id(N).
id(N) : Identity of the co-ordinator N.
info(N) : Information about co-ordinator N.
For any co-ordinator N that wishes to join the ARC ring :
-
Collect information info(N) about itself locally.
-
Send a broadcast request, ( REQ,info(N) ) in the system.
-
Wait while ( (time-out has not occured) AND (L is NULL for any reply,
( REPLY,L )) ).
-
If wait ended due to ( L not equal to NULL) then copy L onto a local
list.
-
If wait ended due to time-out, then do the following:
1) assume N to be
the first node.
2) Assign an id(N) to
N.
3) Create a list L containing
N only.
-
Obtain id(N) from L.
-
Send a message, (JOIN,id(N) ) to every other co-ordinator in the system.
For any co-ordinator C on receiving the broadcast request (REQ,info(N)
) from
co-ordinator N:
-
If C is the last co-ordinator in the ARC ring, then
1) Generate a new id and associate it with N. The new id generated
will be one more than the highest id assigned till now.
2) If N is not already included in the list L of all the existing
co-ordinators forming the ring, then include node N in the local list L.
( The presence of co-ordinator N in the list L is checked by
finding if the name of the co-ordinator is present in the list L.)
3)
Send reply (REPLY,L) to N.
-
If C is not the last co-ordinator in the ARC ring, send a reply
(REPLY,NULL) to N.
If C = N then ignore the request.
For any co-ordinator C on receiving the join message (JOIN,id(N)
) from node N:
-
If C = N, then do nothing.
-
Else include co-ordinator N in the local list L of C.
-
Find the next node, M in the ring that should be monitored.
-
Put the id of M in the message queue.
-
Send a SIGUSR1 signal to the timer process, to tell that it should
now start monitoring co-ordinator M.