While thinking about Linux (because I’m weird), a question came up in my mind. How much of the kernel as it was originally written by Torvalds in 1991 remains in the current stable release (2.6.32.8 according to wikipedia)? How many lines of code are the same? Is there any part of it that hasn’t been rewritten?
I doubt there’s much, if any at all. The first kernel was essentially reliant on Minix, hardwired for Finnish keyboards and heavily biased toward x86. Torvalds claimed the system was basically unportable to anything other than a 386 and gcc, but was ported to other architectures relatively quickly (probably entailing extensive rewriting).
Linus Torvalds is still writing updates to the kernel. Rumors that Linus has a new version always creates a huge buzz in the Linux community. He may have rewritten most of the code since 1991.
I’m talking about the original version of the kernel as he released it in 1991.
I doubt much of the original is still around, but you might find some code from the 1.0 kernel unchanged. Probably not much, they often rewrite certain parts of the kernel from scratch, but surely a few lines of code have worked through the years.
This should be easy enough to test. Grab the current kernel source, plus the source of the first kernel, and run some diffs.
Hold on a moment…
Ok, there are no files at all in the linux-1.0 distribution that are identical (ignoring whitespace) to their counterparts in the 2.6.33-rc3 branch.
I checked a few basic header files but even there the changes appear to be large.
Interesting. I think this may be an example of Theseus’ paradox. If all the parts have been replaced, is it still the same thing?
Interesting, I thought he had coded more than that.
Apparently, nearly all the code from 1991 has been replaced.
Unfortunately, Wikipedia doesn’t say how much, if any, of that 2% was present in the original kernel.
Well, it’s also grown a bit. The 1.0 version had 141,361 lines in 282 .c files. My (patched) 2.6.33-rc3 branch has 9,329,339 lines in 15895 .c files. That’s about 66 times the size of the “original”.
I’m amazed the git allows you to switch between branches as fast as it does with that much code (by the way, the Linus’s git repo only records the history going back to 2005 / 2.6.12-rc2, so you can’t use it to track the differences all the way back to 1.0 - and the early stages weren’t in a version tracker as far as I know).
git infrastructure has improved a lot since 2005, but I doubt many people are interested in a 3+ Gb repository - the current one is “only” 372Mb, which saves a bit on download time.
The majority of contributed code added to the Linux kernel comes from private corporations, now.