Email list hosting service & mailing list manager

coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche (05 May 2021 18:30 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche (06 May 2021 10:28 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Feeley (06 May 2021 14:27 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche (06 May 2021 14:50 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Alexey Abramov (06 May 2021 15:32 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Nieper-Wißkirchen (06 May 2021 15:41 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche (06 May 2021 16:28 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Nieper-Wißkirchen (06 May 2021 16:37 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche (06 May 2021 16:48 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Nieper-Wißkirchen (06 May 2021 17:22 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Wolfgang Corcoran-Mathe (06 May 2021 19:13 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Nieper-Wißkirchen (06 May 2021 19:37 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Wolfgang Corcoran-Mathe (06 May 2021 21:54 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Nieper-Wißkirchen (07 May 2021 07:01 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Alex Shinn (07 May 2021 07:42 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Nieper-Wißkirchen (07 May 2021 08:35 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Alex Shinn (07 May 2021 08:41 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Nieper-Wißkirchen (07 May 2021 08:58 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Alex Shinn (07 May 2021 13:47 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche (06 May 2021 19:36 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Lassi Kortela (06 May 2021 19:40 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche Boubekki (06 May 2021 21:25 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Feeley (06 May 2021 17:07 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche (06 May 2021 21:01 UTC)
Re: coop - a concurrent ml-like wanna be (pre-SRFI) John Cowan (06 May 2021 21:25 UTC)

Re: coop - a concurrent ml-like wanna be (pre-SRFI) Marc Feeley 06 May 2021 17:07 UTC

> On May 6, 2021, at 10:49 AM, Amirouche <xxxxxx@hyper.dev> wrote:
>
>
> On 2021-05-06 16:26, Marc Feeley - feeley at iro.umontreal.ca wrote:
>> I’m not sure what your goal is with this SRFI.  Could you clarify?
>> SRFI-18 (Multithreading support) is supported by many Scheme
>> implementations and is the best thread API if you are interested in
>> portability accross Scheme implementations.  It seems some of the
>> things you are proposing have a direct link with SRFI-18 features, so
>> I don’t understand why a new SRFI is needed.
>
> So far, if we disregard PRIORITY, coop is only an alternative to SRFI-18.
>
> When priority is +inf.0 it should have exclusive access to a CPU.
> Otherwise it is a hint to implement fairness.

Have you looked at SRFI-21, which adds priorities to SRFI-18?  Note that few Scheme systems implement SRFI-21 because priorities require a carefully designed thread scheduler (as far as I know only Gambit implements SRFI-21).  So I doubt the priorities of coop can be implemented portably.

If channels are an important feature of coop please try to see if “mailboxes” can be used instead.  They are implemented by several Scheme implementations that support SRFI-18.  Here’s a simple example with Gambit (should also work as-is with Racket):

  (define t (thread
              (lambda ()
                (let loop ()
                  (let ((m (thread-receive))) (thread-send (car m) (sqrt (cadr m))))
                  (loop)))))

  (thread-send t (list (current-thread) 10)) ;; request sqrt of 10

  (thread-receive) ;; => 3.1622776601683795

Marc