Linux Kernel in D?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 1 09:22:58 PDT 2016


On 11/01/2016 09:41 AM, Wild wrote:
> On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote:
>> Just an idea. Do you think it would have any advantage compared to the
>> one that is written in C?
>
> I think it wouldn't really be worth it.

I tend to think the same but for different reasons. Currently the Linux 
kernel is a large mature product that has its own evolution. It would be 
very difficult to reimplement it from first principles in any other 
language and get a competitive, timely product.

As an intellectual exercise, D's safety would help but at this point 
impart little advantage; the kernel has reached good stability and 
safety bugs are few and far across. This trend is likely for the 
foreseeable future.

One thing where D would be able to help quite a bit more is code size. D 
has better abstraction abilities than C (or C++) and using those would 
allow eliminating a lot of subtle duplication in kernel code. 
Consequently we'd be looking at a lower bug rate, better maintainability 
etc. I estimate that a 25% reduction in LOC is easily attainable. 
However, the dynamics of large projects makes even this relatively high 
reduction of little value. You'd not be looking at enjoying 25% savings, 
but instead at rebuilding 75% of the project. Because of that, you'd 
need a reduction of one order of magnitude to make the alternative 
appealing.


Andrei



More information about the Digitalmars-d mailing list