Anurag Malani

Anurag Malani

  • NA
  • 80
  • 34.4k

Task Parallelism

May 14 2015 7:47 AM
Hi All,
I have billions of records and i have to do some long calculation on those records. If I am using a sequential for loop then it takes around 7hr to complete that task which is not affordable. To overcome with this, I'm using Parallel.For but the catch is concurrency is occurred in jobs.

Example -
1. Run Parallel.For on 10 records, it creates 10 threads for each record.
2. While executions, First Thread is done with all the calculation and clear the data.
3. Here Second or Reaming Threads getting error in the calculation says - data in not available


How can we resolve this concurrency probleam?

The ultimate goal of my code is to create a new instance for that record and run separately in these block and should not affect the others.


Answers (4)