But some existing optimizing compilers (including gcc, which tends to be relatively conservative) will optimize count_positives to
Question:
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?
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Operating Systems Internals and Design Principles
ISBN: 978-0133805918
8th edition
Authors: William Stallings
Question Posted: