operating system - PC and CPU registers when context switching happens? -


according question: storing , retrieving process control block

pcb contains lot of information , managed kernel (to avoid user access).

but have question pc , cpu registers. kernel save these values every time instruction executed or in context switching process?

are pcbs linked list?

actually, value of cpu registers modified per running sequence of instructions.

say,the instruction pointer points next instruction executed, stack pointer,if active,would store address of last program request in stack. , on. these cpu registers!

pcb has 1 of part processor state data,which pieces of information define status of process when it's suspended, allowing os restart later , still execute correctly. includes content of cpu general-purpose registers, cpu process status word, stack , frame pointers etc. during context switch, running process stopped , process given chance run. kernel must stop execution of running process, copy out values in hardware registers pcb, , update hardware registers values pcb of new process. // (taken wikipedia)

does kernel save these values every time instruction executed or in context switching process?

so,you might have got question solved. kernel bothers saving values of hardware(cpu) registers in case of context switching,not normally. else,it leaves burden on process maintain registers!

also, last question's answer is---the implementation of pcb 'generally' done doubly linked list data structure!


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -