Jump to content
The Inquirer-Home

Linux source code passes 10 million lines

Kernel worth hundreds of millions
Wednesday, 22 October 2008, 18:55

THE NUMBER of lines of source code comprising Linux kernel files recently surpassed the ten million mark after the latest release of Linux version 2.6.27, an analysis has found.

However, that count includes blank lines, comments and text files included in a full checkout of the kernel source. Counted slightly differently, the number of lines of actual text is "only" over nine million, but we rather like that larger figure of ten million, because white-space really is important for code readability and, well... it's a nice round number..

As with all long-term programming projects, the size of the Linux kernel code base varies over time, as old code is discarded and replaced.

Newer features and functions are constantly being added, though, so the overall size of the Linux kernel continually increases.

Some analyses of the Linux kernel code base using David Wheeler's SLOCCount program yield some interesting facts. (The acronym "SLOC" stands for Source Lines of Code.) It finds only 6,399,191 lines of source code, since it doesn't count blank lines, comments and other input. One breakdown of the code base by SLOCCount comes up with the following figures (percentages are rounded to one decimal place):

TYPE

COUNT

PER CENT

Drivers

3,301,081

51.6

Architectures

1,258,638

19.7

Filesystems

544,871

8.5

Networking

376,716

5.9

Sound

356,180

5.6

Include

320,078

5.0

Kernel

74,503

1.2

Memory Mgmt

36,312

0.6

Cryptography

32,769

0.5

Security

25,303

0.4

Other

72,780

1.1

Categorisation by language finds that the overwhelming majority of the Linux kernel code is written in ANSI C, at 96.39 per cent, with Assembly Language accounting for almost all of the rest at 3.32 per cent. Other languages used in the kernel source files, in descending order of the number of lines of code, include Perl, C++, Yacc, Sh(ell), Lex, Python, LISP, Pascal and Awk.

More interestingly perhaps, SLOCCount also produces an estimation of the Linux kernel source code's value, that is, what it might cost to redevelop the code base from scratch, using the COCOMO development model.

SLOCCount estimates that it would take a team of over 200 developers about nine and a half years to rewrite the Linux kernel from scratch. Based up a four year old assumption of programmers' average salary level, SLOCCount calculates that would cost nearly $268 million.

Given inflation and adding in management overhead, $500 million might be a fair estimate of what it might actually cost a proprietary software vendor to redevelop Linux.

In fact, thousands of programmers have contributed to developing the Linux kernel, over a period of more than 15 years.

And in terms of what it costs one to download a full Linux distribution, they did for free. µ

L'Inq
Heise

Share this:

Comments
Line comparison?

ok that's cool ... but by comparison how many lines does XP, Vista or Leopard have?

posted by : Jerry, 22 October 2008 Complain about this comment
Yay the Penguin!

After the mythical man month, mistakes can happen, figure on actual cost being 10 times that figure to have something so big actually work. Look at Vista, a huge architected dev program fubarred from day 1 and costing easily an order of magnitude greater than $500m. Look at international finance. Non-organic dev driven by profit rather than utility is EVIL.

posted by : Fish Eating Surrender Penguin, 23 October 2008 Complain about this comment
$10 per line then?

Lets say the kernel is worth $100 million and is comprised of 10 million lines, that means each line is worth $10.
Or, lets say the kernel is worth $500 million, then each line is worth $50.

It's like, that just doesn't strike me as realistic somehow?

I know: the whole thing is worthless! It cost nothing to produce and costs nothing to obtain.
At last, I finally understand Linux ???

posted by : Grunchy, 22 October 2008 Complain about this comment
Outsource it for $8 a line

@Grunchy: sounds cheap to me. An oft-quoted metric is a programmer produces, on average, 10 lines of production code a day (averaged over the life of a project). It's very easy to write code, much harder to make it work properly. Sometimes it takes days or even weeks to find that stray +1 that shouldn't have been there. 

Most companies would outsource a greenfield half-billion dollar project to India or wherever, and take the 20% cost saving.

posted by : Steve, 23 October 2008 Complain about this comment
ha! easy

"Line comparison?
ok that's cool ... but by comparison how many lines does XP, Vista or Leopard have?"

Count the time it takes a linux distro to boot... then count the time it takes a feature comparable Vista install to boot and just multiply it by the other...

Then, with some simple math, you have approx how many lines of code Vista has....

posted by : IanHarvie@4Development.Net, 23 October 2008 Complain about this comment
Yeah...

"In fact, thousands of programmers have contributed to developing the Linux kernel, over a period of more than 15 years." 

...And it's still not ready for mainstream use! LOL.

posted by : B, 23 October 2008 Complain about this comment
at "Grunchy"

You've missed the point: The goal has always been about producing a free (liberty) and open operating system for your fellow man. To allow you to do things with it (conditions set by the GPL, the license which Linux is under.)

The GPL's intent is the following four freedoms.

(1) The freedom to run the program, for any purpose.

(2) The freedom to study how the program works, and adapt it to your needs.

(3) The freedom to redistribute copies so you can help your neighbor.

(4) The freedom to improve the program, and release your improvements to the public, so that the whole community benefits.

This is how Linux is so threatening. It draws the power of a global community of programmers to focus on a specific goal. (Some a voluntary while others have been employed to contribute).

Counting the number of lines of code and trying to value it in monetary terms doesn't mean anything other than for fun and statistics. Because what the code represents, is freedom in terms of liberty for the user. (The code you download and use is YOURS. No one cares what you do with it as long as you comply with the license its under. That is the GPL).

Compare this to Windows and OSX. Where they are closed off, largely inflexible, and in Windows's case; has a condition in the EULA where you aren't allowed to modify or fix things to make it better. (Essentially, they don't want you to touch it).

This emphasis on freedom is made more pronounce by the recent introduction of Windows Genuine Advantage in China. Where some folks feel like the system they bought is no longer theirs. The topic is discussed in The Inquirer's other article:
=> http://www.theinquirer.net/gb/inquirer/news/2008/10/22/chinese-fume-microsoft-anti

My point is this: You can't put a price on freedom.

posted by : aussiebear, 23 October 2008 Complain about this comment
@B

[quote]Yeah...
"In fact, thousands of programmers have contributed to developing the Linux kernel, over a period of more than 15 years."

...And it's still not ready for mainstream use! LOL.[/quote]

Wrong! It is used in a number of mainstreams - web servers, database servers, and in high transaction oriented production environments as well.

What you probably meant was Desktops. Right? To make it more mainstream (as in desktop), two things need to be achieved. 

1) All PC (non console) games to run on Linux. OpenGL is good, but games developers need to support that as well.

2) Microsoft must (really) stop piracy. 

Make out what you will out of point 2.

posted by : sb, 23 October 2008 Complain about this comment
Vista line code

Vista = 50 millions
Win XP = 25-30 millions

posted by : Energizer, 24 October 2008 Complain about this comment
Advertisement
Subscribe to the INQ Newsletter
Sign-up for the INQBot weekly newsletter
Click here to sign up Existing user
Advertisement
INQ Poll

Windows 7 impressions

How is windows 7 working out for you?