Here is the context: I am writing an interpreter in C# for a small programming language called Heron, and it has some primitive list operations which can be executed in parallel.
One of the biggest challenges I am facing is to distribute the work done by the evaluator across the different cores effectively whenever a parallelizable operation is encountered. This can be a short or long operation, it is hard to determine in advance.
One thing that I don't have to worry about is synchronizing data: the parallel operations are explicitly not allowed to modify data.
So the primary questions I have is:
- What is the most effective way to distribute the work across threads, so that I can guarantee that the computer will distribute the work across two cores?
I am also interested in a related question:
- Roughly how long should an operation take before we can start overcoming the overhead of separating the work onto another thread?