I'm implementing a thread using SCHED_DEADLINE
scheduling policy which is my high-priority thread and another one using SCHED_FIFO
policy which is my low-priority one.
As an example, I've defined my deadline thread as follow :
attr.sched_runtime = 0.5 * 1000000; // --> 0.5 ms
attr.sched_deadline = 0.6 * 1000000; // --> 0.6 ms
attr.sched_period = 1 * 1000000; // --> 1 ms
In a normal behavior, my high-priority thread shouldn't process more than 0.5 ms and while this duration it should have the time to finish its task.
If the task last longer than 0.5 ms, OS scheduler will preempt my high-priority thread to give time to my low-priority. This is a behavior I've tested before.
My question is : how can my high priority thread be warned that it has been preempted by the system?