.Net 4 & Parallel-Programming: Quick Start

Ok, you’ve to think to your code and data structure in a different way to leverage multi-cores processor at their best, but with VS 2010 and .Net 4.0 it’s very easy to begin the development of concurrent algorithms and procedures:


Remember that:

  • Always think to synchronization of task. Having concurrency features doesn’t mean that you’ve to start parallel processing indiscriminately!
  • You cannot parallelize DB operations (well you can if you use a connection for each task, better on different tables and pay attention to DB locking);
  • If you share data structures between the concurrent tasks protected them with lock(mydatastructure( if you’ve to update or change them (for example a Dictionary<>).

No comments: