equal
deleted
inserted
replaced
1 (* Title: Pure/Concurrent/future.ML |
1 (* Title: Pure/Concurrent/future.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Makarius |
3 Author: Makarius |
4 |
4 |
5 Functional threads as future values. |
5 Future values. |
|
6 |
|
7 Notes: |
|
8 |
|
9 * Futures are similar to delayed evaluation, i.e. delay/force is |
|
10 generalized to fork/join (and variants). The idea is to model |
|
11 parallel value-oriented computations, but *not* communicating |
|
12 processes. |
|
13 |
|
14 * Futures are grouped; failure of one group member causes the whole |
|
15 group to be interrupted eventually. |
|
16 |
|
17 * Forked futures are evaluated spontaneously by a farm of worker |
|
18 threads in the background; join resynchronizes the computation and |
|
19 delivers results (values or exceptions). |
|
20 |
|
21 * The pool of worker threads is limited, usually in correlation with |
|
22 the number of physical cores on the machine. Note that allocation |
|
23 of runtime resources is distorted either if workers yield CPU time |
|
24 (e.g. via system sleep or wait operations), or if non-worker |
|
25 threads contend for significant runtime resources independently. |
6 *) |
26 *) |
7 |
27 |
8 signature FUTURE = |
28 signature FUTURE = |
9 sig |
29 sig |
10 type task = TaskQueue.task |
30 type task = TaskQueue.task |