I’m writing something on the linux scheduler and I need to know which process was running before my interrupt came in.. is the current structure available? If I do current->pid while in the interrupt handler, do I get the pid of the process I interrupted?
Share
You can,
current->pidexists and is the process that was interrupted (may be the idle thread, or any).If you’re writing inside the Linux scheduler, you should be very careful.
currentis changed by the scheduler as it chooses a new process to run, so its value depends on when exactly you read it.