Here's a question for you: How do you get an operating system that first appeared 33 years ago to run on a processor that's almost two decades older, from 1971? Well, it turns out the answer is to make the ancient chip emulate something that's only 36 years old, strip the software down to its bare essentials, and then just wait almost five days for the kernel to boot.
While the project itself serves no obvious practical purpose, the work of Dmitry Grinberg (via Ars Technica) deserves genuine admiration. If you're a regular reader of our hardware news, then the name might be familiar—it's the same hacking wizard that ported Doom to run on a Def Con attendee badge.
But that project pales in comparison to Grinberg's latest one. In short, he managed to get the kernel of Debian Linux to boot on a 4-bit Intel 4004 processor, the first ever commercially manufactured microprocessor. Even by the standards of the 1970s, the 4004 is as basic as it gets.
With just 2,600 transistors to work with, the number of operations it can handle is extremely limited (mostly just add and subtract, and no logic ops whatsoever) and while it has a surprising number of registers (16 in total), it doesn't support hardware interrupts making any kind of multitasking somewhat of a challenge!
In fact, it's far too basic a chip to run Linux and this is where Grinberg got really creative. With a RAM target of just 4 kB, he coded up a program to emulate a MIPS R3000 processor on the 4004. That particular chip is from the same era as the original version of Linux so it was a natural choice for the emulation task, though it was far from easy to achieve.
But with some additional hardware emulation and a raft of period-correct components, Grinberg put together a custom circuit board with a basic display to prove that Linux was indeed firing up to a command prompt. The only real issue with it all is a matter of speed.
Even with a 5% overclock, the 790 kHz clock speed of the 4004 (yes that's kilohertz, not mega or giga) is desperately slow. Initial projections of how long it would take to boot the kernel (the fundamental core of the operating system) produced a figure of just under nine days! Cue much tweaking and neat little tricks, and Grinberg got it all the way down to 4.76 days.
If you watch the above video, you can see the laptop's clock whizzing along—the video recording of Linux loading up and running is sped up considerably, as even if YouTube allowed videos to have a runtime of several days, I don't think anyone could manage to watch it all the way through in real time!
The whole project is one heck of an achievement. Sure, it has absolutely no practical use but who cares? It's a tribute to the sheer ingenuity and determination of a talented and hardworking engineer. I suspect the only problem Grinberg has now is how on Earth does one top this. Oh, I know—it has to be Doom, of course. I wonder if he can get it to run at 30 fpm (frames per month)?