Hello all,
Why not use the Windows critical section and that's all ?
you have to understand that the Windows critical section is not
starvation-free and it's not FIFO fair and it doesn't minimize
efficiently the cache-coherence traffic cause it is using a backoff
mechanism, so since the Windows critical section is using a backoff
mechanism, that means that same thread will have the opportunity to
enter many many times the same critical section, and that's what happen
with Windows critical section, so as you have noticed this is fast cause
the same same thread will reuse the same variable from the same local
cache, but this is not FIFO fair and it's not starvation-free, so this
why i have decided to contribute to the FreePascal and Lazarus community
and i have implemented scalable Locks that are scalable and that
minimizes efficiently the cache-coherence traffic and that are
FIFO fair and starvation-free.
And you can download them from my website:
http://pages.videotron.com/aminer/
Thank you,
Amine Moulay Ramdane.