Enforcing Task Order using the .NET 4.0 Task Parallel Libraries?

No comment on the best abstraction for enforcing partial ordering, but if you use a BlockingCollection(new ConcurrentQueue()); coll. Add(5); // blocks if the collection is at max capacity int five = coll.Take(); // blocks if the collection is empty.

No comment on the best abstraction for enforcing partial ordering, but if you use a BlockingCollection wrapper around a ConcurrentQueue, that will give you a blocking Take operation to dequeue elements. E.g. : // the default is ConcurrentQueue, so you don't have to specify, but if you // wanted different behavior you could use e.g. ConcurrentStack var coll = new BlockingCollection(new ConcurrentQueue()); coll.

Add(5); // blocks if the collection is at max capacity int five = coll.Take(); // blocks if the collection is empty.

1 for BlockingCollection. – Drew Marsh Nov 3 '10 at 3:14 I was playing around with this, and unfortunately the way BlockingCollection is implemented it spends quite a bit of time spinning waiting for data after the queue is drained, so much so that it wasn't scalable to hundreds of sensors. I did experiment with queuing heuristics to keep multiple BC's full, which did meet my requirements, but the ultimate solution was a custom thread pool specific to the task which vastly outperformed my heuristically queuing algorithm.

– Chuu Nov 10 at 0:43.

The TPL DataFlow library (msdn.microsoft.com/en-us/devlabs/gg585582) might be a good fit for your application. It extends TPL with a dataflow paradigm that allows you to configure a processing graph and run in a high-performance execution environment. TPL Dataflow is available as a library on top of .

NET 4 and should ship as part of . NET 4.5.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions