Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone please help with this question, ive posted twice and only got a wrong code. javva please public class Y e public static void

can someone please help with this question, ive posted twice and only got a wrong code. javva please
image text in transcribed
image text in transcribed
public class Y e public static void main(String args[]) throws InterruptedException { Thread tA = new Thread_TY("A"); Thread tb = new Thread_TY("B"); tA.start(); tB.start(); tB.join(); ta.join(); System.out.println(" MAIN"); } //main TWN 26 17 } //class Y 18 19 class Thread_TY extends Thread { 20 210 public Thread_TY(String name) { super(name); } //constructor 23 250 public void run() { for (int i = 0; i =1) the integer numOfThreads (>=1) the multi-threaded Java program computes nl and returns the computed value in output. The task must be performed in concurrency, by splitting the original task in (as balanced as possible) numorThreads sub-tasks, each one performed by a thread. Implement the code, such that it works for generic values of n and numOfThreads. The output of the program must be generated following the example output reported below (example for n=11 and numorThreads=3): Computation of 11! using 3 threads. Thread-2 [7,11] started... Thread-1 [4,6] started... ...Thread-2 [7,11] completed (Local Factorial: 55440) ... Thread-1 [4,6) completed (Local Factorial: 120) Thread-o [1,3] started... ... Thread-o [1,3) completed (Local Factorial: 6) Final Result: 111 = 39916800

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions