[Solved] COS418 Assignment 2: Chandy-Lamport Distributed Snapshots

$25

File Name: COS418_Assignment_2:_Chandy-Lamport_Distributed_Snapshots.zip
File Size: 536.94 KB

SKU: [Solved] COS418 Assignment 2: Chandy-Lamport Distributed Snapshots Category: Tag:
5/5 - (1 vote)

Introduction

In this assignment you will implement the Chandy-Lamport algorithm for distributed snapshots. Your snapshot algorithm will be implemented on top of a token passing system, similar to the ones presented in Precept 4 and in the Chandy-Lamport paper.

The algorithm makes the following assumptions:

  • There are no failures and all messages arrive intact and only once
  • The communication channels are unidirectional and FIFO ordered
  • There is a communication path between any two processes in the system
  • Any process may initiate the snapshot algorithm
  • The snapshot algorithm does not interfere with the normal execution of the processes
  • Each process in the system records its local state and the state of its incoming channels

Software

You will find the code under this directory. The code is organized as follows:

  • server.go: A process in the distributed algorithm
  • simulator.go: A discrete time simulator
  • logger.go: A logger that records events executed by system (useful for debugging)
  • common.go: Debug flag and common message types used in the server, logger, and simulator
  • snapshot_test.go: Tests you need to pass
  • syncmap.go: Implementation of thread-safe map
  • queue.go: Simple queue interface implemented using lists in Go
  • test_common.go: Helper functions for testing
  • test_data/: Test case inputs and expected results

Of these files, you only need to turn in server.go and simulator.go. However, some other files also contain information that will be useful for your implementation or debugging, such as the debug flag in common.go and the thread-safe map in syncmap.go. Your task is to implement the functions that say TODO: IMPLEMENT ME, adding fields to the surrounding classes if necessary.

Testing

Our grading uses the tests in snapshot_test.go provided to you. Test cases can be found in test_data/. To test the correctness of your code, simply run the following command:

  $ cd chandy-lamport/  $ go test  Running test '2nodes.top', '2nodes-simple.events'  Running test '2nodes.top', '2nodes-message.events'  Running test '3nodes.top', '3nodes-simple.events'  Running test '3nodes.top', '3nodes-bidirectional-messages.events'  Running test '8nodes.top', '8nodes-sequential-snapshots.events'  Running test '8nodes.top', '8nodes-concurrent-snapshots.events'  Running test '10nodes.top', '10nodes.events'  PASS  ok      _/path/to/chandy-lamport 0.012s

To run individual tests, you can look up the test names in snapshot_test.go and run:

  $ go test -run 2Node  Running test '2nodes.top', '2nodes-simple.events'  Running test '2nodes.top', '2nodes-message.events'  PASS  ok      chandy-lamport  0.006s

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COS418 Assignment 2: Chandy-Lamport Distributed Snapshots
$25