Thin Lock Implementation

Bartosz Milewski bartosz at relisoft.com
Wed Aug 20 13:44:57 PDT 2008


dsimcha wrote:
> Thin locks sounds pretty cool, but I do have one question.  It seems like
> automatically inflating the lock the first time contention is detected is a fairly
> inefficient strategy, since the lock may be contested, but very infrequently.
> Would it be possible to keep track of the frequency of contesting and, if the lock
> is contested only, say, 1% of the time, just leave it as a spinlock?

The paper describing thin locks (my post has a link to it) claims that 
objects essentially come in two classes--the ones that are never 
contested, and the ones that are constantly contested. In-between 
situation are relatively rare.



More information about the Digitalmars-d mailing list