Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I would really appreciate it if you did as much as you can from this assignment: Code: /* * Multi-Threading application * */ package

Hello, I would really appreciate it if you did as much as you can from this assignment: image text in transcribed

Code:

/*

* Multi-Threading application

*

*/

package multithreading;

import java.util.Random;

public class MultiThreading extends Thread

{

private int id; // thread number

private static float[] shareddata; // shared data array

public MultiThreading(int i)

{

id = i;

}

/* run method of the thread */

public void run()

{

int a;

Random generator = new Random();

System.out.println("Thread " + id + " running");

long t = System.currentTimeMillis()/1000;

for (a=0; a

System.out.println("Thread " + id + " took " + (System.currentTimeMillis()/1000 - t) + " seconds");

}

public static void main(String[] args)

{

final int N = 1; // number of threads

shareddata = new float[100000000];

System.out.println("Starting Multi-threading...");

MultiThreading[] thread = new MultiThreading[N];

for (int i = 0; i

{

/* initialise each thread */

thread[i] = new MultiThreading(i+1);

/* start each thread */

thread[i].start();

}

}

}

Thanks in advance!

In this part you need to assess the performance of your multi-core system and how the operating system handles the distribution of the processing. All modern PCs feature multiple processing units (multi-core and hyper-threading units). The number of processing units corresponds to the number of graphs (logical processors) in the performance tab in the task manager Run the MultiThreading.java application in NetBeans. It is suggested to use NetBeans 8.01 or NetBeans 8.1. The application performs 100 million calculations and stores the result in a shared static data array of type float. Currently the application is configured to run this processing task only once as a single thread. By changing the values assigned to variable N you can control the number of threads which are created and each of those threads currently performs the same number of calculations. Hence, the workload increases with N. The application will print out how long it took to complete the processing task for each thread. Do not run any other processing tasks while assessing the performance of the system. Make sure the CPU usage is very low before commencing the data capture Task B1: Data capture - (5 marks) Take measurements on how long it takes to complete the processing for N=1 to N-8 different thread scenarios. The applications prints out the number of seconds for each of the N threads Create a table in Excel and insert the longest time in seconds in the table for each scenario. Plot a line graph with N=number of threads on the x-axis and the longest time it took to complete the processing on the y-axis. Copy the populated table and line graph into your answer sheet. Proposed table layout Threads Time to complete sec) all cores 2 3 4 Task B2: Analysis- (5 marks) Describe how the OS scheduler is distributing the processing between different CPU cores. This can be observed in the performance tab of the task manager. How many CPU cores are busy? Give an explanation of your observations. How efficient is the computer system at handling the increasing processing demand? Substantiate your answer by referring to the graph from task B1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions