Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in Java that takes the integer 1 billion (1,000,000,000) from the command line or from user input. Once the data is input

Write a program in Java that takes the integer 1 billion (1,000,000,000) from the command line or from user input. Once the data is input program three threads to:

  1. Child Thread 1:
    1. Displays its ID
    2. Find incremental sum of all the numbers until and including 1,000,000,000
    3. Exit itself once completed the operation

  1. Child Thread 2:
    1. Displays its ID
    2. Find incremental sum of all the even numbers until and including 1,000,000,000
    3. Exit itself once completed the operation

  1. Parent / Main Thread:
    1. Displays its ID
    2. Creates Child Threads 1 and 2
    3. Merges Child Thread 1 and 2
    4. Displays the sum of all the numbers returned by Child Thread 1
    5. Displays the sum of all the numbers returned by Child Thread 2
    6. Calculates the following:
      1. sum of all the numbers returned by Child Thread 1 / sum of all the numbers returned by Child Thread 2
    7. Displays the result of above calculation

Analysis Part 1:

Analyze the time taken by the program to complete, e.g., review the usage of cores using Activity Monitor program in Ubuntu and find a way to monitor the time taken by the program to complete its execution. Furthermore, please make sure the calculations made by the program are correct and accurate.

Please do not forget to take a screenshot of the Activity Monitor.

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

=+ What substantive provisions are identified?

Answered: 1 week ago