-
Notifications
You must be signed in to change notification settings - Fork 104
LinkedSparseMatrix thread safe set #44
Comments
this is incredibly non-trivial... |
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 |
You can do it with far fewer locks - you use a master lock to obtain lock instances. 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 |
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... |
giving up on this... too complicated! |
it would be great to be able to do parallel sets, and then effectively do streaming adjacency matrix construction as part of an Observable/RX pattern.
The text was updated successfully, but these errors were encountered: