1
votes

I don't understand the context switch full operations.

When a running process A go to ready/blocked status in favour of another process B because of scheduler, the dispatcher saves A's PSW and GPR in its PCB and stores B's PSW and GPR into CPU. So the PCB's queues are updated.

What about the frames used by the process A (code/data/stack)? Are they swapped into swap area or remain into memory?

The A's page table is still in memory? Is the page table of a process saved into memory when the process is created? Or when it goes to running status?

What about A's open files table?

I want to understand the accurate operations of a process context switch because it's important to see the differences between the speed context switch of threads and the heavy one of processes.

1

1 Answers

1
votes

This is all system specific. At the hardware a level, a context switch generally just saves registers to a context block and reads registers from another context block.

The page tables for the inactive process may or may not remain in memory. It's all up to the memory management of the operating system. Usually, an operating system would leave them in physical memory until that memory was needed for something else.