Giter VIP home page Giter VIP logo

Comments (5)

jbellis avatar jbellis commented on June 12, 2024

I think you can get an inconsistency even with two puts?

Thread 1: begin do/while loop
Thread 2: start increasing capacity
T1: add k,v to objects
T2: copy objects [including k, v] to newArray, promote newArray to active objects
T1: stamp is invalid, retry
T1: objects.getAndSet returns non-null, isInsert is false, so we do not increment size

I think we may have to switch to a pessimistic ReadWriteLock which makes me sad.

from jvector.

jbellis avatar jbellis commented on June 12, 2024

Possibly we could replace O(1) size() with a combination of

  • O(1) isEmpty
  • O(1) modificationCount
  • O(N) size() (just count the non-null keys)

from jvector.

jkni avatar jkni commented on June 12, 2024

I'm not sure the two put path works, since t1 retains isInsert to true across retries.

from jvector.

jkni avatar jkni commented on June 12, 2024

I also considered replacing O(1) size and didn't see a strong reason not to, other than the nagging feeling that we might be able to do something better.

from jvector.

jbellis avatar jbellis commented on June 12, 2024

It doesn't look like the difference in optimistic vs pessimistic on put is material, which makes sense b/c build does much more expensive things when adding a new node. So my PR takes that approach to keep things simple.

from jvector.

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.