title: What exactly does that mean to allocate the CPU to another process in a Context Switch?
body: <p>I'm studying both Computer Organization and Operating System.
  One confusing me a lot is <strong>What exactly does that mean to allocate a CPU to a process in a Context Switch?</strong> </p>
  
  <p>The term '<strong>allocate CPU</strong>' is not according to what I imagine about a Context Switch.</p>
  
  <p>So I want to make sure If I'm right, 
  according to my view:</p>
  
  <p>Stored-program architecture stores instructions into the main memory, 
  those instructions are as in the text section of a Process. </p>
  
  <p>From computer organization's perspective, <strong>only Program Counter decides which instruction to execute.</strong> </p>
  
  <p>If the kernel decides to switch the allocation from Process 1 to Process 2, namely context switch, it does:</p>
  
  <ol>
  <li>Store <strong>Process 1</strong>'s data into <strong>PCB 1</strong></li>
  <li>Load <strong>Process 2</strong>'s data, namely <strong>PCB 2</strong> into the kernel </li>
  <li>Update all register values from <strong>PCB 2</strong> (<strong>Includes PC</strong>)</li>
  <li>So then PC's address is updated to another text section.
  The diagram below shows my thought. </li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/rKk43.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rKk43.png" alt="Context Switch"></a></p>
  
  <p><strong>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?</strong></p>