More Than a Gigabuck: Estimating GNU/Linux's Size (2001)

Posted by bilegeek 1 day ago

Counter12Comment10OpenOriginal

Comments

Comment by dwheeler 18 hours ago

Author here! I was surprised to see this on hacker news, it's a blast from the past.

Ask me anything!

Comment by tosti 17 hours ago

Any buck guesstimate for present day GNU+Linux?

Comment by dwheeler 15 hours ago

No specific number; getting one would require actual analysis.

But I expect it would easily be in the trillions, and probably over 10 trillion.

Comment by msla 18 hours ago

Wheeler put out a blog post:

https://dwheeler.com/blog/2012/02/14/

linking to this blog post:

https://blog.james.rcpt.to/2012/02/13/debian-wheezy-us19-bil...

Saying it's an update of this article. In case you don't like reading URLs, the newer blog post says Debian "wheezy" is worth $19 billion.

I consider this a simplistic analysis, because a closed-source Linux with a straightforward monetary pricetag would be worth a lot less in practice, since it would cease to be the de-facto OS for pretty much all new hardware products. Like BSD before it, which got ported to most workstations because it was freely available, Linux derives a good deal of its value from the fact you can port it to anything that doesn't run away quickly enough without having to pay money or even negotiate to license it from anyone.

Also, this pinged a few neurons deep in my memory, so I found what it made me remember. Back in 2004, some random named Jeff V. Merkey tried to buy a special license to the then-current kernel for $50,000.00:

https://dwheeler.com/essays/linux-kernel-cost.html

In response, Molnar did some quick sloccount math and estimated the kernel as being worth $175,974,824 at that time.

Comment by dwheeler 17 hours ago

> Also, this pinged a few neurons deep in my memory, so I found what it made me remember. Back in 2004, some random named Jeff V. Merkey tried to buy a special license to the then-current kernel for $50,000.00:

> https://dwheeler.com/essays/linux-kernel-cost.html

> In response, Molnar did some quick sloccount math and estimated the kernel as being worth $175,974,824 at that time.

Absolutely.

Just to clarify: Molnar first did the quick sloccount math and estimated $176 million USD. However, Molnar used the estimation values appropriate for an application.

But in fact, operating systems kernels are known to be more difficult to develop than typical applications. So I used the same approach but refined it to use parameters appropriate for a kernel. The article https://dwheeler.com/essays/linux-kernel-cost.html is really a response to Molnar's work; he did a rough estimate, I did a slightly-more-refined estimate. Those additional tweaks resulted in a higher redevelopment cost of $612 million (USD). Which gave the $50,000 offer an even bigger contrast.

The real point was that, even if it would have been possible accept $50K, it was absurdly low. You could argue about the estimate for a factor of 2, or 10, or even 100, and it still wouldn't change anything. Merkey was free to lowball a proposal, but that doesn't mean it should be accepted :-).

There was a 2004 article about this in LWN.net. LWN.net, and many others, don't see how such an offer could have been legally enforcible anyway, since you'd have to get the agreement of all the kernel contributors: https://lwn.net/Articles/106353/

To me, the kernel offer was more of an opportunity to find a way to measure the size of a kernel in a way that matters to people. Lines of code, or bytes on disk, don't really mean much to most people. Money... does :-).

Comment by cperciva 16 hours ago

in fact, operating systems kernels are known to be more difficult to develop than typical applications.

I'm not convinced. The core OS kernel code, sure; but more than half of the Linux kernel is drivers, and those are not just applications but separate applications; a change in an Intel wifi driver is unlikely to interact in any way with the nvme driver.

Comment by dwheeler 14 hours ago

> I'm not convinced. The core OS kernel code, sure; but more than half of the Linux kernel is drivers ...

I agree that more than half of the Linux kernel is drivers. In fact, in my analysis of Red Hat 7.1 at https://dwheeler.com/sloc/redhat71-v1/redhat71sloc.html I found that 57% of the Linux kernel was in the drivers subdirectory. Obviously that varies over time. So I completely agree with that part!

