Process non-preemptable on Linux (2.6.32)

823 views Asked by At

I'm trying to make a process non preemptable. I've changed the scheduler policy to SCHED_FIFO and set the rtprio to 99. As soon as the process starts, in absence of IO interrupts, do I have the assurance that the process won't be preempted by other process? The rtprio=99 is the highest priority or there's still some process of the kernel with a higher priority? And finally, how can I know if a process has been preempted or not during its execution?

1

There are 1 answers

0
Lai Jiangshan On

It does have other process can preempt the highest rt process. Example, the processes which are created by stop_machine() for hot-removing CPUS, modifying kernel code text.

You can get the information from /proc/$PID/sched to determine whether a process has been preempted or not. cat /proc/$PID/sched

nr_switches                        :                 4197
nr_voluntary_switches              :                 4140
nr_involuntary_switches            :                   57

If nr_switches is changed, the process has been preempted