
How Con Kolivas's BFS CPU scheduler works - wmf
http://lkml.org/lkml/2009/10/16/96
======
DarkShikari
One advantage of BFS is the fact that it is very _simple_ : the sheer number
of heuristics that have made their way into CFS have a tendency to cause all
sorts of problems in--often rather important--pathological cases.

Here's one example from a recent commit:

<http://patchwork.kernel.org/patch/47921/>

The speed loss was so huge on what should have been an extremely easy load
that it probably explains quite a few "Windows is faster than Linux"
benchmarks I've seen over the past few months...

------
jws
If the scheduler's purpose is "to make typical desktop loads feel better", how
do you benchmark that? There is certainly room for improvement in making the
Linux desktop feel good, but I don't know how one would get to a number.
Perhaps you'd have to resort to double blind comparison tests.

(FWIW, my 1.2GHz PPC running Debian performs unacceptably as a desktop
machine. There are sometimes >1000ms lags between a keypress and it being
reflected on the X11 display with no background load. But I can't say this is
because of the scheduler.)

~~~
viraptor
> how do you benchmark that?

By getting statistics from the scheduler itself: how long did the process have
to wait before it started executing. Also by looking at global effects: run N
mplayers at the same time and look for dropped frames ; run an app that maps
similar amount of work to N children and measure the run time ; measure the
time needed for compiling [big project] with concurency == number of cpus ;
...

~~~
Tuna-Fish
_run an app that maps similar amount of work to N children and measure the run
time ; measure the time needed for compiling [big project] with concurency_

These are both the kind of tasks Kolivas is willing to totally throw under the
bus for better worst case latency.

Remember, the single goal of the project is to get worst-case latency for all
non-cpu-limited processes on the system as low as it possibly can get.
Throughput, and even best- and average case latency are considered entirely
expendable. This is why the BFS is hard to benchmark.

~~~
scott_s
Then measure worst case latency. I don't see what the difficulty is.

If you're purporting to improve the performance of something, but you aren't
always measuring the impact your changes have on the actual performance of
that something, you're working blind.

------
yason
Is there a scheduler API in Linux kernel already? If there isn't, it seems
that developing schedulers would really benefit from the ability to have them
loaded / unloaded as kernel modules, like filesystems. The system could fall
back to some generic round-robin scheduler if none of the more advanced
schedulers were loaded, or when switching between schedulers.

I would want to try out BFS but I'm old enough to not take the time and effort
to compile and patch my own kernel anymore, so I'll probably just wait until
BFS becomes the default in mainstream kernels. If ever, considering the
scheduler wars in the recent years.

A single kernel module I could compile and try out pretty easily, especially
with module-assistant. Or if there's a .deb of Ubuntu kernel patched with BFS,
that would do too.

I'm lazy, yes. Until I hack the Linux kernel day and night myself, it's
probably better this way. But I would still like to try out BFS, up to some
degree.

~~~
alextp
Linus is openly opposed to the idea of scheduler modules, his argument being
that schedules are core parts of a kernel, and modularizing schedulers woud
encourage many different schedulers each good at a simple thing instead of a
single scheduler well optimized for all workloads.

~~~
joeyo
It looks like we are getting that anyway, modular schedulers or no.

~~~
alextp
Until Linus goes commando and rewrites the scheduler, like he did with git,
yeah.

------
ars
I have to say it looks really really good. It's tuned specifically for desktop
needs.

What are the chances of this getting into mainline? Yes, I read about his
history. Maybe it will go in anyway. (But it really needs a new name - any
suggestions for a better back-ronym?)

One thing I did not see that it has, is hyperthreading support, i.e. detecting
that two cores are really the same, and not scheduling two tasks on the same
core, while other are available. And also, not scheduling idle priority tasks
on a core used by other tasks.

I emailed him to ask.

~~~
jrockway
Do desktop workloads benefit from hyperthreading? If not, there is no need to
clutter this code with support for it.

~~~
wmf
New Intel desktop/laptop systems have hyperthreading on by default, so the
real question is whether desktop workloads are hurt by HT. In that case BFS
could improve performance by avoiding co-scheduling (which it currently
doesn't appear to do).

~~~
jrockway
It is disabled by default on every Intel system I own.

But anyway, if people are using unstable Linux scheduling algorithms, I bet
they are OK tweaking their BIOS settings, too.

------
wallflower
For Windows users, Bitsum's Process Lasso does an admirable job of maintaining
desktop responsiveness.

<http://www.bitsum.com/prolasso.php>

~~~
zokier
So it's a scheduler on top of the kernels scheduler. Sounds ingenious...

------
Scott_MacGregor
This thing needs a better name. I can see the technology benefit, but
commercially it needs a more technologically correct (P.C.) name.

If this is sold, the publicity people will have heart attacks and the legal
documents will come up on porn searches. Not the best business strategy to
peruse if the developers want to maximize the value of this asset.

~~~
dkarl
What kind of product do you envision that would be named after, or whose
marketing material would even mention by name, a process scheduler?

~~~
ars
Business Purchase Order for RedHat licenses with BFS scheduler for the
developers.

Just don't say what BFS stands for.

OK, it's a bit of a stretch that they'll say what the scheduler is on the PO,
but it could happen.

It needs a backronym.

Bloody Fine Scheduler?

Bazinga Fast Scheduler?

BigBang Feory Scheduler? :)

~~~
trafficlight
Traditionally, BFx stands for "Big Fucking x".

For example the BFG 9000 <http://en.wikipedia.org/wiki/BFG_9000>

