1. 7

    The majority of ‘common coupling’ that they identified was thru the ‘current’ global variable. This seems really dubious if you consider that ‘current’ is a pointer to the currently running task. This is a place to store per-task information that is not typically shared between multiple tasks. It’s essentially thread-local-storage in the kernel. So, it’s not really very global. The hardware will switch out the ‘current’ pointer whenever a context switch occurs. It’s hard to say if this is really bad for maintainability or not.

    They also avoided using tools other than LXR and their eyes. Some perl scripts were apparently involved to collate the numbers. A good question is whether, after reviewing 3 MLOC you can trust these numbers. Also, the presenter/PI mentioned that the existing tools were not possible to do this analysis. I find that hard to believe, even in 2002 (the year of the study). Maybe a lot has happened since then, but seems like symbolic execution would be the way to go for this kind of study.

    One of the big things that were missed but were also planned for further study is aliasing. So, let’s say instead of doing current->foo = 1;, you use a helper function/macro like: set_foo(current, 1); Well, their study would not catch set_foo() as contributing to common coupling.

    One question I have is whether the BSDs use a style where most global variables are referenced via helper functions. If so, it seems reasonable that they’d over-count the number of common couplings in Linux and under-count them in BSDs.