Re: coop - a concurrent ml-like wanna be (pre-SRFI) Amirouche Boubekki 06 May 2021 21:25 UTC
Hello and welcome Alexey! Le jeu. 6 mai 2021 à 17:32, Alexey Abramov - levenson at mmer.org (via srfi-discuss list) <firstname.lastname@example.org> a écrit : > > Hi, > > I am new here, but i think https://github.com/wingo/fibers > can be helpful. coop is mostly inspired from guile fibers. It covers those part of the manual: - https://github.com/wingo/fibers/wiki/Manual#22-operations - https://github.com/wingo/fibers/wiki/Manual#23-channels Except I renamed them to look more like R7RS. The rest is very specific to Guile. A work-stealing feature may be implemented on top of coop, or below coop. Gambit with the SMP flag turned on implement a similar feature to work-stealing as far as I understand. I did not write the full list of references yet. I did not re-use fibers code, but I did a pull-request with a few comments. The essential aspect I missed while reading the original CML paper is that there is a lock shared among all operations that are applied. Also coop-choice make it looks like operations are nested, but in fact they are flat (coop-choice some-produce some-consume (coop-choice some-sleep some-consume2)) is equivalent to (coop-choice some-produce some-consume some-sleep some-consume2), the order of operations does not matter, they are tried in some unspecified order, possibly taking into account priority. fibers and the original CML paper mention randomization. coop-wrap and coop-sleep are essential for robust code.