Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment 01: Threads in modern operating systems are used as a means of improving the efficiency of programs and avoiding lags in performance. Most modern
Assignment 01: Threads in modern operating systems are used as a means of improving the efficiency of programs and avoiding lags in performance. Most modern operating systems provide threading using Thread Libraries. Some programming languages, such as Java also provide libraries for managing threads. These can be incorporated into programs to enhance the performance. In this assignment, it is required to demonstrate the use of threading and to provide evidence of a performance boost to your program using the built-in threading libraries. The assignment is twofold. Below are the requirements: Programming Part 1: Write a program in C or 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: a. Displays its ID b. Find incremental sum of all the numbers until and including 1,000,000,000 C. Exit itself once completed the operation 2. Child Thread 2: a. Displays its ID b. Find incremental sum of all the even numbers until and including 1,000,000,000 c. Exit itself once completed the operation 3. Parent/Main Thread: a. Displays its ID b. Creates Child Threads 1 and 2 c. Merges Child Thread 1 and 2 d Displays the sum of all the numbers returned by Child Thread 1 e. Displays the sum of all the numbers returned by Child Thread 2 f. Calculates the following: i. sum of all the numbers returned by Child Thread 1/ sum of all the numbers returned by Child Thread 2 g. 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. Assignment 01: Threads in modern operating systems are used as a means of improving the efficiency of programs and avoiding lags in performance. Most modern operating systems provide threading using Thread Libraries. Some programming languages, such as Java also provide libraries for managing threads. These can be incorporated into programs to enhance the performance. In this assignment, it is required to demonstrate the use of threading and to provide evidence of a performance boost to your program using the built-in threading libraries. The assignment is twofold. Below are the requirements: Programming Part 1: Write a program in C or 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: a. Displays its ID b. Find incremental sum of all the numbers until and including 1,000,000,000 C. Exit itself once completed the operation 2. Child Thread 2: a. Displays its ID b. Find incremental sum of all the even numbers until and including 1,000,000,000 c. Exit itself once completed the operation 3. Parent/Main Thread: a. Displays its ID b. Creates Child Threads 1 and 2 c. Merges Child Thread 1 and 2 d Displays the sum of all the numbers returned by Child Thread 1 e. Displays the sum of all the numbers returned by Child Thread 2 f. Calculates the following: i. sum of all the numbers returned by Child Thread 1/ sum of all the numbers returned by Child Thread 2 g. 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started