[plt-dev] Parallel Futures Release
On Mon, Dec 7, 2009 at 12:31 PM, James Swaine <james.swaine at gmail.com> wrote:
> I'm pleased to announce the initial release of parallel futures, a
> construct for fine-grained parallelism in PLT. Roughly speaking, a
> programmer passes a thunk to 'future' and it gets run in parallel.
> That "roughly" holds a few gotchas, partly because we're just getting
> started and partly due to the technique we're using. See the
> documentation for more details:
Another belated question about this:
Say I have two big non-primitive-calling computations, which don't
affect each other at all. I gather that this is the intended use case
for futures. Each of them produces a number, and the result of my
program should be the sum of the two numbers. How would I write this?
I originally though I'd do this:
(let ([f1 (future big-comp1)] [f2 (future big-comp2)])
(+ (touch f1) (touch f2)))
But this implies lots of potentially-unnecessary communication - I
start each computation on a separate OS thread, and then I join them
before they're done. I'd rather be able to wait until I know that
`f1' and `f2' are done before using `touch'. Is there a way to do
that?
--
sam th
samth at ccs.neu.edu