eonil
eonil

Reputation: 85975

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?

Upvotes: 9

Views: 2064

Answers (2)

axel22
axel22

Reputation: 32335

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.

Upvotes: 10

Wyzard
Wyzard

Reputation: 34563

I haven't heard the term before, but coroutines come to mind. They don't provide "true" concurrency, in the sense that only one routine is executing at any particular moment, but they're concurrent in the sense that a group of interacting coroutines can all make progress without having to wait for each other to finish.

Upvotes: 0

Related Questions