Re: Locking of nodes in tree for concurrent access



Hi Lew,

thanks for the answer. At least someone was able to understand what I
was trying to explain about what I was thinking of .. ;-). I should
have mentioned that I don't store the data in the leaf nodes as this
is usually the case but in the respective node somewhere within the
tree. Some item is categorized by N criterias (a criteria is the value
of a basic data type such as String, int, etc. including null). N is
typically rearely larger than, say, 5. Iterating over the list of
criterias for every next criteria a new sub node is created.

You also have to be very, very careful about deadlock.
... but it looks from your description as though you
might acquire locks in different orders, a recipe for disaster.

All right. I see the point. I will have a look into the book you
mentioned. Maybe I get some hint the :-)

Thanks, Oliver

On 3 Nov., 14:10, Lew <no...@xxxxxxxxxxxxx> wrote:
oliver...@xxxxxx wrote:
So far I see no logical error in that approach. My concern is that
this approach might not be very efficient under heavy load (large
number of concurrent accesses of the tree), because for every visited
node in the tree the node's lock has to be opened and closed. That is

For a good understanding of Java concurrency in practice, an excellent
resource is /Java Concurrency in Practice/ by Brian Goetz, et al.

Java 6 has much more efficient handling of locks than earlier versions.
Still, your approach does seem very inefficient at first blush.

You also have to be very, very careful about deadlock.  Without seeing an
SSCCE it's hard to be sure, but it looks from your description as though you
might acquire locks in different orders, a recipe for disaster.

--
Lew

.



Relevant Pages

  • Re: Locking of nodes in tree for concurrent access
    ... node in the tree the node's lock has to be opened and closed. ... For a good understanding of Java concurrency in practice, an excellent resource is /Java Concurrency in Practice/ by Brian Goetz, et al. ... Without seeing an SSCCE it's hard to be sure, but it looks from your description as though you might acquire locks in different orders, a recipe for disaster. ...
    (comp.lang.java.programmer)
  • Urgent: Concurrency in SQL Server 2005: How to use granularity of Locks in Snapshot isolation level
    ... I have developed a VS 2005 database application which has the concurrency ... Locking granularity (database, table, [age, row, ... Versioning (snapshot isolation, read committed ... I would like to use the granularity of locks (rows or index ...
    (microsoft.public.sqlserver.clients)
  • Concurrency in a multi-user environment
    ... concurrency in a multi-user PHP/MySQL environment. ... does locking a record prevent file locks (when new ... numeric field in the table. ...
    (php.general)
  • Re: Serious concurrency problems on fast systems
    ... I worked on a big Java Enterprise project a while ago that had highly concurrent deployment but made quite a number of concurrency mistakes that hugely slowed it down. ... Aside from the fact that the JVM optimizes lock acquisition in the uncontended case, once a thread blocks on a monitor, all the other threads also trying to acquire that monitor also block. ... On that big project we proved this with various enterprise monitoring products that reported on locks, wait times for locks and other performance issues. ... We did three things on that project to improve concurrency: eliminated shared data, made shared data immutable, and used 'java.util.concurrent' classes. ...
    (comp.lang.java.programmer)
  • Re: [RFC][PATCH 4/4] configfs: Make multiple default_group destructions lockdep friendly
    ... to allow all the locks to be held at once. ... otherwise lockdep will issue a warning as soon as one tries to remove ... VFS locking of the same mutexes? ... a tree are always taken while respecting a same order. ...
    (Linux-Kernel)