Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in Linux kernel, is the following way right to create a real-time kthread?

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?

like image 485
Bill Wang Avatar asked Apr 16 '13 16:04

Bill Wang


1 Answers

In the thread itself, call:

struct sched_param param = { .sched_priority = prio };
sched_setscheduler(current, SCHED_FIFO, &param);

where prio is the priority you want.

like image 123
caf Avatar answered Nov 15 '22 08:11

caf