Assignment 1 – CS324 Distributed Systems Assignment Help

Assignment 1 – CS324 Distributed Systems 2024 Due Date:23rd September 2024,11:55 pm

Learning Outcome:Develop a software system using distributed platforms

This assignment asks you to implement adistributed system based on the so-called Leader Election protocol.

Plagiarism

Please state clearly in your write-up and program who are your group members.If we find that you copied work from others-people who are not on your group-it will be considered plagiarism.

It’s not plagiarism to discuss the assignment with other students and consider solutions to the problems together.However,it is plagiarism for you to copyallor part of each other’swrite-up or models.

Questions

If you have problem with the assignment please ask.First use the forum,because this will also help other students with the same question.

Ring Algorithm for Leader Election

TheRingAlgorithm isaleader electionprotocol usedin distributedsystemswherenodesarearranged in a logical ring. The main goal of the algorithm is to ensure that a single leader orcoordinator is elected among the nodes in a distributed system, even in the presence of nodefailures.

Key Characteristics:

  1. LogicalRing:
    • Nodesareorganizedin alogicalring structurewhereeach nodeknows onlytheidentityof its immediateneighbor in thering.
    • Communicationintheringisunidirectional,meaningthatmessagesarepassedinonedirection (either clockwiseor counterclockwise) aroundthering.
  2. Unique Identifiers:

    • Each node in the ring has a unique identifier (ID). The election process aims toselectthenodewith thehighest IDas the leader.

Steps of the Ring Algorithm:

  1. ElectionTrigger:
    • Theelectionprocessistriggeredwhenanodedetectsthatthecurrentleader hasfailed(e.g.,by notreceivingmessages fromtheleader foracertainperiod).
    • Thenodethatdetects thefailurebecomes theinitiator oftheelection process.
  2. Election Message:

    • Theinitiator nodesendsanElectionmessagecontaining its own ID to itsimmediateneighbor in thering.
    • Theneighbornode comparesits ownID withtheID in theElectionmessage.
      • If the neighbor's ID is higher, it replaces the ID in the message with itsownand forwards themessageto thenext node inthe ring.
      • Iftheneighbor'sIDislower, itsimplyforwards themessagewithoutchangingtheID.
  3. Message Circulation:

    • TheElectionmessagecontinuesto circulatearound thering, with each nodeforwardingthe message aftercomparingIDs.
    • Whenthe Electionmessage makesafull circle and returns totheinitiator, it willcontainthe highestID inthe ring.
  4. Leader Declaration:

    • Thenode whose IDis in the Electionmessagewhen it returnsto theinitiator iselected as the leader.
    • Theinitiatorthen sendsaCoordinatormessage(or Leadermessage)containingtheelectedleader'sID toallnodesin thering,confirmingthe electionresults.
  5. Completion:

    • Uponreceiving the Coordinatormessage,all nodes in the ring acknowledgethenewleader.
    • Theleaderbeginsitsduties,andnormaloperationresumes

Example Scenario:

  • Consideraring offivenodes with IDs:1,3, 5, 7, 9 arrangedin a clockwisering.
  • Node 5 detects that the current leader (Node 9) has failed and starts an election bysendingan ElectionmessagewithID 5 to Node 7.
  • Node7seesthatitsID(7) is higherthan 5,so it replaces theIDin theElectionmessagewith7 and forwards it to Node9.
  • Node 9 would replace the ID with 9 if it were still active, but since it’s down, Node 1receivesthe messagewith ID 7.
  • Node1, witha lower ID,forwardsthemessageunchanged toNode3.
  • Node3,with alowerID than 7,forwards themessageunchangedto Node 5.
  • When Node 5 receives the message back, it knows that Node 7 has the highest ID in thering.
  • Node5thensends aCoordinatormessagewithID7 to all nodes, declaring Node7 asthenew leader.

Thisassignment hasthreeparts.

PART1:Write-up

Exercise 1

IstheLeaderElectionprotocolacentralizedordecentralizedsystem?Isitastructuredorunstructurednetwork?Explain your answerinlessthan 300 words.

CBOKUnsatisfactory(0%-49%)Satisfactory(50%-75%)Good(76%-100%)
Communication
  1. Poorpresentation/communication skills(hard tounderstand)
  2. Does not followthegivenstandardtemplate
  3. Poorreportwriting(ill structured,ideas and designnot wellcommunicated,and/or poorlyformatted)
  1. Goodpresentation/communicationskills(clearandloud)
  2. Abletofollowthegiven standardtemplate
  3. Effective reportwriting (wellstructured,ideasanddesign effectivelycommunicated, andwellformatted)
