4 ms·
Go's work-stealing scheduler is crude in comparison to Doug Lea's, which is a work of artful mechanical sympathy: https://github.com/netroby/jdk9-dev/blob/maste
by pron 9y ago
Go's work-stealing scheduler is crude in comparison to Doug Lea's, which is a work of artful mechanical sympathy: https://github.com/netroby/jdk9-dev/blob/master/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java#L173 https://github.com/netroby/jdk9-dev/blob/master/jdk/src/java...
- samuell 9y agoStuff that Quasar leverages (or will leverage), I gather? :) Any more details to share about the differences? Something that Go could readily learn from? :)
- pron 9y agoNot just Quasar, but pretty much any high-level concurrency framework (Akka uses it, too). Doug's algorithm is lock-free (except in some marginal features, that are not supported and not relevant for the Go implementation anyway) and displays exceptional scalability even on machines with a large number of cores. AFAICT, Go could copy Doug's implementation completely.
- geodel 9y agoOfcourse. And Oracle would be so pleased with that like they always are with Google copying Oracle code. [1] 1. https://www.theverge.com/2012/4/19/2961128/google-chief-java-architect-likely-i-copied-sun-code-in-android https://www.theverge.com/2012/4/19/2961128/google-chief-java...
- pron 9y agoI am not aware of any lawsuits involving Oracle over code used in accordance with its license. The Google lawsuit was over code that Google believed the license did not apply to, and they could therefore use not in accordance with the terms. In any event, the license of Doug Lea's code is creative commons.
- RossBencina 9y agoIt's not even Creative Commons, it's CC-zero, which is public domain or as close as it gets. Strangely, the file that you linked has a GPL overlay: /* * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file: * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ https://github.com/netroby/jdk9-dev/blob/master/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java#L25 https://github.com/netroby/jdk9-dev/blob/master/jdk/src/java... I wonder where the original CC-zero version is located.
- pron 9y agohttp://g.oswego.edu/dl/concurrency-interest/ http://g.oswego.edu/dl/concurrency-interest/
- nerdponx 9y agoAs someone who knows nothing about schedulers, care to explain?
- jlouis 9y agoThere are times where a simple solution can beat more complex solutions. That said, Doug's work is indeed beautiful. Another quite beautiful model is the one by Occam Pi, which has a certain simplicity ring to it: https://www.cs.kent.ac.uk/pubs/2012/3210/content.pdf https://www.cs.kent.ac.uk/pubs/2012/3210/content.pdf
- geodel 9y agoSeems like a reasonable take on Java Fork-Join shortcomings [1]. One of them is exceeding complexity which of course is very popular in Java world and the comment shows how Go version is 'crude' so apparently not good enough. "The F/J framework classes - 1) have many, many levels of inheritance, 2) nested classes on top of nested classes, 3) instance variables used directly by other classes (known internally as “representation-level coupling among classes”), code from the Hackers Delight without comments about what it does, 4) homegrown deques and queues instead of standard Java™ Classes, and so much more." 1. http://www.coopsoft.com/ar/CalamityArticle.html http://www.coopsoft.com/ar/CalamityArticle.html
- ianopolous 9y agoOne should bear in mind that the author of that article has a strong vested interest against the JVM's ForkJoin framework succeeding, because they are senior at a company whose sole product is a competing implementation of a similar idea [1]. 1. http://www.coopsoft.com/Products.html http://www.coopsoft.com/Products.html
- cooper6 9y agoNO. The TymeacDSE product was released after JDK1.7. I took the proof-of-concept I gave Doug and made a professional product out of it. See the article "Is there a better way."
- pron 9y agoThe remarkable thing about the implementation is the algorithm, not the programming style. Doug Lea's programming style has always been, and always will be, somewhat... idiosyncratic. Much of it is because he must take into account truly low-level details of compiler optimizations (and you can see that the implementation changes from one Java version to the other). He always warns people not to code like him. In any event, the beauty of the code (like in all of Doug Lea's code) is not in the programming style but in the algorithm and the attention to detail.
- stcredzero 9y ago
- bassman9000 9y agoMore here: http://gee.cs.oswego.edu/dl/papers/fj.pdf http://gee.cs.oswego.edu/dl/papers/fj.pdf
- bassman9000 9y agoNeat For the main tests, programs were run on a 30−CPU Sun Enterprise 10000 running the Solaris Production 1.2 JVM (an early version of the 1.2.2_05 release) on Solaris 7. And slides: http://gee.cs.oswego.edu/dl/cpjslides/fj.pdf http://gee.cs.oswego.edu/dl/cpjslides/fj.pdf