[Omp] Shared Variable Problem

Yuan Lin Yuan.Lin at Sun.COM
Fri Jul 28 20:17:20 PDT 2006


Bronis,

I agree. Since KaveH did not say what he/she expected, I assume he/she 
was using only two threads and was wondering why the value from i is not 
updated.

I also mentioned the following in my previous reply.

> On Fri, 28 Jul 2006, Yuan Lin wrote:

>> Also depending on how the threads are scheduled, you may see thousands
>> of master: i=0 before you see  worker: i=1, 2, 3, ...., then you may see
>> master: i= some big number. Do not expect to see the value of i printed
>> from the master be to consecutive. There is no synchronization between
>> the master thread and the slave thread in your code.

With your email and the above text, I hope the reason is well explained.

Thanks.

-- Yuan
----------------------------------------
http://blogs.sun.com/roller/page/yuanlin
----------------------------------------


More information about the Omp mailing list