**3. Our proposed method**

Here, we introduce a weighted tree structure for resource discovery. In this method, like (Chang & Hu, 2010) (explain in previous section) we use one bitmap except several bitmaps will replace one bitmap with different contents. In the current method, we will allocate to any kind of resource two positions of bitmap, where one of them is the ''counter'' and another is the ''path''. A user's request should be changed into this form. There will be one bitmap in every node in which the user's query will be multiplied by this bitmap position to a position in order that the availability of matched resources would be investigated. If the current node contains the requested resource, so the requested resource is found, otherwise if it does not contain the requested resource or have the requested resource in its children and descendant, the query will be sent to the father node. However, if the node does not contain the requested resource but it is available in one of its children or descendant, the target node can be found directly and without any referring to extra nodes using the information stored in this node and weighted edges. Therefore, our offered method decreases unnecessary referrals to other nodes and reduces the additional traffic, so the time is saved and the ability of resource discovery is improved.

Due to the existence of different resources in the grid environment and also the various types of resources (attributes), the resources and their attributes should be identified in our bitmap. This bitmap has positions that numbers will be stored in. The length of the bitmap depends on the attributes of each resource. For example, if our expected resource is an operating system (OS), the different types of operating systems that are used in our grid environment determine the length of our bitmap. If the types of operating systems are XP, Linux, Unix and MacOS, our bitmap will have six positions. Actually, we allocate two positions for each type in the bitmap: the counter and path. All of the users' queries should be transformed into this form. Fig. 1, shows a sample of this bitmap that contains the XP operating system in the related node.

A New Approach to Resource Discovery in Grid Computing 75

second position which is the counter, increased by two units, namely it would be 2 (increased two units because the weights of node E are two bits). Finally, two numbers, 2

and 1 are registered in the first two positions of node E.

Fig. 2. Our proposed tree before gathering the children information.

are registered in the second two positions of node E.

two positions remain as 0 and 1.

Now the next two positions of nodes J, K and L are surveyed (related to the Linux operating system). Two positions related to node K, are 0 0, and nodes J and L are 0 1, meaning that nodes J and L own this resource and the information of one of these resources should be registered in the bitmap of the father node (E). In our method, any one whose counter shows a small number indicates an association with higher levels of the tree. In this case both of them are equal, so we choose one of them randomly (node J). Finally, two numbers, 2 and 0

In the next two positions, because node E owns this resource, there is no need for the resource information of children to be replaced by its own resource information. So, these

The remaining nodes are made in this way using the suggested method. We show in Fig. 3,

all related information and our resource discovery tree is formed as mentioned.

Fig. 1. A sample of OS type bitmap.

A node having a special resource locates the numbers 01 in two related positions. Number 0 is for counter and because this resource exists in the node itself, so the number would be 0 and the next one (Number 1) indicates the availability of resources in this node (path). Another position would be 0 indicating that no resources would be available in the node or its children. Each node in our tree contains such a bitmap at the first step and in the next steps the contents of these positions will be changed.

Our algorithm would be on a tree in which a weight will be allocated to any edge by the father nodes, i.e. each node allocates a special binary number to each child depending on the number of children. This node can determine the number of weight bits using following simple formula:

$$y = \left\lceil \log\_2^n \right\rceil$$

where n is the number of children of this node, and y is at least the number of bits that should be allocated to edges as weight.

In Fig. 2, we show a weighted tree with its nodes and local resources which is regarded as the first step in constructing a weighted tree with local resources of nodes without considering the resources of children. In Fig. 3, we show same tree after gathering the children information by the father nodes which is the final form of the resource discovery tree. Now we describe the construction of the final form of a tree with an example.

Suppose that our expected resource is an operating system (OS) as Fig. 1, depicts. Each pair position is representative of one type of resource (which here is one type of OS). In Fig. 2, node K has operating system XP (01 in the last two positions), node J has operating system Linux, node F has operating system MacOS etc. The weight of edges is also written on the edges. As said before, these weights, for example 0 between node A and node B is a number in which node A is considered for node B in its memory. Now these nodes should form the final form of the tree in order that the users' requested resources can be found.

For example, we explain the method of gathering information of children and construct the final form of the bitmap in node E. First consider nodes J, K and L. Node E as the father node, takes bitmaps of these three nodes, and analysis them, storing the final information on its bitmap. Suppose that node E takes the information of nodes J, K and L. First we begin from lower positions (from right to left). The first pair position of nodes J, K and L are removed. Two of them contain 00 and the other one contains 01, node E itself has 00, so there is only one resource that is located in node K, which should be registered in the first pair position of node E. Because this resource information is received through a path with weight 01, so we write in the first position the path that the resource information comes from, i.e. 01. We transform this binary number to a decimal number and then record. If the 74 Grid Computing – Technology and Applications, Widespread Coverage and New Horizons

A node having a special resource locates the numbers 01 in two related positions. Number 0 is for counter and because this resource exists in the node itself, so the number would be 0 and the next one (Number 1) indicates the availability of resources in this node (path). Another position would be 0 indicating that no resources would be available in the node or its children. Each node in our tree contains such a bitmap at the first step and in the next

Our algorithm would be on a tree in which a weight will be allocated to any edge by the father nodes, i.e. each node allocates a special binary number to each child depending on the number of children. This node can determine the number of weight bits using following

<sup>2</sup> log*<sup>n</sup> <sup>y</sup>*

where n is the number of children of this node, and y is at least the number of bits that

In Fig. 2, we show a weighted tree with its nodes and local resources which is regarded as the first step in constructing a weighted tree with local resources of nodes without considering the resources of children. In Fig. 3, we show same tree after gathering the children information by the father nodes which is the final form of the resource discovery

Suppose that our expected resource is an operating system (OS) as Fig. 1, depicts. Each pair position is representative of one type of resource (which here is one type of OS). In Fig. 2, node K has operating system XP (01 in the last two positions), node J has operating system Linux, node F has operating system MacOS etc. The weight of edges is also written on the edges. As said before, these weights, for example 0 between node A and node B is a number in which node A is considered for node B in its memory. Now these nodes should form the

For example, we explain the method of gathering information of children and construct the final form of the bitmap in node E. First consider nodes J, K and L. Node E as the father node, takes bitmaps of these three nodes, and analysis them, storing the final information on its bitmap. Suppose that node E takes the information of nodes J, K and L. First we begin from lower positions (from right to left). The first pair position of nodes J, K and L are removed. Two of them contain 00 and the other one contains 01, node E itself has 00, so there is only one resource that is located in node K, which should be registered in the first pair position of node E. Because this resource information is received through a path with weight 01, so we write in the first position the path that the resource information comes from, i.e. 01. We transform this binary number to a decimal number and then record. If the

tree. Now we describe the construction of the final form of a tree with an example.

final form of the tree in order that the users' requested resources can be found.

Fig. 1. A sample of OS type bitmap.

should be allocated to edges as weight.

simple formula:

steps the contents of these positions will be changed.

second position which is the counter, increased by two units, namely it would be 2 (increased two units because the weights of node E are two bits). Finally, two numbers, 2 and 1 are registered in the first two positions of node E.

Fig. 2. Our proposed tree before gathering the children information.

Now the next two positions of nodes J, K and L are surveyed (related to the Linux operating system). Two positions related to node K, are 0 0, and nodes J and L are 0 1, meaning that nodes J and L own this resource and the information of one of these resources should be registered in the bitmap of the father node (E). In our method, any one whose counter shows a small number indicates an association with higher levels of the tree. In this case both of them are equal, so we choose one of them randomly (node J). Finally, two numbers, 2 and 0 are registered in the second two positions of node E.

In the next two positions, because node E owns this resource, there is no need for the resource information of children to be replaced by its own resource information. So, these two positions remain as 0 and 1.

The remaining nodes are made in this way using the suggested method. We show in Fig. 3, all related information and our resource discovery tree is formed as mentioned.

A New Approach to Resource Discovery in Grid Computing 77

Suppose in this example, the query is first sent to node H. All positions are multiplied with each other and the result would be 0. So, the request will be sent to its father node i.e. C (as Fig. 5). In node C, all positions of request are multiplied with the stored bitmap in this node and the result again would be 0. So the request will be sent to its father node i.e. A. It is observed that the result of multiplication in the node would be the numbers except 0 (5 5). So, number 5 should be changed into a binary number with length 5 so the result is 00101. Using this binary number, we can directly obtain the node which contains the requested resource; the binary number is taken through left to right and goes forward in the edges of the path. The result node would be the target node. Fig. 5 shows this search which resulted in the resource discovery in node K. As soon as a number except zero is achieved, we can directly refer to the

destination node without any referring to an extra and unnecessary node.

Fig. 5. An example of resource discovery in our weighted tree.

In the current method, the weight of edges in each node is identified and after changing into

The method can be corrected in a real grid environment, because if we suppose a real grid environment with many nodes and edges, the number of 0 and 1s which are to be attached

**3.2 Improvement the method in a real grid environment** 

a decimal number, they are stored in their related places.

Fig. 3. Our proposed tree after gathering the children information.
