Reputation: 21
I'm writing some program which should perform calculations concurrently according to inputs which reach the system all the time. I'm considering 2 approaches to allocate "calculation" processes:
I need to know the following inputs from a "calculation" process:
Thanks in advance. Any help would be appreciated.
Upvotes: 2
Views: 58
Reputation: 2706
I'm not sure what you mean by 'read the system' so I'll just make some assumptions that you can correct:
It sounds like there are two things here. First, you want an effective queueing mechanism for all jobs, and jobs that fail need to be re-enqueued. Second, you probably actually just want multiple threads, rather than processes.
ThreadPool is a good place to start. You can queue a new thread with a new work item, and if that thread fails, re-enqueue the work item. The queue can be as simple as teh Queue of T in .net. But check the thread safety - you may need to implement your own locking on the queue to ensure no two threads dequeue an item at the same time.
Without more information about the tasks and a terminology clear up, I can't help you much more.
Upvotes: 0
Reputation: 72658
I think you want threads, not processes. .NET has a ThreadPool class which does pretty much what you need, I think.
Upvotes: 4