'Concurrent linked/skip lists: 'update' and 'get' operations
I have an assignment that requires setting up a data structure with concurrent reads/writes (an order book for a matching engine in a trading exchange), and I have settled on concurrent linked/skip lists. I've looked at several of the following articles/reports, where some are lock-free, and many are fine-grained locked (listed below in no particular order):
- Practical concurrent unrolled lists using lazy synchronisation
- Practical lock-freedom page 53
- A Contention-Friendly, Non-Blocking Skip List
- A Provably Correct Concurrent Skip List
- A Simple Optimistic Skiplist Algorithm
All of these have fairly detailed algorithm pseudocode listings, but there are two issues I note with all of them:
- They are all maps—they associate some key to some value, whereas I need the
Nodeclass in all these algorithms to simply contain some structT(more particularly, I need the number of units in that order, the unit selling/buying price, the order ID, and an insertion timestamp). MSDN has a very nice C# implementation of a skip list containing someT(albeit not concurrent, which is a strict requirement), and is straightforward to adapt to C++ (ergo the tag). - They don't have
updateandgetoperations—what they do have arefind(which returns a boolean value, and not the node value itself),insert, anddeleteoperations. I am wondering if I can somehow compose and modify the latter three to create the former two, but I am a little lost.
How might I implement get/update so that concurrency and thread ordering is maintained?
I am leaning towards fine-grained locking (which is easier to reason about, even if slower) than lock-free algorithms (which I don't fully understand).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
