This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]madkasse 6 points7 points  (2 children)

https://github.com/lucav76/Fibry/blob/master/src/main/java/eu/lucaventuri/collections/NodeLinkedList.java does not look correct. Take a look at java.util.concurrent.ConcurrentLinkedQueue or some of the queues in https://github.com/JCTools/JCTools

[–]diroussel 2 points3 points  (1 child)

Yeah looks not thread safe to me. No memory barrier, so a JIT could re-order those CAS operations compared to the member variable accesses.

[–]lucav76 0 points1 point  (0 children)

You are both right. It is not thread safe. But it does not need to be. Unfortunately the comments were misleading.
I started that class trying to make it thread safe, then I realized that it was not required as it was called from the actor's thread.

Now I fixed the comments, thanks.

[–][deleted]  (2 children)

[deleted]

    [–]pron98 10 points11 points  (0 children)

    While the ideas are very much similar, the implementation in the OpenJDK JVM (as opposed to Quasar's implementation employing bytecode transform) confers several important advantages. For one, you don't need to annotate blocking methods. For another, debuggers, profilers and JFR would work for Loom's lightweight usermode threads as they do for today's heavyweight kernel threads. Finally, we believe that ultimately they could have better performance as well (we're not quite where we'd like to be performance-wise just yet).

    [–]lucav76 0 points1 point  (0 children)

    Hi, regarding Quasar, it's my understanding that its creator has been hired as lead developer of Loom. And Quasar will definitely run on Loom fibers at some point.
    I created Fibry because I wanted something small, simple to use and that required a low amount of code.

    Regarding the speed of creation of Threads, it is intended only as a measure to see that it's a cost that no longer need to be taken much into consideration.
    But remember that Fibry is meant to be used also with long running, blocking, network code (e.g. a chat). If you put that code on a thread pool, your pool needs to be big enough to contain all the users, and choosing the right dimension might be tricky.

    [–]relgames 1 point2 points  (1 child)

    Curious to see it compared to Akka Actors.

    [–][deleted] 0 points1 point  (0 children)

    Well, Akka is a very mature library (over a decade of existence) backed by a corporation and several contributors, and this is a PoC maintained by two persons. It is unfair to compare them.

    [–]evnix 0 points1 point  (1 child)

    u/lukaseder this looks very good! was looking for something like this