I am coding in c#.net 4.0 for my project on parallelism.
After coding I came across a problem that parallel exec. time is coming more than sequential one.
'x' and 'y' are global arrays variables.
Program object1= new Program();
Program object2= new Program();
object1.func1(x);
object1.func2(x);
object1.func3(x);
object1.func4(x);
object2.func1(y);
object2.func2(y);
object2.func3(y);
object2.func4(y);
Parallel.Invoke(
() =>
{
object1.func1(x);
object1.func2(x);
object1.func3(x);
object1.func4(x);
},
() =>
{
object2.func1(y);
object2.func2(y);
object2.func3(y);
object2.func4(y);
});
The problem may be of false sharing, but I if two different copies of variables through objects are being used, then there should not be a problem of false sharing..! I don't know exactly what is the problem actually. Please help.