For the solution of achieving high frequency trading, lock free queues can help to increase the message transfer speed between threads while reduce the performance jitter as well.
While we talks about so-called lock free mechanisms, Atomic Queue should be the first choice we considered.
However please note that Atomic operation is not really lock-free otherwise there is no data safety between threads. Atomic operation achieves lock and unlock functionality by using CPU kernel's feature that it will only process a word size memory at a time, which is exactly the size of integer.
there are many sample atomic queues implementation in the www. we found that FastFlow is the best one which can provide directly the atomic queues as well as multi-threading framework which can help to enforce the proper software architecture design.
the better part is that FastFlow is free to use and open sourced project, which will be actively maintained and tested by a group of users.
|FastFlow architecture design|
for more details, you can go to its sourceforge page: https://sourceforge.net/projects/mc-fastflow/