IV. Allsatisfactory

Exercise 2

Is it possible to implement Leader Election Protocol using RPC calls? If yes, explain which RPC calls youwouldneed. If no,explainwhyitcannotbe implemented viaRPC.

CBOK

Unsatisfactory

(0%-49%)

Satisfactory

(50%- 75%)

Good

(76% -100%)

Communication
  1. Poor presentation/communication skills(hard tounderstand)
  2. Does not follow the given standard template
  3. Poorreport writing(ill structured,ideas and designnot wellcommunicated,and/or poorlyformatted)
  1. Goodpresentation/communicationskills(clearandloud)
  2. Abletofollowthegiven standardtemplate
  3. Effective reportwriting (wellstructured,ideasanddesign effectivelycommunicated, andwellformatted)
VIII. Allsatisfactory

PART2:Implementing Leader Election Protocol using RMI

ThispartoftheassignmentasksyoutoimplementtheLeaderElectionprotocolforanetworkwiththenumberof nodesas described intheproblemabove.

Exercise1:Communication and electingaleader

Youmustensurethefollowing:

  • Communication must beinaringtopology.
  • All nodes should not execute methods for other nodes.This should be restricted to allow communication in Ring topology.
  • The program design depends on your group.
  • Once the leaderi selected; the leader should in form all participants.
CBOKUnsatisfactory(0%-49%)Satisfactory(50%-75%)Good(76%-100%)
Programming
  1. Plagiarism
  2. Poor indentation,hard to read andfollowthecode
I.Able to write acomplexcodeforaloosely definedproblem

IX.        Allsatisfactory anddemonstr

atevery

 
  1. Lots of bugs and/or errors
  2. Program produces unexpected output
  3. No properencapsulation,inheritance orpolymorphism forobject-orientedprogramming
  4. Noexceptionhandling
  5. Hard coding of data in the program.
  6. Poor structure
  1. Appropriatestructureoftheprogram
  2. Use of standardprogrammingpracticessuchasmodularity, lowcoupling, highcohesionetc.
  3. Appropriateencapsulation,inheritance orpolymorphism forobject-orientedprogramming.
  4. computer programproduces expectedoutput
  5. appropriate exceptionhandling
goodprogrammingskills.

PART 3: Implementing Leader Election Protocol with Peer Register using RMIExercise1

Modify the program given in Exercise 1 to include a peer register. All peers needs to register with a nodecalled “peer register”. This “peer register” node does not take part in the election process as it is only inchargeofregisteringpeersand ensuring which peerisconnectedto which oneinaring topology.

Therearesomerulesforpeer registration:

  1. A peercan onlyregister whenthereisnoelectioni.e.apeercannotregisterwhenanelectionisinprogress.
  2. The“peerregister” nodedecides whichnodesareconnected inaringtopology.

Your program should electa leader attheendand the leader shouldinformtheparticipants.

CBOK

Unsatisfactory

(0%-49%)

Satisfactory

(50%- 75%)

Good

(76% -100%)

Programming
  1. Plagiarism
  2. Poor indentation,hard to read andfollowthecode
  3. Lots of bugsand/orerrors
  4. Program produces unexpected output
  1. Able to write acomplexcodeforaloosely definedproblem
  2. Appropriatestructureoftheprogram
  3. Useofstandardprogramming
  1. Ableto

    write acomplexcode for anopenendedproblem

  2. Useof

    highest

 
  1. No proper

encapsulation,inheritance orpolymorphism for object-oriented programming

  1. No exception

handling

  1. Hard coding of data in the program.
  2. Poor structure

practicessuchasmodularity, lowcoupling, highcohesionetc.

  1. Appropriateencapsulation,inheritance orpolymorphism forobject-orientedprogramming.
  2. computer programproduces expectedoutput
  3. appropriate exceptionhandling

standard ofprogrammingpracticessuch asmodularitywithappropriatearchitecture, lowcoupling,highcohesion,standarddocs(eg.

Javadoc)etc.

Appropriate testing isdone.

 

Example invalid form file feedback

Join our 150К of happy users

Get original papers written according to your instructions and save time for what matters most.