Research Article

Optimizing Resource Discovery Technique in the P2P Grid Systems

Algorithm 1

Pseudocode of the new discovery algorithm.
(1)q: new incoming query
(2)ClusterResource: a resource in cluster
(3)Cache: a query result in cache table
(4)BestNeighbor: a neighbor super‐peer selected by goodness function
(5)Neighbor: next neighbor super‐peer
(6)for incoming q do
(7)ClusterResource = MatchQueryClusterResource (q)
(8)if (ClusterResource = = null) then
(9) Cache = MatchQueryCache (q)
(10)  if (Cache = = null) then
(11)  BestNeighbor = HRI (q, Neighbor)
(12)   if (BestNeighbor = = null) then
(13)   Receiver = Sender (q)
(14)   else
(15)   Receiver = BestNeighbor
(16)   end if
(17)  ForwardQueryToReceiver (q, Receiver)
(18)  else
(19)  SendResponseToRequester (q)
(20)  end if
(21)else
(22)SendResponseToRequester (q)
(23)Store/UpdateResultToCache (q)
(24)Send update to Neighbor
(25)end if
(26)end for