.

Monday, April 1, 2019

Performance Analysis Of Election Algorithm Computer Science Essay

Per beance Analysis Of alternative algorithmic ruleic programic programic curriculumic ruleic ruleic program Computer Science EssayDistri thated systems argon the systems consisting of multiple central solveors that connect finished a cyberspace to communicate. To manage the communication between unlike thickenings and the exchange of selective information between them, a draw among them is required.In our project we impose the various Election algorithms for choosing the loss attr goor in Distributed Systems thus firmness of purpose the coordinator option problem. We atomic tour 18 also compa basket the performance of each(prenominal) of these alternative algorithms. low gear we use the Election algorithms utilise the mental object passing interface(MPI). Then we metric and pard the performance of each of these resource algorithms and simulated the results. Fin eachy we modified the distributed drawing card election algorithm to suit the mobile ad-hoc m eshings.Key Words Distributed Systems Election algorithms Unidirectional environ algorithm Lelanns algorithm Chang Roberts algorithm two-way reverberance attracter election Mobile Adhoc NetworksIntroductionDistributed systemIt is a root of changeors where the memory or a quantify is not shargond. Every solveor has its own associated memory and the breeding is exchanged through communication networks.Distributed algorithmA distributed algorithm is an algorithm run on such a distributed system assuming the non-existence of central coordinator in these systems. So these algorithms require ane service to act as a coordinator. There is no port to select one of them to be drawing card if whole told the lickes argon similarly without different characteristics. One of the shapees has to take this special responsibility, no matter which puzzle out takes it.This problem in which a drawing card has to be elect is termed as the coordinator election problem that is how to choose a process among the different processors to restricttle it a central coordinator.Election algorithmAn election algorithm is utilise to solve the coordinator election problem in these distributed systems. Any election algorithm must be a distributed algorithm by the nature of the coordinator election problem. The most important feature in election algorithm is it assumes any process has a Unique ID. It votes a process from among the different processors which terminate act as the initiator, sequencer and monitor in detecting and solving smears like Deadlock, Mutual Exclusion etc. Thus electing a leader process has become a major issue in pumped up(p) and ad hoc networks.The goal of election algorithm is to see that when an election start outs it deaths with all processes by an capital of New Hampshire as who has to be the modern coordinator.ELECTION algorithmic program ON RINGS A fence is formed by the processes in bunch algorithm. In this each process channe ls only meanings to the next process in the ring.It eject be classified into two categoriesUnidirectionalBidirectionalThe substances are displace only in one direction in unidirectional and in both directions in Bidirectional ring algorithms.To compare the performance of these algorithms, the different criteria interpreted into consideration areTotal chassis of put acrosss passedComplexity of the marrows used eon elapsed by the algorithm2. instruction execution SoftwareWe have used the centre passing interface (MPI) for implementing our algorithms which are discussed below. It is a standard specification for communication through messages among different processes. It is free of any language. It is used in parallel computing to write programs for mathematical group and point to point communication between lymph thickenings.We used the C language to implement the election algorithms. The MPIs routines are nowadays callable in C. The master(prenominal) MPI calls used i n our program areMPI_Init Before communicating, all instances of the commandment should call this so as to prepare the MPI implementation for the communications environs.MPI_Finalize For exiting the communication, this is called by all the instances of the code.MPI_Comm_size To learn about the rate of processors which are using MPI environment to communicate, this routine is called.MPI_Comm_rank severally of this process assigns an integer to the communicating process.MPI_Send To circulate a message to another process, this is called.MPI_Recv This call allows to receive a message from a process.3. Unidirectional rebound AlgorithmsThe ring algorithm consists of processes arranged in the form of a ring consisting of a token. The token is passed between processes and the process which has the ring can send a message.The election problem can be implemented using the ring algorithmsLelanns algorithmChang Roberts algorithm3.1 LeLanns algorithmIn this we assume that all the processes are physically and logically ordered.In LeLanns algorithm whenever the coordinator is lost, the initiator sends a token to the other processes in the ring by adding its id. Nodes cannot initiate any messages once they receive the token. After circulating the token, if the process receives back its id thus it is chosen to be the leader since it knows that others cannot become leadership as it knows all the ids of the other processes and it has the least id. The message complexity of LeLanns algorithm is O(N2). algorithm ill-use 1 begin grade 2 send the token to neighbours with id of circulating(prenominal) process as iStep 3 add current process id j and forward to neighboursStep 4 if process P receives back its id thenStep 5 leader is PStep 6 else return nullStep 7 endcontent ComplexityEvery initiator sends N messages. So the flog case duration complexity is N2. The algorithm is implemented using MPI and the message complexity and quartetth dimension complexity given by the MPI program isNo.of processesMessages factual cartridge holder exploiter timeSystem time5251.1950.0250.023101001.2920.0270.024152251.4460.0300.027204001.5510.0340.030256251.6540.0360.030 tabul rotate 1 LeLanns algorithm3.2 Chang Roberts algorithmThis is similar to lelanns algorithm but with a little change. When a process receives a token with an id great than the current process id, it drops that particular token as that process cannot be a leader . Hence it forwards the token with an id little(prenominal) that itself. In this way it saves time by discarding the unwanted messages. The worst case message complexity of Chang Roberts algorithm is O(N2) and the average case message complexity is O(N logN).ALGORITHMStep 1 send message with identifier = I to other processesStep 2 if identifier J of current process I then send the message to neighbours with identifier IStep 3 else drop message with identifier I and send the message with identifier J to neighboursStep 4 continue th is process until a particular process receives back a message with its identifier.Step 5 if a process receives a message with its id then process= leader.Step 6 else return nullStep 7endMessage ComplexityThe best case time complexity is 2N-1. The process with largest id sends N messages and other N-1 processes send one message each. The algorithm is implemented using MPI and the message complexity and time complexity given by the MPI program is given in the turn off 2.No.of processesMessagesReal timeUser timeSystem time591.1890.0240.02310191.2990.0270.02415291.4120.0290.02620391.5310.0330.02825491.6500.0360.031 tabularize 2Robert Changs Best Case AlgorithmThe worst case time complexity is N(N+1)/2. The process with largest id sends N messages and other N-1 processes send messages from 1N-1.No.of processesMessagesReal timeUser timeSystem time5151.1860.0240.02310551.3010.0270.025151201.4140.0300.027202102.5110.0340.029253251.6540.0350.030Table 3 Robert Changs Worst Case Algorithm4. B idirectional anticipate Algorithms4.1 drawing card election algorithm for Bidirectional RingIn these biface ring algorithm messages can be sent or exchanged in any direction. We have used the algorithm mentioned in 2 An improved upperbound for distributed election in bidirectional rings of processors. J.Van Leeumen and R.B Tan. Distributed Computing(1987)2149-160 for implementing it with the MPI.The name (identifier) of a large processor is contained in the present ID which is maintained by the processor and a (Boolean) register DIR that has a direction on the ring in which there are processors that s bowl have a smaller processor up for election.A smaller candidate which is still alive when the messages( the ones having the name of a colossal candidate) are created, have them being sent out in its direction. Processors that begin a chase are known as ready, and the left over(p) all over processors are observant. To get rid of the smaller candidate and force agreement on th e larger candidate is the main idea behind a chase. After the current active processors have begun the chase, the observant processors basically relay race messages onwards unless they notice an unusual situation on the ring only. As the algorithm proceeds, there are two unusual situations that can swipe at the location of an observant processor. They are(i) The processor receives a message of the current phase, say through its left refer, that contains a value which is less than the current value in its ID register. The processor turns active, increments its phase enactment by 1, and initiates a chase with the value its current ID in the direction of the message that was received, i.e., out over its left link.(ii) Two messages of the same phase are received by the processor from pivotal directions. The processor turns active, increments its phase number by 1, and initiates a chase with the largest value contained in the two messages in the direction of the smallest. As the alg orithm proceeds, several active processors that can arise in a phase rapidly decreases, and at the end a single processor go out be left precisely. This processor exit be familiar that it receives two messages of the same phase from black eye directions that do same values and is elected because every it receives a message of the current phase with a value exactly alike to the one it sent out (and stored in its ID register) or it receives two messages of the same phase from opposite directions that hold same values. ALGORITHM 2The algorithm describes the actions of an arbitrary processor on a bidirectional ring with half-duplex golf links as required for electing a leader1) Initializationa) Let u be the executing processors realization number. Send message to both neighbors and phase number Pnum=0b) restrain for corresponding messages and to come in from two neighborsc) correspond u1 and u2 and desexualise ID to max(u1,u2)and Dir to the min(u1,u2) and goto bustling state else Observant state.2) ElectionA processor performs in either active or observant state.a) ActiveA processor enters the active state with some value v stored in its ID register and a phase number p. The phase number p is either stored in Pnum or it is an update stored in temporary register. The phase number Pnum is incremented by 1 and a message is sent in Dir direction and goes to observant state.b) ObservantIn this state a processor receives messages and passes them on, unless an unusual situation is observed that enables it to initiate a new phase.Receive messages from one or both directions. Discard any message received with p less than Pnum.i) If the number of messages left are zero then go to observant state.ii) If the number of messages left is one then Let the one message received be where necessarily p=PNUM.if p=PNUM thenv = IDgoto premisev DIR= direction from which the message was receivedgoto active statev IDbegingoto observantelsePNUM = pID =vDIR=the direction in which the message was going Send message to directionDIRgoto observantiii) If the number of messages left is one thenLet the two messages received be and ,necessarily from opposite directions and with p=PNUMif v1=v2Pnum = pgoto inaugurateelsev1=v2ID-=max(v1,v2)DIR=the direction of min(v1,v2)goto active3) InaugurationA slay to this lowest exam phase occurs when the algorithm terminates and the ID register contains the identity of the anomalous leader.Message complexityThe message complexity of the bidirectional algorithm is 1.44NlogN + O(N). MPI is used implementing the algorithm. The Time and message complexity given by the MPI program isNo.of processesMessagesReal timeUser timeSystem time5141.1860.0240.02210291.3020.0270.02415441.4170.0300.02620591.5340.0330.02825741.6610.0360.030Table 4 attracter election algorithm for Bidirectional Ring4.2 Leader election algorithm for Mobile Adhoc NetworksA mobile ad hoc network is dynamic in nature. It is composed of a plant of peer-to-pe er nodes, that exchanges the learning within the network through some radiocommunication channels directly or through a series of such links. A node is independent to hightail it a bend as there is no decided final topographic anatomy. The nodes move freely in a geographical reach and are loosely bounded by the transmission range of these wireless channels. Within its transmission range, a mobile node communicates with a muckle of nodes thus implying all of them have to be in a network. These set of nodes are also known as the neighbors of the communicating node. The mobile nodes act as intermediary routers to direct the packets between the source and the destination nodes (i.e., the set of neighbors). A node is designated as a leader to coordinate the information that brings to be exchanged among nodes and to be in charge of their data requirements. The identification problem of a leader is termed as the leader election problem.Why do we need to select this leader? When the nodes are set out, they form an adhoc network between them within which the whole communication finds. If the topology of the network changes dynamically, a node may suspend its communication with the old node, just like in distributed networks. So there has risen a need for a leader so that the maintenance of the network and the clock synchronization within it can be done. Also a new leader has to be chosen every time the members of the group are getting updated while communication is taking place.When the communicating nodes move freely and if they are not within the transmission range of each other, then the wireless network fails . Similarly the formation of wireless links happen only when the nodes which are separated and are too far and to communicate, move within the transmission range of one another. The network topology may change rapidly and unpredictably over time since the nodes are mobile. So developing efficient distributed algorithm for adhoc networks is a challeng ing work to be done. The largest identity node is chosen to be the leader using token(prenominal) wireless messages in this approach. A mobile ad hoc network can be considered as a static network with frequent link or node failures, which can be thought of as a mobile node of an adhoc network going out of reach. To cover all the nodes in the network we use the diameter concept. While distance is set forth as the shortest path between the nodes, diameter is defined as the time-consuming distance between any two nodes in the network. The number of record hop result be the interpreted for measuring the distance and the assumption is that the network becomes stable subsequently a change happens during leader election process and there are only a limited number of changes in the network.A network having N nodes are considered here. Since the topological changes are considered during the leader election, this algorithm takes more than diameter rounds to terminate. If however, the top ological changes are not considered diameter rounds are taken to elect the leader. We have used the algorithm mentioned in 3An Efficient Leader Election Algorithm for Mobile Adhoc Networks Pradeep Parvathipuram1, Vijay Kumar1, and Gi-Chul Yang2 for implementing it with the MPI.Leader ElectionEach node parcel outs its unique identifier to its neighbors and a utmost identifier is elected as a leader in every round. This maximum identifier is propagated in the subsequent rounds. All the rounds need to be synchronized. idlist (i) identifies identifier list for node i, which consists of all the neighbors for node i. Lid(i) =max(idlist(i))TerminationAt (rounds = diameter), for each node i, If all identifiers in idlist are the same(i) the node i stops sending the maximum identifier further and chooses the maximum identifier in the idlist(i) as the leader. The algorithm gets terminated if for each node i the elements in idlist (for each node) are the same. The termination may not be at th e final part of the diameter rounds, If all identifiers in the idlist as the leader.ALGORITHM 3Each node i in the network has two componentsa) idlist identifier listb) Lid(i) leader id of node i.1) Each node say node i transmits its unique identifier in the first round and Lid(i) in the subsequent rounds to their neighbors and all these ids will be stored in idlist. Lid(i) = max (idlist(i))2) A unique leader is elected in diameter rounds, if there are no topological changes in the network. The algorithm is modified to incorporate topological changes in between the rounds and below is the description of howthe algorithm is modified.Case 1If a node has no outgoing links then lid(i) = iCase 2If a node leaves between the rounds, then the neighbors would know this. Suppose node i leaves the network after round r and let its neighbors be j and k. neighbors of i (i.e. j, k).1) edit (ilist, idlist(j k)) // delete ilist from idlist ilist contains the group of identifiers that node i has sent to its neighbors before round r along with i The ilist information is also deleted from all the neighbors of j and k if the ilist identifiers have been propagated in the previous rounds. This process continues until all the nodes in the network are covered.2) Repeat while (round = diameter), //Termination conditionCompare all the identifiers present in idlist(i) for each node i. If all the identifiers in idlist(i) are equal, node i stops propagating its maximum identifier and elects the maximum identifier as the leader.Case 3If a new node i joins the network in between the rounds say round r then the neighbors will update its idlist.1) If neighbors of i say node j is the neighbor for node i. Add (i,idlist(j))The normal algorithm continues (the ids are propagated), nodes keep exchanging the information till diameter rounds.2) Repeat while (round = diameter),For all nodes in the network (node j) receives an identifier i at diameter round. IF i is greater than the maximum identi fier node j has propagated in the previous round (diameter-1).a) Propagate node i to all the neighbors of j.b) Also propagate the node i information to all the neighbors of neighbors i until the whole network is covered, if the above condition satisfies.Else do not propagate the information to nodes in the networki) Compare all the identifiers present in idlist(i) If all the identifiers in idlist(i) are equal, node i stops propagating its maximum identifier and elects the maximum identifier as the leader.ii) All nodes in the network follow this process and a unique leader is elected connected component.The time taken for the algorithm to elect a leader will be O (diam + t) where t is the time taken for all the nodes to converge and t depends on the topology changes.Message complexityThe message complexity of this algorithm depends on the number of rounds. In each round it sends 2N messages if we consider a ring topology as every node has 2 neighbors. So message complexity is 2N* No. of rounds. This algorithm is implemented using MPI and the message complexity and time complexity given by the MPI program isNo.of processesMessagesReal timeUser timeSystem time5301.1870.0230.022101201.3010.0260.024152401.4210.0300.027204401.5410.0320.029256501.7520.0370.031Table 5 Leader Election Algorithm for Mobile Adhoc Networks5. SimulationsMessage Complexity with respect to number of processesTimeNo.of Messages TransferredSnoAlgorithmN=5N=10N=15N=20N=25N=5N=10N=15N=20N=251LeLanns1.1951.2921.4461.5511.654251002254006252Chang Roberts1.1891.2991.4121.5311.659192939493Bidirectional Ring1.1861.3021.4171.5341.66114294459744MobileAdhoc1.1871.3011.4211.5411.75230120240440650The message and time complexity of each of these 4 algorithms for different number of processes is implemented in our programs and the results are as shown in table 6.All the above simulations are plotted on the graph so as to analyze the way different algorithms message complexity varies with the number of proces ses on which it executes.6. ConclusionsTable 6 Simulation ResultsComparing the results, we can conclude that the Lelanns algorithm is the most fundamental algorithm and requires large number of message exchanges among the four algorithms. Changs and Robert algorithm madeconsiderable changes to Lelanns algorithm however in the worst case that algorithm also requires O(N2). For leader election in ring topology these are the two unidirectional algorithms that are to be considered.The bidirectional algorithm requires less messages than the worst case Changs and Roberts algorithm. It requires O(N logN) messages. It takes less time to find out the leader when compared to unidirectional algorithms since the messages are sent in both the directions. The final algorithm is put into effect for mobile adhoc networks and is run in many an(prenominal) rounds. The messages complexity depends on number of rounds. It guarantees that there is only one leader at a time but however it handles the pa rtition in the network and requires more number of messages .

No comments:

Post a Comment