Software


16
mai 08

Removing the Big Kernel Lock

“As some of the latency junkies on lkml already know, commit 8e3e076 in v2.6.26-rc2 removed the preemptible BKL feature and made the Big Kernel Lock a spinlock and thus turned it into non-preemptible code again. This commit returned the BKL code to the 2.6.7 state of affairs in essence,” began Ingo Molnar. He noted that this had a very negative effect on the real time kernel efforts, adding that Linux creator Linus Torvalds indicated the only acceptable way forward was to completely remove the BKL. Ingo explained:

“This task is not easy at all. 12 years after Linux has been converted to an SMP OS we still have 1300+ legacy BKL using sites. There are 400+ lock_kernel() critical sections and 800+ ioctls. They are spread out across rather difficult areas of often legacy code that few people understand and few people dare to touch. It takes top people like Alan Cox to map the semantics and to remove BKL code, and even for Alan (who is doing this for the TTY code) it is a long and difficult task.”

Ingo went on to describe how the BKL works, how it differs from other locking mechanisms, and why this complicates removing it permanently from the kernel. He noted that the various dependencies of the lock are lost in the haze of 15 years of code changes, “all this has built up to a kind of Fear, Uncertainty and Doubt about the BKL: nobody really knows it, nobody really dares to touch it and code can break silently and subtly if BKL locking is wrong.” He then suggested “changing the rules of the game”, creating a “kill-the-BKL” branch which “turns the BKL into an ordinary albeit somewhat big mutex, with a quirky lock/unlock interface called ‘lock_kernel()’ and ‘unlock_kernel()’.”

Read more…


14
mai 08

Embedded Linux Conference 2008

Rafael Ugolini sent me these awesome links about Embedded Linux Conference 2008, all the videos and reports (from all years):

Videos like…

  • Keynote: The Relationship Between kernel.org Development and the Use of Linux for Embedded Applications, by Andrew Morton (Google)
  • UME – Ubuntu Mobile and Embedded, by David Mandala (Canonical)
  • Back-tracing in MIPS-based Linux Systems, by Jong-Sung Kim (LG Electronics)
  • Using a JTAG for Linux Driver Debugging, by Mike Anderson (PTR Group)
  • Go check:

    Videos: http://free-electrons.com/community/videos/conferences/
    Reports: http://free-electrons.com/articles/conferences/elc2008-report/


    13
    mai 08

    Printing the binary value of an integer

    You can printf an integer in many forms, including decimal, octal or hexadecimal. What about binary? This is not the first time someone asks me this, so I’ll just post it here:

    >  ./dec2bin 3
    3 -> 00000000000000000000000000000011
    >  ./dec2bin 4
    4 -> 00000000000000000000000000000100
    >  ./dec2bin 5
    5 -> 00000000000000000000000000000101
    >  ./dec2bin 6
    6 -> 00000000000000000000000000000110
    >  ./dec2bin 7
    7 -> 00000000000000000000000000000111

    A simple solution could be the function below, note that it is limited to 32 bits:

    static char *dec2bin(int dec)
    {
            char *str, *ret;
            int i;
            const int bits = 32;
     
            ret = str = malloc(bits);
            memset(str, '0', bits);
     
            for (i = bits-1; i >= 0; i--) {
                    if (dec % 2 == 1)
                            str[i] = '1';
     
                    dec /= 2;
            }
     
            str[bits] = '\0';
     
            return ret;
    }

    12
    mai 08

    Openning big files in OpenOffice Spreadsheet

    When your files are too big, OpenOffice Spreadsheet will ignore anything after line 65536, my suggestion is, split it in other tabs:

    marcelo@yogananda:~/Desktop$ wc -l foo-2008-04.csv
    73538 foo-2008-04.csv
    marcelo@yogananda:~/Desktop$ split foo-2008-04.csv -l 37000 foo
    marcelo@yogananda:~/Desktop$ ls foo*
    foo-2008-04.csv  fooaa  fooab
    marcelo@yogananda:~/Desktop$ wc -l fooa*
      37000 fooaa
      36538 fooab
      73538 total

    After this, Insert -> Sheet From File…


    5
    mai 08

    Problems to solve with software

    My uncle is a person that likes to use technology, he has always the newest computer, television, sound system, etc. I suppose that he has a good camera also, since I’ve just received by email five photos from him, the only problem is that each picture has almost 12MB.

    Naturally he will share his images with friends and family, the expected result is for everyone to see the images, so it doesn’t need to be that big, as a user of technology he doesn’t need to know that.

    We see a clear situation where hardware evolves much faster then software, we have a family of products that interacts with pictures, in this example email clients, and it yet doesn’t answer this problem. The correct behavior could be this email client understanding the profile of the user/place/recipients to identify the best size for these images and resize them.

    Of course size is just a matter of time and location, in Japan where most of the population has very fast broadband internet connection, acceptable average size will be much higher then Afghanistan, where technology takes longer to arrive [today].

    And if you think longer, you’ll see that you might have dozen devices on different connections, so what would be the correct behavior if I’ll check this email on my cell phone over 3G?

    Will software ever evolve fast enough?