[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

a question about SCHED_FIFO on multicores



Hello,

I am trying to figure out how to safely "almost-monopolize" CPU on a
multi-core system.

This "almost-monopolizing" should be safe as long as I run my process on
a CPU where no other process runs.

Affinity of some processes cannot be modified. E.g.:

	[migrate/0]
	[migrate/1]
	...

but these processes all run as SCHED_FIFO with priority 99 (maximum).

So, in theory, if I run my process as SCHED_FIFO with priority 99, and
all the other processes runnable at that core are SCHED_FIFO with higher
priority, then one should not experience any problems.

This theory can be reproducibly disproved by:
- booting Debian (without Xorg)
- excluding CPU#0 from the affinity of all processes (for which this is
possible)
- running the following program:

	#include "utils.h"
	#include <stdio.h>

	int main()
	{
	        set_cpu(0);
        	set_sched_fifo();
	        while(1);
        	return 0;
	}

where
- set_cpu(0) sets affinity to CPU#0
- set_sched_fifo() sets SCHED_FIFO policy and priority 98,
  (less than the priority of all other processes runnable on that core)
After I run the above program, the text console will become non-responsive.

I am sure there is a logical reason for that but I am not sure what exactly.


Reply to: