Can a multi-threaded program ever be deterministic?

Knowing the algorithm will not actually allow you to predict what will happen when. All kinds of delays that happen in the execution of a program or thread are dependent on environmental conditions such as: available memory, swapping, incoming interrupts, other busy tasks, etc.

If you were to map your multi-threaded program to a sequential execution, and your threads in themselves behave deterministically, then your whole program could be deterministic and ‘concurrency’ issues could be made reproducible. Of course, at that point they would not be concurrency issues any more.

If you would like to learn more, http://en.wikipedia.org/wiki/Process_calculus is very interesting reading.

Leave a Comment