| ... | ... | @@ -56,7 +56,7 @@ in a letter, eg. 1.2.a, indicates a possible choice for question 1.2. |
|
|
|
|
|
|
|
### 1. Cooperative or preemptive concurrency?
|
|
|
|
|
|
|
|
**1.a.** The spec requires cooperative concurrency, preemption is
|
|
|
|
**Choice 1.a.** The spec requires cooperative concurrency, and preemption is
|
|
|
|
allowed as an extension. Both would be specified precisely in
|
|
|
|
terms of what progress and fairness guarantees the programmer can
|
|
|
|
expect.
|
| ... | ... | @@ -83,7 +83,7 @@ expect. |
|
|
|
- Long-running pure code must be refactored into the IO monad so
|
|
|
|
that explicit yield points can be inserted.
|
|
|
|
|
|
|
|
**1.b.** Preemption is required by the spec.
|
|
|
|
**Choice 1.b.** Preemption is required by the spec.
|
|
|
|
|
|
|
|
**Pros**
|
|
|
|
|
| ... | ... | @@ -121,7 +121,7 @@ expect. |
|
|
|
|
|
|
|
**2.1.** choices for concurrent calls:
|
|
|
|
|
|
|
|
**2.1.a.** we annotate concurrent calls:
|
|
|
|
**Choice 2.1.a.** we annotate concurrent calls:
|
|
|
|
|
|
|
|
> **a.** concurrent
|
|
|
|
> **b.** mayblock
|
| ... | ... | @@ -147,7 +147,7 @@ expect. |
|
|
|
> concurrently with other threads is a choice the programmer can
|
|
|
|
> reasonably make.
|
|
|
|
|
|
|
|
**2.1.b.** we annotate non concurrent calls:
|
|
|
|
**Choice 2.1.b.** we annotate non concurrent calls:
|
|
|
|
|
|
|
|
> **Rationale** for annotating the non-concurrent calls: this is a
|
|
|
|
> performance issue. It is always correct to make a concurrent
|
| ... | ... | @@ -196,12 +196,12 @@ We have a choice when it comes to `IORef`s, however. (Note that |
|
|
|
this only affects true multiprocessor implementations of concurrent
|
|
|
|
Haskell).
|
|
|
|
|
|
|
|
**3.a** Specify a weak memory model, in which `IORef` updates
|
|
|
|
**Choice 3.a** Specify a weak memory model, in which `IORef` updates
|
|
|
|
may be observed out of order, but specify that certain operations
|
|
|
|
(eg. `MVar` operations) constitute sequence points around which no
|
|
|
|
re-ordering may happen.
|
|
|
|
|
|
|
|
**3.b** Specify a strong memory model in which no re-ordering is
|
|
|
|
**Choice 3.b** Specify a strong memory model in which no re-ordering is
|
|
|
|
observable.
|
|
|
|
|
|
|
|
**Pros**
|
| ... | ... | |