guile-devel
[Top][All Lists]
Advanced

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

Re: Continuation sets and order-independency


From: Mark H Weaver
Subject: Re: Continuation sets and order-independency
Date: Fri, 13 Jan 2012 21:18:16 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

David Kastrup <address@hidden> writes:
> I assume that the above list could contain more than a single call of
> (suspend).

Yes, of course.

>> For example, (%% list 1 2 3 (begin (suspend) 4) 5) expands to:
>>
>>   (call-with-values
>>       (lambda () (parallel (suspendable list)
>>                            (suspendable 1)
>>                            (suspendable 2)
>>                            (suspendable 3)
>>                            (suspendable (begin (suspend) 4))
>>                            (suspendable 5)))
>>     (lambda (proc . args)
>>       (apply (final-values proc) args)))
>>
>> Is this what you're looking for, or something close to it?
>
> Not really.  The above uses "parallel", and if I remember correctly,
> this implies multi-threaded execution and true asynchronicity
> (preemptive scheduling).  I was rather thinking about avoiding the
> overhead and work things off serially but without stopping if one part
> runs into suspension, but rather commencing with another part of the
> expression until every branch has run into suspension.  Effectively
> multithreading without preemption and the associated costs.

That's easy enough.  Simply changing `parallel' to `values' in the
definition of %% would be enough to get rid of the parallelism, but
here's a simpler definition for a non-parallel %%:

  (define-syntax-rule (%% op operand ...)
    (op (suspendable operand) ...))

With this one change, I think this now does what you are describing.

      Mark



reply via email to

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