Pergunta

Why must ContextSwitch be atomic and how to achieve this in practice?

I think it must be atomic because if it doesn't save the state of previous processes completely, it can cause problems for future contextSwitches.Inaccuracy, and wrong data.

And to achieve this, can we can use locks?

Does this make sense or am I oversimplifying things.

Foi útil?

Solução

probably the same assignment as you.

As the save operation requires several steps to save the value of CPU registers, process state, memory-management information, etc.. It is in fact necessary to make the context-switch atomic to ensure consistency.

To do it, it is possible to make the save method and probably the load method "synchronized", in order to make their respective steps execute in one block.

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