0
votes

I need to create a user-mode process. This process has to be detected in kernel mode to be sent to a FIFO queue (SCHED_FIFO) in the Linux kernel.

I have been investigating and if you use the function void scheduler_tick(void), which is located in core.c (I think scheduler_tick is called by the system each tick of the clock of the cpu), I can capture the process.

My question is if this is correct, or if there is any better way.

Scheduler_tick code: http://lxr.free-electrons.com/ident?i=scheduler_tick

The work is based on a multilevel queue, in which a series of diferente processes will be introduced(we have: payment processes, cancellations processes, reservations processes and event processes). These processes have different priorities in to the system.

Therefore when I created a process, for example payment process, i need detect the process, because i need know what type it is your priority.

Hence to comment the idea of used the function void scheduler_tick to detect process.

I don't know if i explained well ...

Thank you very much.

2
I don't understand. Is that not what the 'normal' process loader does, or perhaps fork()?Martin James
Why do you want to hack the kernel when you don't know very well about Advanced Linux Programming in userland thru syscalls(2)? It looks like a huge mistake. The rule of thumb is to avoid kernel patching when you canBasile Starynkevitch

2 Answers

2
votes

Creating a user process is not a kernel concern. All the user processes that are created are forked from the init process or from its children.

0
votes

You don't need to do that in the kernel. Actually, you have to keep that outside of the kernel.

What you need to do is either use chrt in you init scripts or use sched_setscheduler from your init program or daemon monitor.