Many readers, one writer - is it possible to avoid locking?

前端 未结 5 1002
深忆病人
深忆病人 2021-02-01 06:28

Say you have an in-memory list of strings, and a multi-threaded system, with many readers but just one writer thread.

In general, is it possible to implement this kind o

5条回答
  •  难免孤独
    2021-02-01 06:59

    To avoid locks, you might want to consider Microsoft's concurrent collections. These collections provide thread safe access to collections of objects in both ordered and unordered forms. They use some neat tricks to avoid locking internally in as many instances as possible.

提交回复
热议问题