unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
Cc: Mikael Djurfeldt <mdjurfeldt@gmail.com>, guile-devel@gnu.org
Subject: Re: About 'futures'
Date: Tue, 08 Mar 2005 15:37:36 -0600	[thread overview]
Message-ID: <87sm35yg2n.fsf@trouble.defaultvalue.org> (raw)
In-Reply-To: <ljhdjmrp3y.fsf@troy.dt.e-technik.uni-dortmund.de> (Marius Vollmer's message of "Tue, 08 Mar 2005 19:04:17 +0100")

Marius Vollmer <marius.vollmer@uni-dortmund.de> writes:

> what is the difference between
>
>     (join-thread (begin-thread (foo)))
>
> and
>
>     (future-ref (future (foo)))
>
> I am thinking about implementing futures as just
>
>     (define-macro (future exp) `(begin-thread ,exp))
>     (define future-ref join-thread)
>
> Would that make sense?

Based on what I know of the semantics of the respective operations, it
seems fine.

Though is a terminated thread very "heavy"?  i.e. is it much heavier
than a cons pair?  If so, then one optimization for futures would be
to implement them such that when the thread is finished, the thread
pointer is dropped, so that only the result remains.

One way to do that might be to represent a future as (cons thread
result-destination).  Given that, future-ref would either join-thread
or call cdr as appropriate.  Although you'd probably also need a mutex
which might obviate any potential resource savings achieved by
dropping the thread.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  parent reply	other threads:[~2005-03-08 21:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-08 18:04 About 'futures' Marius Vollmer
2005-03-08 20:52 ` Mikael Djurfeldt
2005-03-08 23:35   ` Kevin Ryde
2005-03-09 15:15   ` Marius Vollmer
2005-03-09 19:02     ` Marius Vollmer
2005-03-09 19:50       ` Rob Browning
2005-03-08 21:37 ` Rob Browning [this message]
2005-03-09 15:17   ` Marius Vollmer

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=87sm35yg2n.fsf@trouble.defaultvalue.org \
    --to=rlb@defaultvalue.org \
    --cc=guile-devel@gnu.org \
    --cc=mdjurfeldt@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).