An image speaks more than words, so here is basically what I want to achieve :
(I have also used a fruit analogy for the sake of genericity an simplicity)
I've done this kind of stuff many time in the past using different king of .Net classes (BackGroundWOrkers, ThreadPool, Self Made Stuff...)
I am asking here for the sake of advice and to get fresh ideas on how to do this efficiently.
This is a high computing program so I am receiving Millions of (similar in structure but not in content) data, that have to be queued in order to be processed according to its content type. Hence, I want to avoid creating a parallel task for each single data to be processed (this overloads the CPU and is poor design IMHO). That's why I got the idea of having only ONE thread running for EACH data TYPE, dedicated to processing it (knowing that the "Press Juice" method is generic and independent of the fruit to be pressed)
Any Ideas and implementation suggestions are welcome.
I am free to give any further details.
NET Core, C# and async coding. If you have several tasks that can be run in parallel, but still need to wait for all the tasks to end, you can easily achieve this using the Task. WhenAll() method in .
The Task Parallel Library (TPL) is a set of public types and APIs in the System. Threading and System. Threading. Tasks namespaces. The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications.
Parallel tasks are split into subtasks that are assigned to multiple workers and then completed simultaneously. A worker system can carry out both parallel and concurrent tasks by working on multiple tasks at the same time while also breaking down each task into sub-tasks that are executed simultaneously.
TPL DataFlow seems like a very strong candidate for this.
Take a read of the intro here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With