Re: Is this easy locking of a Hashtable's element too good to be true?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Niccholas,

says something different. It seems like what you want to do is isolate
operations on a thread that deal with an element in the hash table.

Correct.

Your code is only off by a little bit. Instead of locking on
ht["row1"], you should lock on ht. The reason for this is that ht["row1"]
will return an object, but it doesn't synchronize access to the hashtable
itself. Since you are trying to change what a key is associated with, you
have to work on this level.

There's the rub. I need to lock the "row" because the app is under heavy
load by many users and the business logic dictates that each requests knows
what the other did, make a desicion and then save the result back in to the
row.

By locking the entire Hashtable it blocks all the other threads from doing
their business on other keys. This creates a bottoleneck in my app.

I'd like to enable multple threads to work on other "rows" simoutanously.
Making threads wanting the same "row" wait with a lock is not only okay, but
required.

Any ideas?






.



Relevant Pages

  • Re: Is this easy locking of a Hashtables element too good to be true?
    ... When you are retrieving an ... synchronize access to that object, then you can lock on that. ... This creates a bottoleneck in my app. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: rwlocks: poor performance with adaptive spinning
    ... I wanted the turnstile chain lock to protect only the association between ... the turnstile chain that may be due to hash collisions. ...
    (freebsd-arch)
  • Re: Lock problem - concurrent users
    ... Clipper 5.2 app at a client of mine. ... The app lives on a Win2003 Small Business server, ... Have you been able to determine if your lock routine fails to lock the ...
    (comp.lang.clipper)
  • Re: Ocfs2 performance bugs of doom
    ... with global lock systime badness, and I already have more performance bugs ... and quadrupled the size of the hash table. ... Btw, for what it's worth, here's some single untar numbers I have lying ... A quick glance at SysRq-t shows ocfs2 waiting ...
    (Linux-Kernel)
  • Re: "Crystallizing" Objects
    ... Hash has no such thing yet. ... I think that logic variables would not fit well into current Ruby. ... If it were just a normal hash, we would have to lock the object manually ... insertion another check and insertion could have occurred and the ...
    (comp.lang.ruby)