A development blog of what Con Kolivas is doing with code at the moment with the emphasis on linux kernel, MuQSS, BFS and -ck.

Monday, 9 January 2012

Towards Transparent CPU Scheduling

Of BFS related interest is an excellent thesis by Joseph T. Meehean
entitled "Towards Transparent CPU Scheduling". Of particular note is
the virtually deterministic nature of BFS, especially in fairness and
latency. While this of course interests me greatly because of
extensive testing of the BFS CPU scheduler, there are many aspects of
both the current CFS CPU scheduler and the older O(1) CPU scheduler
that are discussed that anyone working on issues to do with
predictability, scalability, fairness and latency should read.

Abstract:

In this thesis we propose using the scientific method to develop a
deeper understanding of CPU schedulers; we use this approach to
explain and understand the sometimes erratic behavior of CPU
schedulers. This approach begins with introducing controlled
workloads into commodity operating systems and observing the CPU
scheduler's behavior. From these observations we are able to infer
the underlying CPU scheduling policy and create models that predict
scheduling behavior.
We have made two advances in the area of applying scientific analysis
to CPU schedulers. The first, CPU Futures, is a combination of
predictive scheduling models embedded into the CPU scheduler and
user-space controller that steers applications using feedback from
these models. We have developed these predictive models for two
different Linux schedulers (CFS and O(1)), based on two different
scheduling paradigms (timesharing and proportional-share). Using
three different case studies, we demonstrate that applications can use
our predictive models to reduce interference from low-importance
applications by over 70%, reduce web server starvation by an order of
magnitude, and enforce scheduling policies that contradict the CPU
scheduler's.
Harmony, our second contribution, is a framework and set of
experiments for extracting multiprocessor scheduling policy from
commodity operating systems. We used this tool to extract and analyze
the policies of three Linux schedulers: O(1), CFS, and BFS. These
schedulers often implement strikingly different policies. At the high
level, the O(1) scheduler carefully selects processes for migration
and strongly values processor affinity. In contrast, CFS continuously
searches for a better balance and, as a result, selects processes for
migration at random. BFS strongly values fairness and often
disregards processor affinity.

9 comments:

The versions they chose are outdated. So much work into this thesis, but they're slacking on using a recent kernel? Seriously, that's messed up. It's a thesis, so they couldn't have started this more than a year ago, but they used 2.6.32 from late 2009? Wtf?

Indeed they did use quite an old BFS by today's standards. However, unlike the mainline scheduler, BFS has not changed that drastically since then. It has had nanosecond acounting added throughout, and the soft throughput CPU affinity code has been simplified even further than it was back then - unlike mainline which has gotten more and more complex. So it is likely going to behave virtually the same as the older version.

The docs EXTENSIVELY describe how it chooses a CPU to schedule a task on. When a task wakes up, it always tries to schedule on the same CPU it last ran on. Bouncing occurs when the last CPU it ran on is not idle, and another CPU is idle.

the tendency of the predictive scheduling models to superimpose data overlay onto the existing user space is key. i agree with the methodology as such, but as with all cs projects i of course have a lot of input.

I am currently in the midst of developing a very low level python implementation of an adaptive predictive scheduling model. I'm importing a bunch of existing PHP modules. The problem is, JavaScript is necessary for the Python shell. Is there any way you guys know of to switch the parameter to accept said PHP modularity?