unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: John Cowan <cowan@ccil.org>
To: Chris Vine <vine35792468@gmail.com>
Cc: Guile User <guile-user@gnu.org>
Subject: Re: Guile fibers return values
Date: Mon, 6 Jan 2020 16:47:12 -0500	[thread overview]
Message-ID: <CAD2gp_T=MqcXsFh2-0O06U0QGMeK9vLVDcLjkMOzv1m+O89YdA@mail.gmail.com> (raw)
In-Reply-To: <20200106211456.68c8a637631a4e1e977d8443@gmail.com>

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 <vine35792468@gmail.com> wrote:

> On Mon, 6 Jan 2020 20:42:17 +0100
> Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> 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	other threads:[~2020-01-06 21:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-05  1:30 Guile fibers return values Zelphir Kaltstahl
2020-01-05 12:33 ` Chris Vine
2020-01-05 12:58   ` Zelphir Kaltstahl
2020-01-05 14:28     ` Chris Vine
     [not found]     ` <20200105142358.4ad96d15a23a0b947b2d55e3@gmail.com>
2020-01-05 18:22       ` Zelphir Kaltstahl
2020-01-05 21:45         ` Chris Vine
2020-01-06 19:42           ` Zelphir Kaltstahl
2020-01-06 21:14             ` Chris Vine
2020-01-06 21:47               ` John Cowan [this message]
2020-01-06 22:45                 ` Zelphir Kaltstahl
2020-01-07  1:36                   ` John Cowan
  -- strict thread matches above, loose matches on Subject: below --
2020-01-04 22:49 Zelphir Kaltstahl
2020-01-05  2:42 ` John Cowan
2020-01-05 12:46   ` Zelphir Kaltstahl
2020-01-14 10:59 ` Amirouche Boubekki
2020-01-15  0:04   ` Zelphir Kaltstahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD2gp_T=MqcXsFh2-0O06U0QGMeK9vLVDcLjkMOzv1m+O89YdA@mail.gmail.com' \
    --to=cowan@ccil.org \
    --cc=guile-user@gnu.org \
    --cc=vine35792468@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).