High-performance task queue
To achieve performance, any trading system must have processes and threads working in parallel. Processing many operations at the same time is a way to save time. The communication between processes is very challenging in terms of speed and complexity. As we saw in Chapter 6, HFT Optimization - Architecture and Operating System, it is easy to create a segment of shared memory and share data between them. As we know, there is a problem with the synchronization of the access to the data because shared memory doesn't have any synchronization mechanism. The temptation of using a lock is high but performance will be affected by this kind of object.
In this section, we are going to review the different Java data structures that we use in HFT. The first one is the simplest: the queue.
Queues
Queues generally have a write contention on the head and tail and have variable sizes. They are either full or empty but never operate on the middle ground where...