Problem

But some existing optimizing compilers (including gcc, which tends to be relatively conser...

But some existing optimizing compilers (including gcc, which tends to be relatively conservative) will “optimize” count_positives to something similar to

void count_positives(list l)

{

list p;

register int r;

r = global_positives;

for (p = l; p; p = p -> next)

if (p -> val > 0.0) ++r;

global_positives = r;

}

What problem or potential problem occurs with this compiled version of the program

if threads A and B are executed concurrently?

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 4