Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's *Deterministic concurrency*?

I heard that there are 3 kind of concurrency.

  1. Deterministic concurrency
  2. Message-passing concurrency
  3. Shared-state concurrency

I know #2 (=actor model) and #3 (=general threading), but not #1. What's that?

like image 651
eonil Avatar asked Feb 24 '11 06:02

eonil


1 Answers

Deterministic concurrency is a concurrent programming model such that programs written in this model have the following property: for a given set of inputs, the output values of a program are the same for any execution schedule. This means that the outputs of the program depend solely on the inputs of the program.

There are ways to ensure this property. One of the ways is the so-called single-assignment programming where variables don't have to be initialized, but may be assigned at most once. Reading an uninitialized variable stalls until it's assigned a value (possibly by some other thread). The Mozart programming language has support for these.

Another way is to use ownership analysis to determine which threads 'own' different references, and to ensure that no 2 threads write to the reference at the same 'time', so there are no data races.

like image 74
axel22 Avatar answered Oct 13 '22 21:10

axel22