i’m writing some code that basically receive data from socket, perform deserialization and then passed to my application.the deserialized objects can be grouped by their id’s (the id is being generated during the deserialization process).
to increase the performance of my application i wanted to use the new parallelism capabilities that came with C# 4.0. the only constraint i have is that 2 threads cannot access object with the same id’s. now i know that i can just perform lock() on a sync object that will be placed inside the object but i want to avoid these locks (performance is an issue here).
The design I’ve thought about:
- create some kind of partitioner that will split data by the ID (this will make sure that every buffer i’ll get will always have the same object id’s group together).
- assign thread by using TPL of PLINQ
can someone suggest me some sources that do that?
I would suggest
PLINQwhen developing for multiple processors or cores.This covers:
Parallel LINQ (PLINQ)