> and those are not just applications but separate applications; a change in an Intel wifi driver is unlikely to interact in any way with the nvme driver.

They aren't really separate applications, though. More importantly, that's not the primary effort (and cost) driver for this effort estimation model. I used the COCOMO model, an effort estimation model that was publicly available and widely used at the time. I then applied its rules to the Linux kernel of that time, as best I could. I discussed every parameter I set, and why, here: https://dwheeler.com/essays/linux-kernel-cost.html

Here are some of the reasons why kernel code takes more effort, per the model:

* It inherits some of the general challenges of writing embedded software. There's very little in the way of a safety net (this is the safety net), and it's closer to the bare metal. You're writing in C (or later in Rust), not a language that shields you from many challenges. In COCOMO parlence this code is "semidetached".

* RELY: Required software reliability: High (1.15). The Linux kernel developers care a lot about reliability, which takes longer.

* CPLX: Product complexity: Extra high (1.65). "The kernel must perform multiple resource handling with dynamically changing priorities: multiple processes/tasks running on potentially multiple processors, with multiple kinds of memory, accessing peripherals which also have various dynamic priorities. The kernel must deal with device timing-dependent coding, and with highly coupled dynamic data structures (some of whose structure is imposed by hardware). In addition, it implements routines for interrupt servicing and masking, as well as multi-processor threading and load balancing. And yes, that includes drivers; drivers must handle threading and other challenges that "normal" code doesn't, because the driver code is where those complexities are handled."

* TIME: Execution time constraint: High (1.11). "Although it doesn’t need to stay at less than 70% resource use, performance is an important design criteria, and much effort has been spent on measuring and improving performance."

* VIRT: Virtual machine volatility: High (1.15). "The most common processor (x86) doesn’t change that quickly, though new releases by Intel and AMD do need to be taken into account [but] the other components of underlying machines (such as motherboards, peripheral and bus interfaces, etc.) change on a weekly basis. Often the documentation is unavailable, and when available, it’s sometimes wrong (which from a developer’s point of view looks like a volatile interface, since it keeps changing). The Linux kernel developers spend a vast amount of time identifying hardware limitations/problems and working around them. What’s worse, there’s a variety of different hardware, and new ones keep arriving... the interface of the underlying machine is actually quite volatile."

Not every factor makes things worse. The people analyzing it (ACAP) and developing the code (PCAP) are unusually capable, with high experience in the programming language (LEXP) and modern development practices (MODP). But these only partly compensate for the fundamental challenge of writing highly performant kernel code.

Anyway, that's my rationale. I did this back in 2004, so I was necessarily using data and models available at the time. Most importantly, I think its key point was absolutely correct: it would have cost far more than $50,000 USD to re-develop the Linux kernel of that time.

Comment by cperciva 14 hours ago

They aren't really separate applications, though. More importantly, that's not the primary effort (and cost) driver for this effort estimation model. I used the COCOMO model, an effort estimation model that was publicly available and widely used at the time. I then applied its rules to the Linux kernel of that time, as best I could.

COCOMO says that the cost scales superlinearly with the number of SLoC; my point is that drivers scale linearly because they're effectively separate projects. (In fact, to the extent that they're not separate projects, the cost in fact scales sublinearly since there's a bunch of code being copied and pasted when new drivers are written.) Your tool has this "--multiproject" concept; a better estimate would have identified which parts of the tree (primarily drivers) were functionally separate from the rest of the kernel.

I think its key point was absolutely correct: it would have cost far more than $50,000 USD to re-develop the Linux kernel of that time.

Oh, absolutely. I'm not disputing the conclusion; just the claim that an OS kernel is inherently more complex than another application of the same size.

Comment by dwheeler 9 hours ago

> COCOMO says that the cost scales superlinearly with the number of SLoC; my point is that drivers scale linearly because they're effectively separate projects. (In fact, to the extent that they're not separate projects, the cost in fact scales sublinearly since there's a bunch of code being copied and pasted when new drivers are written.) Your tool has this "--multiproject" concept; a better estimate would have identified which parts of the tree (primarily drivers) were functionally separate from the rest of the kernel.

If all drivers were essentially completely independent projects that never interacted with each others, then yes, I'd agree that multiproject would be a better model. And if each was mainly a copy-and-paste of another, then it'd definitely be sublinear.

However, I have a very different expectation. In the Linux kernel, there's a strong pressure to try to create common interfaces that different drivers support. There's also pressure to create common lower-level functions that everyone can call. This reduces total code and reduces long-term maintenance, but ends up creating more interlinkages because the drivers are NOT really isolated separate projects at all. Maybe the drivers start somewhat independent, though I'm skeptical of even that, but I think that's not at all where they stay.

Let's get specific. The Linux kernel groups similar hardware into distinct subsystems. This includes networking, input subsystem (keyboards/mice/etc.), ALSA (sound), V4L2 (webcams/video capture cards), and GPIO.

Each subsystem defines a unified programming interface using standard data structures and callback functions. Drivers are typically split into a core framework that handles general logic and low-level portions. Driver developers plug into the existing framework for common features like power management and buffering. These interfaces often change as new drivers are created that require changes to the interface.

Because in practice there's a lot of interaction among drivers, I would not expect that, after years of driver development, the different drivers would really be independent. Indeed, many have asked the Linux kernel developers to make it easy to have completely separate and isolated drivers, but the developers have resisted because they believe it's important to have the drivers integrated into the kernel to support that kind of constant collaboration between drivers.

It'd be cool to see an analysis to settle the question. Future research for someone else I suppose :-).

Comment by dwheeler 17 hours ago

> I consider this a simplistic analysis, because a closed-source Linux with a straightforward monetary pricetag would be worth a lot less in practice, since it would cease to be the de-facto OS for pretty much all new hardware products.

It's necessarily an estimate, of course. The best way to get effort figures would be to record every minute used for development, and the best way to get cost figures would be to re-develop from scratch. That wasn't practical, so using a widely-accepted estimation system seemed like a reasonable approach.

It's true that this analysis doesn't tell you the purchase price. However, I wasn't trying to estimate the purchase price. I was trying to estimate the cost to develop the software, if it had been developed using traditional closed source practices. If Linux had been developed by a for-profit organization to make a profit, the organization would have planned on charging more that that (in aggregate among all its users), since otherwise they'd be knowingly developing the software at a loss. That doesn't mean that the company actually could have charged this, as it often happens that products don't make a profit, but that's different from intent. And this is all different from value. If a product has value to you that's more than it costs to get, then economically you should consider getting it.

No matter what, these time and money figures can only be rough estimates. However, I think they were useful, because they destroyed a false assumption many had at the time.

In the 1980s and 1990s many people presumed that large-scale systems could NOT be developed as open source software. People did sometimes share software, but it was widely assumed that this could only be successful for small programs. The term "open source software" didn't even exist until 1998. The term "free software" was coined in the early 1980s, so that definitely was a discussion point. However, many people didn't think you could build larger systems with software licensed that way.

Bill Gates published in 1976 his "Open Letter to Hobbyists" that crystallized this argument. He claimed that if software was freely shared it would prevent the writing of good software. He basically argued that closed source software development (not a term of the time) was necessary.

The point of my paper was to show that it was possible to build larger software systems without being closed source software. Even at the time, people were being paid to develop some of that software, but the point was that sharing of software under a generous license did not end software development at all. I think my paper did the job. You can argue many things, but no one argues that open source software cannot be used to build big systems. We have existing systems, measureably large, that refute the claim.

Thanks for the trip down memory lane.