• No results found

Token-based mutual exclusion using other logical structures

In document Distributed System Design (Page 136-139)

Mutual Exclusion and Election Algorithms

3. Response time, measured by the interval a process issues a request and the process exits the CS

4.3 Token-based Solutions

4.3.4 Token-based mutual exclusion using other logical structures

Other than ring structures for token-based mutual exclusion, graph and tree structures are also frequently used. In graph-based algorithms [34] processes are arranged as a directed graph with a sink node holding the token. A request for token and token propagation are handled in a similar way as in tree-based

algorithms shown below.

In tree-based approaches [36] processes are arranged as a directed tree with the root node holding the token. A request for token propagates serially along a path from the requester to the root. The token is passed serially from the root to the requester and the token traverses the edges in the path from the root to the requester; meanwhile, the direction of the edges along the path is reversed so that the requester becomes the new root of the tree. Figure 4.6 (a) shows a request from a leave node to the root node.

Figure 4.6 (b) shows the corresponding result after the root passes its token to the leave (new root). As shown in Figure 4.6 (b) each node in the new tree can still send its request along a directed path that leads to the node holding the token.

Figure 4.6 A tree-based mutual exclusion algorithm.

A general scheme for token- and tree-based mutual exclusion algorithms was proposed in [22]. A survey on distributed mutual exclusion can be found in [46].

4.3.4.1 Other related issues

Most of the algorithms discussed strive to minimize message complexity. Some researchers argue that time complexity, in terms of synchronization delay, is also important. For example, Lamport’s algorithm needs 3(n - 1) messages and two time units delay. Maekawa’s algorithm requires only messages and two time units delay to enter the CS; however, it needs one more time delay to release the locked site before it can send a reply message to one of the requesting processes. Chang [10] studied the problem of minimizing both messages and time complexity at the same time. The approach used is a hybrid distributed mutual exclusion algorithm that combines several algorithms. Goscinski [19]

proposed two mutual exclusion algorithms which are suitable for an environment requiring priorities such as a real-time system. Algorithms together with rigorous proofs can be found in [7] and [23].

Distributed mutual exclusion can be also achieved by bidding [8], [47], election [17], and self-stabilization [14], all of which will be discussed in the subsequent sections.

4.4 Election

Election [17] is a general style of computation in distributed systems in which one process from the process set is selected to perform a particular task. For example, after a failure occurs in a distributed

system, it is often necessary to reorganize the active nodes so that they can continue to perform a useful task. The first step in such a reorganization or reconfiguration is to elect a coordinator to manage the operation. The detection of a failure is normally based on a time-out. A process that gets no response from the leader for a period of time suspects a failure of the coordinator and initiates an election process.

Applications of elections can be found in the following areas [25]: (1) group server, (2) load balancing, (3) replicated data updating, (4) crash recovery, (5) joining group, and (6) mutual exclusion.

Different distributed election algorithms have been proposed based on the type of topology used:

complete graph, ring, and tree. These algorithms can also be classified based on the type of network used: (1) Store-and-forward networks, including unidirectional rings [9], [15], [35]; bidirectional rings [16]; complete graphs [6], [26]; trees [12], [36]; and chordal rings [33]. (2) Broadcast networks [25].

Normally two phases are used in an election process: (1) Select a leader with the highest priority and (2) inform other processes the leader (winner). In both phases process ids need to be distributed in the system and can be done either through point-to-point communication or through broadcasting.

Broadcasting can be easily done in a completely connected network. Otherwise, a spanning subgraph is constructed statically or dynamically. For example, if a unidirectional ring is used as a spanning

subgraph, messages are passed around the ring in both phases. Another commonly used spanning subgraph is a tree that can be statically selected or dynamically created.

Previous Table of Contents Next

Copyright © CRC Press LLC

Previous Table of Contents Next

If a spanning tree is known a priori, all leave nodes start the election process and push their ids upwards to their ancestors with only the highest priority one surviving along each path to the root. The first phase is completed when the highest priority id reaches the root node. The second phase starts by broadcasting the winner’s id along the spanning tree from the root to all the leave nodes. If a spanning tree is

dynamically created, one process (the root) initiates the process of generating a spanning tree. This process terminates at each leave node. Then, each leave node starts an election process following the same procedure used for the static spanning tree case.

Most election algorithms are based on a global priority where each process (processor) is given a priority a priori. These algorithms are also called extrema-finding algorithms. The main argument against the extrema-finding algorithm is that when a leader is to be elected, that leader should ideally represent a good choice, e.g., from a performance or reliability standpoint. Recently, more work has been done on preference-based algorithms [45] where voting is more generally based on a, personal preference, e.g., locality, reliability estimation, etc. Also, priority may not be linearly ordered as in preference-based algorithms.

We consider here three types of extrema-finding algorithms. Chang and Roberts’ algorithm is based on the ring topology and each process is not aware of the priority of other processes. Garcia-Molina’s bully algorithm [17] is based on the completely connected topology and each process is aware of the priority of other processes. Both algorithms are comparison-based in which the leader is selected by comparing ids of all the processes and by sending and receiving ids in messages. The third type is non-comparison-based in which the messages are “coded” in time in terms of rounds (this type of algorithm only works in a synchronous system).

The similarity of election and mutual exclusion is rather obvious. Using election, all processes that intend to enter the critical section will compete through an election to decide which process should enter the critical section. The difference is that a mutual exclusion algorithm should ensure no starvation while an election algorithm is more concerned with a quick election process. Also, participating processes should be informed of the winner of an election. In a mutual exclusion algorithm the participating processes do not care who is currently in the critical section.

In document Distributed System Design (Page 136-139)