Lock-free multi-threading is for real threading experts

前端 未结 6 1926
猫巷女王i
猫巷女王i 2020-12-07 06:29

I was reading through an answer that Jon Skeet gave to a question and in it he mentioned this:

As far as I\'m concerned, lock-free multi-threading is

6条回答
  •  借酒劲吻你
    2020-12-07 07:12

    Joe Duffy's book:

    http://www.bluebytesoftware.com/books/winconc/winconc_book_resources.html

    He also writes a blog on these topics.

    The trick to getting low-lock programs right is to understand at a deep level precisely what the rules of the memory model are on your particular combination of hardware, operating system, and runtime environment.

    I personally am not anywhere near smart enough to do correct low-lock programming beyond InterlockedIncrement, but if you are, great, go for it. Just make sure that you leave lots of documentation in the code so that people who are not as smart as you don't accidentally break one of your memory model invariants and introduce an impossible-to-find bug.

提交回复
热议问题