Incorrect parallel computation

*To*: mathgroup at smc.vnet.net*Subject*: [mg125939] Incorrect parallel computation*From*: Yasha Gindikin <gindikin at gmail.com>*Date*: Sun, 8 Apr 2012 04:16:00 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

Dear colleagues, would you please advise me on why the following simple code executes incorrectly when parallelized? a = Subsets[Range[1, 5], {3}]; L = Length@a; b = Table[0, {5}]; c = Table[0, {5}]; SetSharedVariable[c]; Do[b[[a[[l, k]]]] += 1, {l, L}, {k, 3}]; ParallelDo[c[[a[[l, k]]]] += 1, {l, L}, {k, 3}]; b===c False Thank you! Best regards, Yasha Gindikin.