Question: In JAVA The first task involves contrasting the performance of programs with and without caching. In particular, you will be working with the volatile keyword

In JAVAIn JAVA The first task involves contrasting the performance of programs with

The first task involves contrasting the performance of programs with and without caching. In particular, you will be working with the volatile keyword in Java. The volatile keyword informs the compiler that the variable should not be cached and accesses should always go to main memory. To profile the impact of caching, you will be contrasting the performance of loops when the loop variable is marked volatile and when the volatile keyword is not used for the loop variable. Your loop will maintain a running total of the addition and subtraction operations using the loop variable. The choice of whether you perform an addition or subtraction to the runningtotal is based on whether the loop variable is odd or even for the given iteration. If the loop variable is even (e.g.,10) then you should add the loop variable to the runningTotal; if the loop variable is odd (e.g., 37) then you should subtract the loop variable from the runningtotal. To cope with potential overflows/underflows runningtotal should be a long variable type. For times calculate the average time taken to perform runningtotal when the loop variable ranges from [0,)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!