-2

If I have a CPU with 4 Cores ( for example, a Intel I5 ) and a I need to keep a process running exclusively in one theses Cores without being interrupted by the Linux Scheduler, even for a few milliseconds.

What I need to do ?

To complement this question, I have made a research, so I have a theory.

  1. Set the process CPU affinity to use exclusive the core I want. And set all the other processes to avoid these core.
  2. Set the Linux Scheduler to use the FIFO policy for the process, this means the process will not be stopped at release the CPU.
  3. Set all others process has Idle to avoid competition with the FIFO policy.
  4. Set isolcpus kernel option to avoid the kernel to use these CPU Core.

I not sure even if it’s possible to avoid the process to being stopped, because if I understand the Linux Scheduler, they are designed to hang up the process to avoid them to monopolize the CPU core.

This question it’s important, because in some research and scientific applications It’s need to run a virtual machine encapsulating a real-time application, so if the Linux stop the virtual machine to check the process list or to release the CPU core for another process, the application will be stopped too.

  • It's a question and a research for the question. – Amanda Osvaldo Aug 26 '17 at 0:45
  • Not many computers will run "forever", so I would recommend a better title -- one that reflects your actual question. – Jeff Schaller Aug 26 '17 at 1:23
  • @roaima, please take a look and tell me if now it's more clear. I improved my English – Amanda Osvaldo Aug 26 '17 at 11:58
  • @JeffSchaller, you believe the question it's better now ? – Amanda Osvaldo Aug 26 '17 at 11:59
0

I need to keep a process running exclusively in one theses Cores without being interrupted by the Linux Scheduler, even for a few milliseconds.

This is not possible (with user-land applications). Linux (as most usual OSes) use preemptive scheduling.

However, read more about real-time Linux & Xenomai

(of course, the kernel part is often not preempted, but you don't want to write a kernel module for such a purpose)

In practice, I am sure you'll be able to configure your system so that preemption would be negligible for your benchmarking goals. Scheduling overhead is (or can be configured to be) probably in microseconds, not milliseconds.

(otherwise, give up using Linux)

See sched(7)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.