Table of Contents

OS Nucleus and Processes



Nucleus (kernel)




			PROCESSES 

			    |
			    |	request (sent as a trap or syscall instruction after a system call)
                            |   or error (sent as a trap)
			    |
			   \|/
			    V
________________________________________________________________________
|                                                                       |     
|    			N U C L E U S                                   |
|_______________________________________________________________________|
			    .
			   /|\
			    |
			    |	request (sent as an interrupt)
			    |

			 DEVICES 



Process


Process Control Block (PCB)


Example Process Control Block


Process State Graph


Switch for Interrupt Handling

Steps:

  1. when an interrupt occurs, the CPU first finishes the current instruction
  2. switch the CPU to its privileged mode (system mode) -- this switch occurs automatically when the CPU receives an interrupt (after finishing the current instruction)
  3. copy the register values for the old process to a safe place, such as a stack (stored in memory)
  4. run the interrupt handler
  5. restore the values for the registers form the safe place, such as the stack
  6. switch the CPU back to user mode
After most interrupts, the same process will resume running

Privileged mode (system mode) - all commands (instructions) can be executed (e.g. halt) and all memory can be accessed, including the system area




Context Switch between Processes

Steps:

  1. switch the CPU to its privileged mode (system mode)
  2. copy the register values for the old process to the process table (stored in the OS's part of memory)
  3. load register values from the process table for the new process
  4. switch the CPU back to user mode




Table of Contents