ปิด

multi threading java program

The [url removed, login to view] program:

The first program you will write will be called Starter.java. This program should not be in a package. This program will do

four tasks:

1. Read from the user that name of a file containing a list of numbers and the number of threads for the Worker

program to create. (The number of threads should be an integer between two and 20.)

2. Create a ProcessBuilder object that will act as a template for the Worker process. The template should run the

Worker program (using the java virtual machine command "java") with the command line arguments described

below for the [url removed, login to view] program.

3. Start a new Worker process using the ProcessBuilder.

4. Tie the output of Worker program to the Starter program using the Process class method getInputStream() on the

Worker process you created in step 3 and read the results that the Work program writes and display them.

The [url removed, login to view] program:

The second program you will write will be called [url removed, login to view], again with no package. The Worker program will perform

the following tasks in the main method:

1. Get the command line arguments for Worker: the number of threads to create and the filename to read, from the

main method parameter and place them in variables.

2. Open the file for reading and then, read and store the number in the file. You will probably find it easiest to use an

ArrayList to store the numbers.

3. Create the specified number of threads, using the Runnable class you write and create an double array with an

element for each thread to store its results.

4. Start the thread you created.

5. Using the Thread join() method, wait for each of the thread to complete.

6. Sum the values in the results array and display the sum of the numbers that were read.

You also have to write a class that implements the Runnable interface that the main method uses to create the threads. You

should make this class an inner class of the Worker class. This will allow the Runnable class to have access to the static

variables of the Worker class, thereby allows the running threads access to threse variables as shared data. The three pieces

of shared data needed are the total number of threads, the list of numbers and the result array. The Runnable class should

have a private instance variable which will hold the index of the thread object, which will be a number between 0 and the

number of threads minus one. This index is assigned by the main method when it create the Runnable class for each thread.

The index will be used by the thread object to write its final result to the proper element of the shared result array array and

to partition the numbers in the numbers list.

ทักษะ: Java

ดูเพิ่มเติม : multithreading in java pdf, thread synchronization in java, real time example of multithreading in java, multithreading in java ppt, threads in java example, simple thread program in java, java multithreading example bank account, multithreading in java interview questions, simple multi threading chat java, java program read pairs numbers file sum numbers, java program sum file, write java program input pairs large numbersprogram read echo pair numbers compute report sum product process pair end input , make multi media player program java, java program find sum product digit, craps java program

เกี่ยวกับนายจ้าง:
( 0 บทวิจารณ์ ) India

หมายเลขโปรเจค: #16252573

freelancer 11 คน กำลังเสนอราคาเฉลี่ยที่ ₹1523 สำหรับงานนี้

dipakjadhav08

A proposal has not yet been provided

₹1750 INR ใน 2 วัน
(76 บทวิจารณ์)
5.2
₹1300 INR ใน 1 วัน
(9 บทวิจารณ์)
3.2
₹2250 INR ใน 1 วัน
(4 บทวิจารณ์)
2.6
Nerdulent

hi...by when is the earliest by which you need it completed?? thanks :)

₹1600 INR ใน 2 วัน
(3 บทวิจารณ์)
1.9
₹1750 INR ใน 1 วัน
(4 บทวิจารณ์)
1.6
sharma141

HI, Its a simple thread program I can surely do that for you. I have 8 yrs of java exp. I am new here so I will give my best to get 5/5 ratings. Do have a chat before awarding to someone else I am sure we can work เพิ่มเติม

₹1200 INR ใน 1 วัน
(1 บทวิจารณ์)
1.0
Codezion

Hello sir, i have go through your requirements and confidently i can assure you for the best in the industry with 7+ year's expertise hand on web development, mobile app project

₹1300 INR ใน 2 วัน
(0 บทวิจารณ์)
0.0
₹1250 INR ใน 1 วัน
(0 บทวิจารณ์)
0.0
utecengenharia

Hello, sir. Thank you for the opportunity. If your deadline is not very short, we can discuss a lower price.

₹1300 INR ใน 1 วัน
(0 บทวิจารณ์)
0.0
₹1300 INR ใน 1 วัน
(0 บทวิจารณ์)
0.0
kavs3007

I have a good knowledge of multithreading and analysis of the [login to view URL] implementation will be done using TDD

₹1750 INR ใน 3 วัน
(0 บทวิจารณ์)
0.0