• Aucun résultat trouvé

Composition properties and its natural effects

Synchronization protocols for sharing resources in grid

2.5 Composition properties and its natural effects

In order to show how much our composition approach reduces both the number of messages exchanged between application processes and the delay for a process to get access to the critical section, we are going to discuss an ex-ample of an application execution that uses our mutual exclusion composition protocol. Figure 2.5 shows such an example. It consists of a Grid composed of four three-node clusters. Each cluster ihas two application nodes Ai and Bi and one coordinator nodeCi. For the sake of simplicity, we consider that a token-based mutual exclusion algorithm that broadcast requests, such as Suzuki-Kasami algorithm [Suzuki and Kasami, 1985 ] (see Section 2.2), runs on both theintraandinterlevels of the composition. All the effects described below then correspond to the gain in terms of number of messages and/or ac-cess waiting time of the composition protocol when compared to the original broadcast request mutual exclusion algorithm, i.e., if the latter, called theflat algorithm, was executed by all processes without a composition approach.

As we can observe in Figure 2.5(a), at the beginning of the execution, node A1 keeps the intratoken of cluster 1 and the coordinatorC1 keeps theinter token. Intratokens of clusters 2, 3, and 4 are respectively held by coordinators C2,C3, andC4.

2.5.1 Filtering and aggregation

Suppose that nodeB3 wants to execute the critical section. It then broad-casts its request atintralevel to all the nodes of its own cluster including the local coordinatorC3(Figure 2.5(b)). Upon receiving the request,C3 changes its state to W AIT F OR IN, forwards the request to all other coordinators and waits for theintertoken. Only the coordinatorC1will forward the request to the applicationnodes of its cluster by calling the CS Request ()operation of itsintraalgorithm. The other coordinatorsC2andC4will do nothing since they are in theOU T state and none of theapplication nodesof their clusters are in the critical section. The request was not broadcast in these two clusters and thus the number ofintracluster sent messages is reduced when compared to the flat algorithm. We denote such intra cluster message reduction the natural filtering effectof the composition.

A second effect of the composition is the natural aggregation of the intra requests. Before nodeB3 gets theintra token, suppose that nodeB2

calls theCS Request()operation (Figure 2.5(c)). Hence, a request message is broadcast to all nodes of its cluster. When the coordinatorC2 receives the request, it forwards it to the other nodes of its cluster. However, since the coordinatorC1 is already in theW AIT F OR OU T state due toB3 request, it will not broadcast the request inside its cluster. Moreover, the request will not be broadcast inside those clusters where there is no node executing the

44 Fundamentals of Grid Computing

(b) Natural filtering of the requests

C1

(f) Granting the token in the order of re-quests

FIGURE 2.5: Example of execution.

Synchronization protocols for sharing resources in grid environments 45 critical, i.e., clustersC3 andC4.

Finally, suppose that a second application node of cluster 3, A3, also de-cides to ask for the critical section. We observe in Figure 2.5(d) that the request is not broadcast at the interlevel of the composition. This happens because the coordinatorC3is in theW AIT F OR IN state which means that it has already sent a previousinter request which has not been satisfied yet.

Therefore, the composition approach naturally aggregates requests inside the same cluster which reduces the number ofintercluster messages. This effect is named thenatural aggregation of the inter requests.

2.5.2 Preemption and structural effects

If we consider the previous execution, there are three concurrent pending requests which were respectively issued byB3,B2, andA3. In the originalflat algorithm, the requests would be satisfied in the order, i.e., firstB3’s request, thenB2’s request, and finallyA3’s request. However, such an order forces the token to cross clusters (Figure 2.5(f)): from cluster 1 to cluster 3 when A1

grants the token toB3, from cluster 3 to cluster 2 whenB3 grants the token to B2, and back to cluster 3 when B2 grants the token to A3. The round trip time for the token’s travel between cluster 2 and 3 considerably increases the time for a process to get access to the critical section. Contrarily to the delay of a token request which can be overlapped by the duration of a critical section execution, no process can execute a critical section during the token transfer. Hence, reducing the delay of a token transfer has a direct impact on the overall performance of the algorithm since the time during which a node waits for the token will decrease as well.

Our composition protocol behaves differently (see Figure 2.5(e)). The hi-erarchy of algorithms naturally reorder the requests, giving priority to lo-cal requests over remote ones. When node A1 ends its critical section, it calls CS Release() and grants the intra token to C1 which in its turn sends the inter token to C3 by calling the CS Release() of the inter algorithm.

The coordinator C3 then grants the intra token of cluster 3 to node B3

(by calling CS Release() of the intra algorithm) and changes its state from W AIT F OR IN toIN. At the same time, thanks to the coordinatorC2,C3 knows that there is a pending request fromB2, as explained above. Therefore, by calling theCS Request()operation of theintraalgorithm,C3broadcasts a request to all nodes of its cluster 3 in order to get the intra token. C3 then changes its states toW AIT F OR OU T state.

Notice that when node B3 ends its critical section, there are two pending requests: one fromA3and another fromC3. By keeping the order of reception of requests, B3 grants the intra token to A3 since it receivedA3’s requests before C3’s request. This means that without changing the original intra algorithm, the request of A3 will be satisfied before the request of B2 thus avoiding the aforementioned round trip travel time of theintertoken between clusters 2 and 3. At the end of the critical section,A3grants theintratoken to

46 Fundamentals of Grid Computing

C3, since requests are satisfied in order. Having theintratoken,C3grants the intertoken toC2by calling theCS Release()operation of theinteralgorithm.

Then, the nodes of cluster 2 can execute their critical section, i.e.,B2 in this example.

The reordering of the critical section accesses is due to the composition approach which prioritizes all the local requests of a cluster as soon as the latter gets theintertoken. This mechanism optimizes the requests scheduling and can be seen as a “natural” scheduler because local requests preempt the critical section accesses over remote application node requests. Based on system taxonomy, we will refer to it as the‘‘natural” preemption effect of the composition.

2.5.3 Natural effects of composition

Based on the previous example, we have discussed the effects induced by the mutual exclusion synchronization composition protocol. These effects are not due to the mechanisms added to coordinate at the different levels but they are a consequence of both the inherent hierarchical topology of the Grid and the use of coordinator processes. For these very reasons, we qualify them as “natural effects.” These effects either reduce the number of sent messages or the time for a process to get to the CS.

Some of the above explained effects significantly reduce the mean number of sent messages which are required to get the critical section:

Natural filter effect: requests are broadcast only in the last cluster which has executed the CS.

Natural aggregation ofinter requests: there is at most one broad-cast in theinteralgorithm for multiple concurrent requests issued from applicationnodes of the same cluster.

Natural aggregation of the intra requests: inside the last cluster which has executed the CS, there is at most one broadcast of theintra algorithm of this cluster for all the requests forwarded by the other clusters.

The other effects directly reduce the mean CS access delay:

Natural preemption: all pending requests of a cluster will be satisfied before the coordinator takes back theintratoken and releases theinter token.

Structural effect: In theflat algorithms, the delay for anapplication process to obtain the CS is proportional to the number of nodes of the whole system. On the other hand, the hierarchical structure of the Grid naturally reduces the number of application nodes in each instance of the algorithms. Therefore, the mentioned delay is reduced.

Synchronization protocols for sharing resources in grid environments 47 In conclusion, all theses effects improve the performances of the application over the flat algorithms. However, the overload of the composition should be taken into account, i.e., coordinators add a latency time and processor consumption to the system. The next section compares and shows the real gain of the hierarchical compositions overflatalgorithms.