Develop a simplified master-worker framework

Assignment Help JAVA Programming
Reference no: EM132475860

Assignment - A Simplified Master/Worker Framework

In this assignment, you are to develop a simplified master/worker framework. The Java networking models and components that you have practised form Week 1 to Week 4 of this unit are enough to develop such a simplified framework. These models and components are client/server model, Java TCP streaming, multi-threading and object serialization. You will need to review these models and components and practise relevant lab projects of these weeks before you start this assignment.

Part 1: Java TCP Streaming, Multi-threading and Object Serialization Programming

The framework consists of a Master (i.e. server), a number of Workers (i.e. clients) and a Class Repository in the Master. The framework is depicted in the following diagram. The framework is a generic computing architecture because the Master and Workers just need to know the interaction contract in advance so that they can interact with each other via the framework. The specification of the interaction contract is as follows.

1. The interaction contract

The interaction contract between a Worker and the Master consists of:

1. The Task interface defines two standard methods that every compute-task must implements.

2. The TaskList class is a container that holds the titles and the class names of available compute-tasks.

3. The TaskObject class is a container that holds a particular compute-class object, its ID and credit.

2. The compute-task

The Master has a class repository that saves the Java classes of available compute-tasks. A compute-task must implement the Task interface. Executing the executeTask() method will perform the task and set the result. Calling the getResult() method will return the result. A compute-task must implement java.io.Serializable interface as well so that the compute-task can be transferred between the Master and a worker over the network. The structure of a compute-class is as follows.

3. The interaction workflow of the framework

The following screenshot show that when the Master starts, it is listening on two ports for object or file transfer.

A Worker provides a user frontend to access the remote Master. A Worker just needs to know the interaction contract only before starting volunteer computing. The following screenshots show the contract directory in a Worker and the start of a Worker.

On the Worker frontend as shown in the following screenshot, clicking the Set button will establish two TCP connections to the Master on the given ports, one for object transfer and the other for file transfer, and enable the Refresh button.

Clicking the Refresh button, the worker will send an empty TaskList object to the Master and receive the same TaskList object back with the available compute-tasks that is filled by the Master. After that the Calculate button is enabled and the Worker is ready to ask for a compute-task to calculate.

Selecting a task e.g. 'Calculating Pi to 70 decimal digits' and clicking the Calculate button, the following interaction will happen between the Worker and the Master.

1. The Worker downloads the class file of the selected compute-task (e.g. CalculatePi.class) from the Master

Note: the downloading is automated by the Worker, not manually by a user.

2. The worker creates a TaskObject and sets the selected task ID on the TaskObject and then send the TaskObject to the Master.

3. The Master receives the TaskObject, creates the compute-task object (e.g. CalculatePi) according to the compute-task ID.

4. The Master sets the compute-task object on the TaskObject and sends the TaskObject to the Worker.

5. The Worker receives the TaskObject and gets the compute-task (e.g. CalculatePi) from the TaskObject.

6. The compute-task object (e.g. CalculatePi) is cast (be deserialized) into the Task interface type and its executeTask() is called.

7. The Worker sends the same TaskObject to the Master, which includes the computing results now.

8. The Master receives the TaskObject and retrieves the results.

9. The Master sets a credit on the TaskObject and sends it to the Worker.

10. The Worker receives the TaskObject and retrieves the awarded credit.

4. The implementation

To complete this assignment, you need to implement such a framework and integrate the Calculate Pi, Calculate Primes and Calculate the Greatest Common Divisor tasks into this framework. The algorithms of these tasks are given on the unit web site. The Master must be multi-threaded and follow the 'thread-per-connection' architecture (reference Week-4 contents). The communication between the Master and the Worker must use TCP streaming by using Java TCP API Socket and ServerSocket as described in Week-2 contents of this unit.

Please note: use of any other protocols will incur no marks to be awarded for this part.

To implement the framework, you need to implement the following Java classes:

1. A Java application to implement the Worker; graphic user interface is required;

2. A Java application to implement the Master; and

3. A number of Java class to implement the processing threads when necessary.

Note: to demonstrate your competence of concurrency programming, you will need to make an analysis on when concurrency is needed. Marks will be deducted if concurrency is not identified or necessary multithreading is not used.

4. A number of Java classes to implement Calculate Pi, Calculate Primes and Calculate the Greatest Common Divisor tasks.

Note: to simulate Master and Worker interaction, you don't have to run them on two physical machines. Instead, they can be run on two JVMs (Java Virtual Machines) on a single physical machine. As a result, the name of the Master machine can be 'localhost'.

Part 2: Program use and test instruction

After the implementation of the framework, prepare an end user' instruction about how to use your software. The instruction should cover all aspects of the framework as detailed in the Part 2 of marking criteria below.

You need to provide the following files in your submission.

1. Files of Java source code of the Master, the Worker and the processing threads and the compute-tasks. The in-line comments on the data structure and program structure in the programs are required. These source code files must be able to be compiled by the standard JDK (Java Development Kit) or NetBeans IDE from Oracle.

2. The compiled Java class files of the source code. These Java classes must be runnable on the standard Java Runtime Environment (JRE) from Oracle.

3. A Microsoft Word document to address the issues as specified in Part 2 above.

Attachment:- Simplified Master-Worker Framework Assignment Files.rar

Reference no: EM132475860

Questions Cloud

Art of serialized storytelling : Discuss how The Wire's overarching "season-as-chapter" narrativestructure, in combination with its use of the art of serialized storytelling
Performance in the classroom environment : How can the teacher identify stress and special circumstances early enough to support the family and learner through circumstances?
Determine and discuss what think cooper meant : Determine and Discuss what think Cooper meant and how it relates to our discussion of ethical and moral development in the chapter.
Role in a definition of racism : Some sociologists argue that POWER should play a role in a definition of racism. Would you agree or disagree? Why?
Develop a simplified master-worker framework : In this assignment, you are to develop a simplified master/worker framework. Part 1: Java TCP Streaming, Multi-threading and Object Serialization Programming
What is the purpose of entering historical invoices : What step is not involved in setting up the receivables ledger? Expense accounts created in account ledger windows are assigned by default to?
Discuss thoughts on drugs and deviance : Why do you think alcohol and tobacco are legal drugs and their use is not considered deviant when they are addictive, physically harmful, and socially disruptiv
Define race and ethnicity : Define race and ethnicity. How do you describe your ethnicity? Do you include your family's country of origin? Do you consider yourself multiethnic?
Critical essay concerning the sdt : PSY3002 - provides a brief overview of what will be covered and the purpose of the research. Literature Review is taken in part from the scholarly journal

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd