Reputation: 1864
$ sudo time -f '%c %w' chrt -f 99 ./ft 1234567890
26 1
I am curious why my process has been involuntarily (because the time slice expired) context-switched 26 times even though I set the scheduler to FIFO with the max priority 99:
$ chrt -m
SCHED_OTHER min/max priority : 0/0
SCHED_FIFO min/max priority : 1/99
SCHED_RR min/max priority : 1/99
SCHED_BATCH min/max priority : 0/0
SCHED_IDLE min/max priority : 0/0
$ uname -a
Linux localhost.localdomain 2.6.32-358.2.1.el6.x86_64 #1 SMP Wed Mar 13 00:26:49 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Any idea?
Thanks in advance.
Upvotes: 1
Views: 730
Reputation: 8414
Even if there is no other process able to run the scheduler will still run once every time slice. It will be returning straight back to your process, but none the less your process has been descheduled for a short period of time.
FTRACE is very good, take a look at this page, especially section 3.3.1. The page is talking about on OMAP ARM devices, but it all works just fine on other linuxes. That viewer reveals a huge amount of information about the inner workings of your system!
Upvotes: 2