Lines of code, from the internet[1]: Pacemaker: 100k Boeing 787: 5M Chevy Volt: 10M Modern car: 100M
[1] https://www.visualcapitalist.com/millions-lines-of-code/
Lines of code, from the internet[1]: Pacemaker: 100k Boeing 787: 5M Chevy Volt: 10M Modern car: 100M
[1] https://www.visualcapitalist.com/millions-lines-of-code/
The Linux kernel was 15M lines in 2013 [1], more than half of that was drivers. Windows XP was apparently 45M lines, the 2009 Debian distribution 300M lines [2].
So you're into millions of lines just to execute "Hello world" on a PC.
Simple control systems generally don't use an OS. E.g. Arduino is as simple as it gets, here [3] is a 30-LOC example snippet for a HTTP client. But if you dig down into the included libraries (most of it is on GitHub) you'll find that there's (quick estimate) 10-20k lines of code involved in executing those 30 lines. And you haven't actually _done_ anything yet, that's just the infrastructure to allow C code to interact with the hardware with a few standard libraries for math and IO.
Modern cars are complex enough to have OSes [4], with the corresponding code complexities.
In short, web developers vastly underestimate the code complexity of interacting with hardware in a low-level language because it's not something they deal with. The umpteen million lines of OS kernel and device drives are done by someone else, and for people who just _use_ a PC it (mostly) "just works", to the extent that even advanced users aren't aware of the complexity behind it.
[1] https://en.wikipedia.org/wiki/Linux_kernel#Codebase
[2] https://unix.stackexchange.com/questions/111281/exploding-am...
[3] https://www.arduino.cc/en/Tutorial/HttpClient
[4] https://www.quora.com/What-operating-systems-are-used-in-car...
How many I/O devices/drivers does a pacemaker talk to? How many of those are written by/customized by the pacemaker's developers?
If you include the underlying stack, then also my <body>Hello world</body> runs on tens of millions of lines of code (Browser+OS).
A pacemaker would presumably be similar to Arduino: A simple processor, no OS. 100k lines (your numbers) isn't all that much, given that C standard libs are into the tens of thousands alone. Pacemakers have sensors to detect heartbeat, logic to send an electric pulse only when needed, and have an interface where medical personell can hook up a computer to adjust some parameters. So 2-3 IO channels at a minimum (one or more sensors, one or more outputs for the electric pulse, and some sort of wireless interface for adjustments).
> Are you suggesting a passenger car runs its own Linux distro?
According to Quora (last link in my reply above) the most common alternatives are Windows Embedded Automotive, a Linux derivative, and QNX. Why? To avoid writing millions of lines of fairly complex code on their own, of course. Just like a desktop developer saves a ton of work by writing on top of the OS rather than implementing their own OS from scratch.
> If you include the underlying stack, then also my <body>Hello world</body> runs on tens of millions of lines of code.
Yes, but that's the point: The numbers for lines of code in a pacemaker or car includes the entire stack. If you want to compare it to web development, you'll need to include the full stack there too.
* Writing everything three times for three different computers with three different architectures in three different ways (e.g. numerical vs symbolic integration)
* Using obsolete programming languages for the same reasons doctors use latin
* Has to be usable by poorly trained pilots, while tired, on the other side of the planet in complete darkness with half the systems failing.
* Nobody dies if you web/game crashes. The plane has to still be flyable in unimaginably bad conditions like a total engine loss by deploying a windmill (ram air turbine), therefore every scenario is accounted for.
Caveat is we usually find new scenarios by crashing planes, not by thinking about them first. Kind of a definitional thing: if you'd thought of it, it wouldn't have crashed.
Obsolete languages: Old language (or Latin) does not bloat the size of your code astronomically.
Usability in specific conditions: does not apply to a car or pacemaker. Yes, for an airplane, it can make the design phase lengthy and difficult but the actual size of the code will not bloat astronomically.
From some of the discussions I have seen on HN, writing safety-critical software is not a question of adding millions of lines of code - to the contrary, safe software must be clean and readable.