.

Huang’s Algorithm Assignment Help

Huang's algorithm is an algorithm with regard to detecting termination in a distributed system. The algorithm had been proposed by Shing-Tsaan Huang in 1989 in the Journal associated with Computers.

Huang’s Algorithm :

  • One controlling agent, has weight 1 initially
  • All additional processes tend to be idle initially and it has weight 0
  • Computation starts whenever controlling agent sends a computation message to some process
  • An idle process gets active on receiving the computation message
  • B(DW) – computation information along with weight DW. Could be sent only through the controlling agent or even an active process
  • C(DW) – control information along with weight DW, sent through active processes to controlling agent when they tend to be about to become idle

Let current weight at process = W

  • Send of B( DW ) :
    • Find W1, W2 such that W1 > 0, W2 > 0, W1 + W2 = W
    • Set W = W1 and send B( W2 )
  • Receive of B( DW ) :
    • W += DW;
    • if idle, become active
  • Send of C( DW ) :
    • send C( W ) to controlling agent
    • Become idle
  • Receive of C( DW ) :
    • W += DW
    • if W = 1, declare termination
.