My Lock-free ParallelQueue algorithm have been updated
- my new algorithm avoids false sharing - , the new version
have scored 17 millions of pop() transactions per second on
an Intel Core 2 Quad Q6600 - the old score was 7 millions -
There are three ways to reduce lock contention:
1- Reduce the duration for which locks are held
2- Reduce the frequency with which locks are requested
3- Replace exclusive locks with coordination mechanisms that
permit greater concurrency.
With low , moderate AND high contention, my ParallelQueue algorithm
offers better scalability - and i am using it inside my Thread Pool
Because my lock-free ParallelQueue algorithm uses a hash based method
- and lock striping - and is using just a LockedInc() , so, i am
REDUCING the duration for which locks are held AND REDUCING the
frequency with which locks are requested, hence i am REDUCING A LOT
the contention, so it's very efficient.
And i can state the following law or theorem:
 If there is LESS contention THEN the algorithm will scale
Due to the fact that S (the serial part) become smaller with
contention , and as N become bigger, the result - the speed of
the program/algorithm...- of the Amdahl's equation 1/(S+(P/N))
So, since my lock-free ParallelQueue algorithm is REDUCING A LOT
the contention, it's very efficient and it scales well..
Also, i can state another law like this:
 If there is false sharing THEN the algorithm will not scale
well. Due to
the fact that S (the serial part) of the Amdahl's equation 1/(S
become bigger, so, this is not good for scalability.
It's why i am also avoiding false sharing in my lock-free
So, my new lock-free ParallelQueue algorithm reduces a lot the
and avoids false sharing, it's why it scored 17 millions of pop()
per second... better than flqueue and RingBuffer.
Please look at the benchmarks here:
The new Threadpool zipfile includes my new ParallelQueue algorithm,
and you can download my Thread Pool Engine from:
Amine Moulay Ramdane.