I read and studied how spinlocks work. Now I have a question which I can't find an exhaustive answer to:

how do they work in a UP (uni-processor) environment and in a SMP (symmetric multi processor) environment? What are the differences and problems?

有帮助吗?

解决方案

Spinlocks are essentially useless in UP case. They will just burn their time slice. They would better sleep in UP. In case of SMP spinlocks may be preferred over sleeping, if expected wait time is lower than average time that is needed to get time slice again for this thread.

Answering your question "how do they work"? Exactly the same everywhere, just spending CPU time in their time slice.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top