In Linux kernel, thread schedule is as real time ones(such as SCHED_FIFO) and normal ones(SCHED_NORMAL).
If I want to create a real-time thread, how to do this? I guess like:
1,kthread_create
2,give the thread a real time scheduler
3,assign a real time priority
Does this fine for a real-time kthread?
In the thread itself, call:
struct sched_param param = { .sched_priority = prio };
sched_setscheduler(current, SCHED_FIFO, ¶m);
where prio
is the priority you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With