What is the reason for “locks are an expensive operation” to be uttered so often?

前端 未结 5 2057
野趣味
野趣味 2021-02-08 01:18

I have read a lot of material on threading, and all the synchronization mechanisms involved. I also understand the dangers of not doing it properly.

I just watched th

5条回答
  •  故里飘歌
    2021-02-08 01:59

    Locks are expensive because they block other threads from obtaining the lock. The delays can be deadly, making a multi-processor system slower than a single-threaded design without locks.

提交回复
热议问题