This assignment is to be done either individually or in pairs. Do not show your code to any other group and do not look at any other group's code. Do not put your code in a public directory or otherwise make it public. However, you may get help from the TAs or the instructor. You are encouraged to use the RPILMS Discussions page to post questions so that other students can also answer and see the answers.
A generic distributed computing framework based on the farmer/worker pattern
The goal of this assignment is to implement the
farmer/worker pattern for distributed task execution in the SALSA programming
language. A farmer supervises workers. Workers register with the farmer to get
tasks. Each time the farmer gets a task, it splits the task into
‘n’ subtasks, which can be given to workers, and the farmer
collects the computed partial results. After getting results from all the
workers, the farmer composes the results into the final result.
Your solution should provide implementations of the Farmer and Worker interfaces provided below and also a distributed computing example that implements the Task interface. You can for example implement MergeSort or MatrixMultiply as sample implementations of the Task that your distributed framework will use to produce results. A sample implementation of Task named “FibonacciTask” is also provided below for you reference, however you should also implement one more Task example as part of your assignment (for example, MergeSort or MatrixMultiply.)
Please clearly specify in your Readme file how to run your
distributed framework, including how to specify the machines where workers are
to run, and how to change the number of workers in your framework.
module pa3;
public interface Farmer {
/**
* This method accepts a Task actor
which may be
* a FibonacciTask or something else. It excutes
* the
Task by using Workers and return an object
* as the
result.
*/
public Object
execute(Task task);
/**
* A worker can use this method to
register
* itself
to the farmer.
*/
public void
register(Worker worker);
}
module pa3;
public interface Worker {
/**
* The worker would execute a
sub-task
* given by the farmer.
*/
public Object
execute(Task task);
}
module pa3;
public interface
Task {
public
Task[] split(int numberOfSubtasks);
/**
* The task acts its
computation.
*/
public
Object compute();
/**
* The task will
compose the results of its sub-tasks
*/
public
Object compose(Object[] subResults);
}
The interfaces and sample task can be downloaded here.
10% Extra Credit:
You can extend your framework with failure detection i.e. in case one worker fails during the execution (e.g. the theater in which it was running was closed or the machine was turned off) its task is assigned to another worker.
See the professor if you have ideas for other extensions to this assignment and would like extra credit for implementing them.
Due Date:
Received Time |
Grade Modification |
Before 11:59 PM 11-30-09 |
+10% |
From 12:00 AM 12-01-09 to 11:59 PM 12-02-09 |
no
modification (on time) |
From 12:00 AM 12-03-09 to 11:59 PM 12-03-09 |
-10% |
From 12:00 AM 12-04-09 to 11:59 PM 12-05-09 |
-25% |
After
Sunday, December 06, 12:00AM |
not
accepted |
The assignment will be graded mostly on correctness, but code clarity / readability will also be a factor (comment, comment, comment!). Be sure your solutions are robust.
Submission Requirements: Your code should consist of Salsa files, plus a README file. Combine these files into a single ZIP file with your WebCT user name(s) as the filename, either userid1.zip or userid1_userid2.zip. Only submit one assignment per pair (the other does not need to submit anything via RPILMS). Please submit your file via RPILMS.