DS_341_Assignment_4.pdf

Parallel Computing and Distributed Systems - Assignment 4 (15 points)

As discussed in the previous assignment, Maven is a way to build java projects while automatically handling dependencies (required libraries). In this assignment, you will use the Actor Model (AKKA library) -we discussed in Unit 5- to implement a distributed and parallel computing application using the Java IDE you find appropriate. Check the videos and tutorials attached to the assignment folder first. The video shows the steps to create a Maven project over Eclipse, and similar steps are used to create a Maven project over other Java IDEs. Feel free to use more online resources to read about Maven projects and create simple java projects with it. The tutorials show different examples of using the Actor model. Setting up the Environment: you need to include the AKKA Actor library,

o The first option: use Maven project option and include the following dependency <dependency> <groupId>com.typesafe.akka</groupId> <artifactId>akka-actor_2.11</artifactId> <version>2.4.20</version> </dependency>

o The second option: search online for AKKA Actor library you find appropriate and import the corresponding JAR files Task1 (10 points): Create a single boss actor who will create a set of worker actors (e.g., an array of actors). The boss actor then divides a task into smaller ones, assigns the sub-tasks to the workers, and accumulates the reported sub-results. o The boss actor randomly generates an integer ArrayList of size 8,000 with values between 0 to 100. o The boss actor then creates four workers, divides the ArrayList into four equal parts (2000 values per part), and then messages

each part to a separate worker. o Each worker receives the sub-list, calculates the average, and messages the result back to the boss o The boss prints the sub-results reported by the workers along with the identity of the workers, then accumulates the reported

sub-results and prints the final result.

Note: As you noticed in the attached tutorials, the onReceive() function accepts an object (e.g., GreetingMessage, TaskMessage). In task 1, actors send objects (e.g., ArrayLists, single values). Task2 (5 points): Create a single boss actor who will create a set of worker actors (e.g., an array of actors). The boss actor then divides a task into smaller ones, assigns the sub-tasks to the workers, and accumulates the reported sub-results. o The boss actor creates two workers. o Each worker, once created, randomly generates an integer ArrayList of size 2,000 with values between 0 to 50. o The boss actor then messages “Task: Report Statistics” string to the workers. o Each worker develops the required statistics on the locally generated ArrayList (The Summation is x, The Average is y, and The

Maximum is z). This can be an object (you create a class called statistics and message such an object) or a simple string. o The boss prints the sub-results reported by the workers along with the identity of the worker. o The boss actor then messages “Terminate” to the workers o The workers should then terminate.

Submission:

1. Submit the following files directly to the folder titled Assignment 4 under the D2L Assignments tab (don’t submit a zip file holding them):

a. The developed/updated Java files b. PDF file with clear screenshots for the terminal of the IDE showing the output.

2. Check the due date on D2L. You can submit your assignment within 24 hours after this due date to be graded out of 50%

of the assignment’s grade. After this grace period, your late submission will not be accepted.

3. This is an individual assignment -- Cheating/plagiarism will be checked and will receive zero.