Back to Home

Brain Fuck Scheduler - set in 5 minutes

linux · scheduler · brainfuck · ubuntu · jaunty · kernel

Brain Fuck Scheduler - set in 5 minutes

    About the new task scheduler for Linux on Habré already wrote here . A very shocking "trailer" with xkcd to the new scheduler, and no less fun FAQ, aroused interest. I asked my acquaintances who set it up to share their impressions - no one set it up, because “I’ll install a new kernel” or “I will wait until it appears in the mainstream”. I installed and tried it myself, and for those who want to do the same - a short guide to Ubuntu 9.04, with a description of the potential rake.

    As a teaser, I can only say that full-screen video on youtube does not really slow down and the system has become more responsive and faster.

    So, so as not to be unfounded, let's get started. It is assumed that you have installed Ubuntu 9.04 (Jaunty).

    Core


    This scheduler is written for 2.6.30+ kernels, so the default 2.6.28 kernel in Jaunty does not suit us. You need to download 2.6.30 , but better the latest at the moment from the branch - 2.6.30.5 .

    Download the sources carefully packaged in .deb by the developers of Ubuntu: Install the sources: We have finished the kernel so far.
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30.5/linux-source-2.6.30_2.6.30-02063005_all.deb


    sudo dpkg -i linux-source-2.6.30_2.6.30-02063005_all.deb
    cd /usr/src
    sudo tar xvjf linux-source-2.6.30.tar.bz2




    Patch bfs


    Now you need to install the BrainFuck Scheduler patch. The directory with the patch and other relevant files is here: ck.kolivas.org/patches/bfs
    The latest current version of the patch at the time of writing 2.0.9 is ck.kolivas.org/patches/bfs/2.6.30-sched-bfs-209. patch

    Download and apply the patch: The patch swears twice on “assume reverse patch” - you need to answer “no”, and on “Apply anyway?” - “yes”.
    cd /usr/src/linux-source-2.6.30/
    sudo wget http://ck.kolivas.org/patches/bfs/2.6.30-sched-bfs-209.patch
    sudo patch -p1 < 2.6.30-sched-bfs-209.patch



    Patched kernel assembly


    Now we collect, as always. Who doesn’t know how to always build, a brief introduction - in Debian / Ubuntu there is a convenient kernel-package utility for building the kernel that does a ton of work for us. Therefore, we first install it, or make sure that it (and several other necessary programs) is installed: Now we generate a new kernel configuration based on the existing one: Here we will need to make a couple of changes. UPD . Correction from coldFlame - these changes are not required, moreover, on laptops are not recommended. From the FAQ THESE ARE OPTIONAL FOR LOWEST LATENCY. YOU DO NOT NEED THESE! Configure your kernel with 1000Hz, preempt ON and disable dynamic ticks.
    sudo apt-get install kernel-package libncurses5-dev fakeroot wget bzip2


    sudo cp /boot/config-`uname -r` ./.config
    sudo make menuconfig







    • Processor type and features -> Timer frequency set to 1000Hz
    • Processor type and features -> Tickless System (Dynamic Ticks) disable
    • Processor type and features -> Preemption Model -> Preemptible kernel (Low latency desktop)

    Exit and save the configuration.

    Next, the assembly itself. About 5 minutes in the title, of course, I lied :), but if we neglect the build phase (reconcile), and let the download speed of the above-mentioned packages go to infinity, then in 5 minutes we can easily meet it. :) If everything went well, then in / usr / src / you will have two .deb packages, with file headers and directly with the kernel and modules. Install them: In this case, the kernel and modules will be installed in the system, a new initrd will be generated, dependent external modules will be rebuilt (except for nvidia, but more on that below) and grub will automatically learn about the new kernel. Everything, you can reboot.
    sudo make-kpkg clean
    fakeroot make-kpkg --initrd --append-to-version=-bfuck kernel_image kernel_headers



    sudo dpkg -i /usr/src/*bfuck*.deb





    NVidia Drivers


    Those drivers that by default are in the repository - are not automatically installed on the new kernel, but give an error. This knocks down the charm of automatic installation scripts and we have two options - either download the latest installation binary from the Nvidia website, or use the beautiful method with a patch for drivers.

    So, download the patch for the nvidia module: Copy it to /usr/src/nvidia-180.44/patches/ Add the following lines to the /usr/src/nvidia-180.44/dkms.conf file: That's it, you can use all the charms of dkms and be sure that on the new kernel will work Nvidia drivers. UPD . It makes sense to look at these comments .
    wget http://lionsimba.lerlan.ru/temp/proc-dir-entry-owner.patch


    sudo cp proc-dir-entry-owner.patch /usr/src/nvidia-180.44/patches/


    PATCH[1]="proc-dir-entry-owner.patch"
    PATCH_MATCH[1]="^2.6.30"





    Conclusion


    Now for the impressions. The system really became subjectively more responsive, subtle but annoying pauses during various actions were removed. Fullscreen video on youtube - I confirm :) - really does not slow down. From what has been noticed so far - the Kompizov Ring Switcher for windows has become almost instantaneous - earlier it left a feeling of heaviness and slowness. I will not fundamentally do tests, benchmarks and measurements - the subjective sensations from working with the machine are more important to me.

    I definitely stay with this kernel and this scheduler for now.

    UPD . Patch version 2.10 is applied to 2.6.31-rc9 (thanks davnozdu )

    Read Next