Giter Club home page Giter Club logo

Comments (5)

chenggwang avatar chenggwang commented on June 11, 2024

@nitsanw Is that okay? see OOM can cause linked array qs to break #355

from jctools.

ceragon avatar ceragon commented on June 11, 2024

Please tell me the version of JCTools you are using, I can’t find the relevant code in the latest 4.0.1.

from jctools.

chenggwang avatar chenggwang commented on June 11, 2024

@nitsanw
Currently only modify BaseMpscLinkedArrayQueue.java poll() and peek, several other classes BaseMpscLinkedAtomicArrayQueue, BaseMpscLinkedUnpaddedArrayQueue have not been modified, if my solution is correct I'll then update the others as well. I also submitted a PR. #381

from jctools.

ceragon avatar ceragon commented on June 11, 2024

In this PR #371, the author also wants to get data as much as possible. But @franz1981 thinks that we should follow the principle of "fast failure", instead of using spin to consume CPU. Therefore, I think your suggestion may not be accepted.

from jctools.

nitsanw avatar nitsanw commented on June 11, 2024

Thanks for reporting, repeating my comment from the PR:

Your error is here:

cIndex-pIndex==0 , Empty

No, (cIndex-pIndex/2==0) is the empty condition. That's why we have that as the entry condition for emptiness with the comment // isEmpty? and why isEmpty() is implemented the way it is.

The edge case being decided here is that if the queue is resizing when empty, it is still empty.

More reasoning:
This is an avenue we have intentionally decided not to go down. It is consistent between poll/peek/size/isEmpty/iterator etc. And yes, people with chunk size 2 can hit this frequently, but they are also making a configuration error. These queues don't really make much sense with chunk size less than cache line (8 or 16 elements, depending on oop size).

from jctools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.