Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top