Giter Club home page Giter Club logo

Comments (5)

fommil avatar fommil commented on June 27, 2024

this is incredibly non-trivial...

from matrix-toolkits-java.

fommil avatar fommil commented on June 27, 2024

hmm, to be able to use locks I think we'd need to have nodes for all the zeroeth rows and colums, i.e. a memory cost of N + M for an NxM matrix. I might create Scala feasibility of this in a scratch area.

from matrix-toolkits-java.

rorygraves avatar rorygraves commented on June 27, 2024

You can do it with far fewer locks - you use a master lock to obtain lock instances.
Create two methods e.g.:

class LockController {
  def aquire(n : Int,m : Int) : (Lock,Lock) = synchronized {
     // we are in a guardian lock we can create new locks for N or M as needed.
  }

  def release(nLock : Lock,mLock : Lock) = synchronized {
    // we are in the guardian lock - assuming no more holder we can free locks as we feel.
  }
}

Obviously the N/M locks could be returned as a pair with aquire/release logic to ensure correctness.

This way you can reuse a very small number of locks,which approximates your row contention ratio rather than tracking NxM

from matrix-toolkits-java.

fommil avatar fommil commented on June 27, 2024

main problem is that I need to rethink the structure to facilitate row/column locks. The current structure is not limited to a row or column :-/ writing tests for the new structure as we type...

from matrix-toolkits-java.

fommil avatar fommil commented on June 27, 2024

giving up on this... too complicated!

from matrix-toolkits-java.

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.