|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Draft Chapter: Concurrency
|
|
|
|
|
|
|
|
|
| ... | ... | @@ -30,6 +33,10 @@ Operations performed by multiple threads may be interleaved arbitrarily by the i |
|
|
|
This is called the *fairness guarantee*. An implementation technique that is often used to provide this fairness guarnatee is *pre-emption*: running threads are periodically pre-empted in software in order to let other threads proceed. There are other implementation techniques that also work; for example, hardware concurrency. (**ToDo?**: move this text to a footnote or separate section?)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**ToDo?**: explain "blocking".
|
|
|
|
|
|
|
|
|
|
|
|
## The `ThreadId` type
|
|
|
|
|
|
|
|
|
| ... | ... | @@ -51,7 +58,7 @@ The `ThreadId` type is abstract, and supports `Eq`, `Ord`, and `Show`, with the |
|
|
|
|
|
|
|
- `Show`: the results are implementation-defined, this is mainly for debugging.
|
|
|
|
|
|
|
|
## Communication
|
|
|
|
## Communication between Threads
|
|
|
|
|
|
|
|
|
|
|
|
|
| ... | ... | |