Concurrent data structure design

前端 未结 11 631
名媛妹妹
名媛妹妹 2021-01-30 18:44

I am trying to come up with the best data structure for use in a high throughput C++ server. The data structure will be used to store anything from a few to several million obje

11条回答
  •  无人及你
    2021-01-30 19:13

    If you don't need a sort order, don't use a red/black tree or anything else that inherently sorts.

    Your question is not well specified enough w.r.t to interaction between reads and writes. Would it be ok if a "read" is implemented by a lock+copy+unlock and then use the new copy?

    You may want to read about seqlocks in http://en.wikipedia.org/wiki/Seqlock, and on "lock free" processes in general -- though, you may want to relax your requirements as much as possible -- a lock-free hash table implementation is a major undertaking.

提交回复
热议问题