What I've learned so far: An OS may trigger a software interrupt by executing a system call. According to what I read online, this is implemented via special instructions such as INT that the CPU can execute. I also understand how interrupts get handled by the interrupt service routine.
My question: since the CPU can only execute one instruction at a time, how does it work? For example, lets say a program X was hogging the CPU resources. The OS would have to execute a software interrupt to regain control of the CPU, but how would it do this (since the CPU is already executing instructions)?
Thanks for any explanations.