Question

In: Computer Science

please i want it with report full answer please Use either multithreading (Java or OpenMP) libraries...

please i want it with report full answer please



Use either multithreading (Java or OpenMP) libraries to parallelise the following:
1) Write a program that launches 1,000 threads. Each thread adds 1 to a variable sum that initially is 0. Define a variable to hold sum.
- Run the program without synchronization.
- Run the program with synchronization in three different techniques
2) Write a program to compute a factorial of a given number in parallel

Solutions

Expert Solution

Answer;

1) Write a program that launches 1,000 threads. Each thread adds 1 to a variable sum that initially is 0. Define a variable to hold sum.

Run the program without synchronization.

Code;

Output;

Run the program with synchronization in three different techniques

Code;

Output;

2) Write a program to compute a factorial of a given number in parallel

Code;

Output;


Related Solutions

Please use java to answer the below question. (i) Create a class Pencil with the attributes...
Please use java to answer the below question. (i) Create a class Pencil with the attributes brand (which is a string) and length (an integer) which are used to store the brand and length of the ruler respectively. Write a constructor Pencil (String brand, int length) which assigns the brand and length appropriately. Write also the getter/setter methods of the two attributes. Save the content under an appropriate file name. Copy the content of the file as the answers. (ii)...
Dears, I want unique and full answer to this question (not hand written and not image)....
Dears, I want unique and full answer to this question (not hand written and not image). Q: Review the four workable ethical theories from Chapter 2. Select two of the theories to use in this part. Prepare a 1­­–2 page written response to the following items: Apply one of the theories you selected to a moral dilemma/situation that you or someone you know has faced. What decision does this theory lead you to make regarding the dilemma? Apply the second...
I Found a Answer but I want another answer !! please answer During September 2020, due...
I Found a Answer but I want another answer !! please answer During September 2020, due to the very hot weather, the production of tomatoes in the local market in Gaza decreased by 60%. Explain the effect of this factor on the market equilibrium of tomatoes ? using graph Due to the financial crisis the income of government's employees has decreased by 50%, at the same time the number of frozen meat's sellers increased by 20%. Explain the effects of...
please I want you to answer this question and most importantly, the answer is not already...
please I want you to answer this question and most importantly, the answer is not already available on this site or other site Course Learning Outcome: Apply Organizational behavior knowledge and skills to manage diversified culture in the organizational settings (Lo 2.2). Essay: Differences in Culture and Diversity at workplace Essay Write an essay about the differences in Culture and Diversity at workplace. Use examples, peer-reviewed journals to support your answer. This essay must be at least 1000-word in length....
i want good answer with example plz i have a project useing java language but theacher...
i want good answer with example plz i have a project useing java language but theacher tell us u must use (java.util.Date) only to get the current year and month how can i do that plz jst using that class no celender or somthing else i need current year and current month to calculate the gurantee year and the guranttee month thax☺️
For international Business course please ansewr the below in details I want a report on the...
For international Business course please ansewr the below in details I want a report on the economic differences in the continent of Asia and the econmic characteristics of each parts. if Asia is divided into several Parts (West Asia, East Asia, South Asia, Southeast Asia and Central Asia).
I want a comparison between Virtual Reality platform and RFID technologies in libraries and why we...
I want a comparison between Virtual Reality platform and RFID technologies in libraries and why we prefer RFID than VR
Please! I want the instructions of how to solve it, not the answer. Write a program...
Please! I want the instructions of how to solve it, not the answer. Write a program that does the following in order: 1. Asks the user to enter a name 2. Asks the user to enter a number “x” 3. Asks the user to enter a number “y” 4. Calculates the sum of “x” and “y” 5. Prints out the number for “x”, “y” and “sum” An example of the program input and output is shown below: Enter your name:...
I want a project report about Rate of Return Analysis with references please. - Introduction -...
I want a project report about Rate of Return Analysis with references please. - Introduction - importance of rate of return to stakeholders ​​​​​​​- Benefits of rate of return - analysis of rate of return - examples - application of rate of return - conclusion
I want a report on water borne diseases
I want a report on water borne diseases
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT