Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O(1) insertion, fully non-blocking data structure #363

Open
jwaterson opened this issue Aug 14, 2022 · 4 comments
Open

O(1) insertion, fully non-blocking data structure #363

jwaterson opened this issue Aug 14, 2022 · 4 comments
Labels

Comments

@jwaterson
Copy link

Does JCTools provide a data structure that inserts in O(1) time and never blocks on any insert operation (must not block access to the structure nor any subsection of it)?

@franz1981
Copy link
Collaborator

franz1981 commented Aug 14, 2022

Most data structures provide a fail fast variant that do not block while performing insertion (not even compare and set retries). It is what you mean?

See

public final int failFastOffer(final E e)

While others still provide waitFree (bounded to population) alternatives (but still to be demonstrated), see xadd mpmc/mpsc xadd q offers.

@jwaterson
Copy link
Author

Just a couple of questions if you don't mind @franz1981 :

  1. Instead of blocking, a write might fail and optionally be reattempted? Can potential failure be avoided somehow?
  2. Would MpscArrayQueue for example achieve O(1) insertions and never block write access?

I'm not familiar at all with JCTools, so thank you for your patience :)

@franz1981
Copy link
Collaborator

  1. Yep, by using the mentioned fail fast variant
  2. Same as 1

@jwaterson
Copy link
Author

jwaterson commented Aug 14, 2022

@franz1981, how is failure avoided entirely, sorry? Do you mean that with retries, failure can eventually be avoided?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants