guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile fibers return values


From: John Cowan
Subject: Re: Guile fibers return values
Date: Mon, 6 Jan 2020 16:47:12 -0500

Conceptually, parallelism and concurrency are two different and partly
independent things.  Parallelism refers to physically simultaneous
execution, as when you throw a ball into the air in each hand and catch it
in the same hand.  Each throw-catch cycle is a parallel process (using
"process" in the broad sense of the term).  Concurrency, on the other hand,
is *logically* simultaneous execution, as when you juggle three balls in
one or two hands.  Now the throw-catch cycle of each ball from one hand to
the other is a concurrent process, and it is also a parallel process if you
use two hands.  If you are using one hand, however, there is no parallelism
in juggling.

To make matters more confusing, "futures" in Racket are for parallelism,
whereas in Guile they are for concurrency.  Guile "parallel" and friends
are executed on futures (which are executed on OS threads), but use at most
as many futures as there are CPUs, so physically simultaneous execution is
at least encouraged if not actually guaranteed.  Racket parallelism only
operates until one of the parallel processes blocks or needs to synchronize
(which includes things like allocating memory): they are not implemented on
top of Racket threads, which are for concurrency (and have nothing to do
with OS threads).

A Scheme promise can be viewed as a type of parallel process that doesn't
actually provide parallelism (and in fact my parallel pre-SRFI is called
"parallel promises" and treats ordinary promises as a degenerate case) or
as a future that doesn't start to execute until you wait for it to finish
(and my futures pre-SRFI also treats promises as a degenerate case).

On Mon, Jan 6, 2020 at 4:15 PM Chris Vine <address@hidden> wrote:

> On Mon, 6 Jan 2020 20:42:17 +0100
> Zelphir Kaltstahl <address@hidden> wrote:
> [snip]
> > In Racket the futures have some limitations, where one needs to use a
> > different number type to enable them in some cases to run in parallel –
> > wait, I am looking for the link … here:
> > https://docs.racket-lang.org/guide/parallelism.html – Is there any
> > similar restriction for futures in Guile?
>
> I don't know.  I should try it and see.
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]