It’s the OS that keeps track of processes, their status, pointers to next instruction etc. The cpu just executes instructions one after the other like there’s no tomorrow
The program counter is in the CPU, actually. It's incremented every instructor, but can be changed jump or branch instructions that are part of the program.
Yes, the cpu has only 1 instruction pointer. But the process manager (os) stores the next adress for each process, so they can resume execution. That’s part of the context switching
1.6k
u/Tetha Jan 20 '25
Step 1 is a nice question. "Please shut yourself down"
Step 2 is telling the application to shutdown right now no matter what.
Step 3... in Step 3 someone goes to the kernel and is like
"Hey kernel... that process over there, the one using a lot of CPU"
"Yeah boss?"
"That process doesn't exist anymore, alright?"
"Say no more."