Multi-threading and Object Serialization Programming

Assignment Help JAVA Programming
Reference no: EM133188697

A Simplified Master/Worker Framework

The application background

Volunteer computing is to harness the donated computing cycles and temporary storage from millions of internet volunteers for a computation task, which is too big to be processed by a single computer in a reasonable amount of time. The following web page outlines volunteer computing.

The most successful volunteer computing framework is Berkeley Open Infrastructure for Network Computing (BOINC). BOINC is client/server architecture. The server (termed as master) creates a list of compute-tasks. Volunteer clients (termed as worker in BOINC) access the master to download available compute-tasks. Workers perform the compute-tasks and upload the results to the master. Optionally workers may be awarded credits by the master for their contribution to computing cycles and temporary storage. Volunteer computing by using BOINC framework has been applied to many scientific projects such as SETI@home, Einstein@Home, and IBM World Community Grid. The following web pages introduce volunteer computing and application projects.

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

Note:

1. A separate document for demonstration of the system functions is available on the unit Moodle site. You will need to use the demonstration document as a part of the assignment specification. You will need to ensure that you fully understand the scenario and project specification before developing the project; you will also need to ensure the developed system fulfilling the functional requirements as shown in the demonstration document.

2. A file transfer sample code and instruction document are on the unit Moodle site. It helps for transferring tasks from the Master to the Worker in the framework.

3. The algorithms of the 3 sample tasks are provided on the unit Moodle for the freamwork.

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/follow the interaction contract only so that they can interact with each other via the framework. The specification of the interaction contract is as follows.

585_Java TCP Streaming.jpg

 

1. The interaction contract

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

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

package Contract; public interface Task {
public void executeTask(); public Object getResult();
}

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

package Contract;
import java.io.Serializable;
public class TaskList implements Serializable{ private String AvailableTasks[];
private String TaskClassName[];

public String[] getAvailableTasks() { return AvailableTasks;
}
public void setAvailableTasks(String[] AvailableTasks) { this.AvailableTasks = AvailableTasks;
}
public String[] getTaskClassName() { return TaskClassName;
}
public void setTaskClassName(String[] TaskClassName) { this.TaskClassName = TaskClassName;
}
}
c. The TaskObject class is a container that holds a particular compute-task object, its ID and credit.

package Contract;
import java.io.Serializable;
public class TaskObject implements Serializable{ private Integer TaskID=0;
private Integer Credit=0; private Task TObject=null; public TaskObject() {
}
public Integer getTaskID() { return TaskID;
}
public void setTaskID(Integer TaskID) { this.TaskID = TaskID;
}
public Integer getCredit() { return Credit;
}
public void setCredit(Integer Credit) { this.Credit = Credit;
}
public Task getTObject() { return TObject;
}
public void setTObject(Task TObject) { this.TObject = TObject;
}
}

The above interface and classes form a complete interaction contract between the Master and Workers.

2. The compute-task

The Master has a class repository that holds 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 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.

public class CalculatePi implements Task, Serializable{
...... @Override
public void executeTask() {
//The implementation of method

......
}
@Override
public Object getResult() {
//The implementation of method
......
}
//may have other methods
......
}

3. The interaction workflow of the framework

A Worker provides a user frontend to access the remote Master. A Worker just needs to follow the interaction contract only for volunteer computing. The interaction workflow between Worker and Mater includes:

a. Workers connect to the Master

b. Workers download the available task list from the Master

c. Workers download some tasks from the Master

d. Workers perform the tasks

e. Workers upload computing results to the Master.

The demonstration of interaction workflow between Workers and the Mater is in the demonstration document on the unit Moodle site.

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 the 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 Workers must use TCP streaming by using Java TCP API Socket and ServerSocket as described in Week-2 contents of this unit. Note: use of any other networking protocols will incur no marks to be awarded for this part.

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

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

b. A Java application to implement the Master; and

c. A number of Java classes to implement the processing threads when necessary.

d. Note: to demonstrate your competence in 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.

e. 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.

Submission

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. The 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. The Java classes must be runnable on the standard Java Runtime Environment (JRE) from Oracle.

Note: an easy way to provide the source code and executables is to submit them in a NetBeans project.

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

All the required files must be compressed into a zip file for submission. You must submit your assignment via the unit web site. Any hardcopy or email submission will not be accepted. After the marked assignments are returned, any late submissions will not be accepted.

Attachment:- Simplified Master.rar

Reference no: EM133188697

Questions Cloud

Implement such a framework and integrate the calculate : Computing cycles and temporary storage from millions of internet volunteers for a computation task, which is too big to be processed by a single computer
Classroom environment-opportunities for success of students : Task 1. Write a conclusion on significant relationship between the given variables. Parents' advice and choice of course to pursue
Federal employment guidelines : The Human Resources (HR) Department staff perform a myriad of duties in an organization. One of their most important functions is recruiting the right person fo
Describe two specific business practices : Identify and describe two specific business practices commonly used during the 2008-2010 financial crisis. Using course content, discuss whether each of these p
Multi-threading and Object Serialization Programming : Implementation of the framework, prepare an end user' instruction about how to use your software. The instruction should cover all aspects of the framework
Describe two specific business practices : Identify and describe two specific business practices commonly used during the 2008-2010 financial crisis. Using course content, discuss whether each of these p
Complete an in depth search of the canadian tire : Now do some investigative journalism! Complete an in depth search of the Canadian Tire company online to see what you can find about them in the media.
Identify issues university address to increase likelihood : For information systems to be effectively implemented and used, an understanding of three dimensions are critical- organisation, management, technology
Evaluate an infographic posted : Evaluate an infographic posted within the last months on Twitter.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a program that uses a dynamic list of strings

Write a program that uses a dynamic list of strings to keep track of a list of chores that you have to accomplish today.

  Write a program that reads a series of test scores

Write a program that reads a series of test scores from a recent test (integers in the range 0 to 100) until a sentinel value is read. A sentinel value is the value used to determine when to stop. The program then prints the following statistics f..

  Inheritance involves the concept of super class

Inheritance involves the concept of super class (parent class) and sub class (derived class). What is a super class in Java? What is a sub or derived class in Java?

  A statement telling the user if they get a discount or not

The program asks the user if they have pre-registered for a conference. If the user has pre-registered, the program should call a method named discount () that displays the message "You are pre-registered and qualify for a 10% discount.

  How to use jquery mobile data attributes

how to use jQuery Mobile Data Attributes, create a full page containing the attributes - adds extra padding and margin inside the page content

  Simulate a game of tic tac toe

Classes as specified in the UML diagram. You may add other methods if needed, however, all the methods and the variables indicated in the UML diagram

  Explain where the following method invocations

Explain where the following method invocations are most likely to be found in a program for dealing with census data organized using the Model, View, Controller (MVC) design pattern. Choices are zero or more of Model, View, and Controller. Be sure to..

  Create a shape class with instance variable

Create a Shape class with instance variable double l and create a parameterizedconstructor

  Program with backtracking removing all gotos

Please fix the below program with backtracking removing all gotos  and also run the program before posting it and please comment before each line or explain such as what this line means or does .

  Determine and print out all even numbers

CSE 1321L - Programming and Problem Solving - Kennesaw State University - Design and implement a program (name it PrintSum) that prompts

  Define method headers for computeaveragesales

Define method headers for computeAverageSales() and computeShipping Charges() according to the following requirements. Develop pseudocode for two new methods to be added to your product class

  Problem regarding the protocol conformance

We can compare Smalltalk interfaces to classes that use protocols, which are lists of operation names (selectors). When a selector allows parameters, as in at: put: , the selector name includes the colons but not the spaces.

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