I'm studying both Computer Organization and Operating System. One confusing me a lot is What exactly does that mean to allocate a CPU to a process in a Context Switch?
The term 'allocate CPU' is not according to what I imagine about a Context Switch.
So I want to make sure If I'm right, according to my view:
Stored-program architecture stores instructions into the main memory, those instructions are as in the text section of a Process.
From computer organization's perspective, only Program Counter decides which instruction to execute.
If the kernel decides to switch the allocation from Process 1 to Process 2, namely context switch, it does:
- Store Process 1's data into PCB 1
- Load Process 2's data, namely PCB 2 into the kernel
- Update all register values from PCB 2 (Includes PC)
- So then PC's address is updated to another text section. The diagram below shows my thought.
So, can I say that what kernel actually does to execute another Process, is it does a context switch and basically just changes the Program Counter's address to another process's text section address?