Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top