Re: A new Critical Section for high contention situations
- From: Keith Moore <keithmo@xxxxxxxxxx>
- Date: Thu, 15 May 2008 10:57:57 -0700
Kürsat wrote:
Keith,
Thank you for your comments. I am not agree with you about your claims below :
You said "there is no synchroniztion", then, what does synchronization mean? AFAIK, synchronization means "accepting only one thread to access certain resource or functionality at a time". My object achive this, so, I think, there is synchronization.
You said "there is no contention", then what does contention mean? AFAIK, contention (in the current context) means "more than one thtread to attemp to access certain resource or functionality at the same time". While using my object, this condition is highly possible, so "there is contention".
You mentioned "race conditions" but, race conditions occurs on resources not on synchronization objects.
Please correct me if I am in the wrong. I don't claim that this short implementation is correct but your arguments are contradictory with my knowledge.
Consider the following sequence of events:
Thread A owns the lock (m_nLock == OWNED).
Thread B calls enter().
Thread B's InterlockedCompareExchange() returns OWNED, so Thread B calls Sleep(0).
Thread B's Sleep(0) call returns before Thread A calls leave().
Thread B's call to enter() returns.
At this point, Thread A owns the lock, but Thread B "thinks" it owns the lock.
.
- Follow-Ups:
- References:
- A new Critical Section for high contention situations
- From: Kürşat
- Re: A new Critical Section for high contention situations
- From: Keith Moore
- Re: A new Critical Section for high contention situations
- From: Kürsat
- A new Critical Section for high contention situations
- Prev by Date: Re: A new Critical Section for high contention situations
- Next by Date: Re: A new Critical Section for high contention situations
- Previous by thread: Re: A new Critical Section for high contention situations
- Next by thread: Re: A new Critical Section for high contention situations
- Index(es):
Relevant Pages
|
Loading