
PowerNex: a kernel written in the D Programming Language - ingve
https://github.com/Vild/PowerNex
======
vram22
Some here are asking about D. I saw this article recently, by a tech company
founder (Infognition) using D heavily for his image- and video-related
products. It was interesting:

Why D?

[http://www.infognition.com/blog/2014/why_d.html](http://www.infognition.com/blog/2014/why_d.html)

------
Wild
Hey. I'm the developer of this kernel. If you want to read a blog post about
how and why I made PowerNex you can read it here.
[http://dlang.org/blog/2016/06/24/project-highlight-the-
power...](http://dlang.org/blog/2016/06/24/project-highlight-the-powernex-
kernel/)

AMA aswell I guess :)

------
Wargog
The creator of PowerNex, Wild, streams the development on Livecoding as well,
if anyone wants to watch.
[https://www.livecoding.tv/wild/](https://www.livecoding.tv/wild/)

~~~
nv-vn
Yep, been following his streams on and off on there. Sad that livecoding.tv
hasn't become big, but I can see why honestly.

~~~
Wargog
Their latest update hasn't really helped either. I've kind of strayed from
being a frequent visitor myself

------
gravypod
What's the kernel design here? Is it monolithic like linux?

~~~
valarauca1
I love how everyone is digging into the D/Rust/C++ flamewar and not discussing
the project at hand.

It appears monolithic. There's actually very little content about what it's
design goals are, what it's trying to accomplish, or even what interfaces
it'll support. I'm assuming POSIX because everyone loves to re-write UNIX and
there is a boat load of documentation/implementations and most of these are
monolithic.

~~~
gravypod
Yea, that's disappointing.

I'd assume an Object-Oriented language would be better at implementing a
microkernel. Objects, in my mind, really represent the idea of a service well
so I'd be excited to see what it would look like.

Too bad we're never going to get out 128 core SPARC machines with an open-
source microkernel like was prophesied in the Linux-MINIX debate.

~~~
Wild
I would want to create a microkernel, but that would be really hard so I'm
targeting a hybridkernel design.

~~~
gravypod
Have you checked out the GRUB features to load blob file systems for you into
memory? It's one of the best ways to implement that kind of feature (for this
sort of hardware).

Do you sit on some IRC somewhere? I'd be interested in talking to you about
how you're approaching this work. Very cool

~~~
Wild
I've created #PowerNex on FreeNode. I am not the most active IRC user, but I
will have my BNC connected 24/7.

------
Grishnakh
I think it'd be really interesting if someone tried rewriting the Linux kernel
in D (or Rust for that matter) and then compared the performance, lines-of-
code, etc.

Maybe it could even be done with just one small but critical portion and
linked, so it isn't such a monumental task.

~~~
pjmlp
We don't need more POSIX copies.

I would rather see someone take D, Rust, Swift, whateverX and implement
something modern, following the concepts explored at Xerox PARC, ETHZ and MSR
in terms of OS architectures and development environments.

~~~
DblPlusUngood
It sounds you like you asking for more toy OSes.

Supporting POSIX is necessary if the designer wants the OS to run real
software.

~~~
iheartmemcache
I'm pretty sure the software that requires an OS that runs POSIX software is
sufficiently catered to. You have your Linuxes of every sort of flavor anyone
could ever want (ranging from LFS/Gentoo Stage 3/Arch for the tuners and
minimalists, to the 'I want to have Docker/git at my OS level' NixOS-esque
machines, to the Ubuntu's for the "anything-but-Microsoft" demographic. (Not
to mention, your BSDs, your QNX's (+3 or 4 other POSIX RTOS that are well
supported in their ecosystem), your AIXes for the DB2's, ... ) It's
sufficiently been explored and the need has been catered to.

Pjmlp (correct me if I'm wrong) would rather see exploratory endeavors rather
than Yet-another-POSIX-impl. (And for the sake of argument, should that new
platform garner steam and you _absolutely, 100%, completely and totally need
POSIX support!_ you can get pretty far creating PE/ELF on a non-POSIX OS with
an emulation layer with ~3-4% overhead[VMware had a few whitepapers on it, and
Unity is a component in production that demonstrates such behavior])

And if he were motivated enough to write a POSIX impl from scratch, while not
trivial, it shouldn't be too hard (see: BusyBox, Yocto/Poky, hell, remember
the NetBSD days? Any idiot could port to platform foo in a weekend.)

~~~
pjmlp
I would rather see designs like Xerox PARC, ETHZ Oberon, Midori and so forth.

There is no value in making clones the C runtime library.

POSIX is just the part of UNIX that was left out of ANSI C, only usable for
command line and daemons written in C.

Other language runtimes don't really depend on POSIX.

------
dman
Will someone with familiarity with both Rust and D talk a bit about the
similarities and differences?

~~~
PeCaN
I think this is a valid question. They're pretty _different_ languages in
terms of design, but they're definitely worth comparing—their problem domains
do overlap in spite of design differences.

I've used both, but can't claim to be much of an expert in either.

Similarities:

• Compile to fast, easy-to-deploy native code

• Abstraction continuum ranging from very low-level C-like style to a high-
level more functional style

• Very easy to call C libraries from

• Type inferred and generally less syntactically noisy than C++

Neutral differences:

• D is garbage collected; Rust has a novel memory management system based on
linear types. _This means D can never compete with Rust in performance and
real-time or soft-real-time systems._ On the other hand, it means with Rust
you will spend more time thinking about memory ownership and other important-
but-eliminated-by-GC concerns. Both are easier to deal with than C or C++.

• Syntax: Rust's syntax is not-quite-C-like; D's is very C-like. It comes down
to personal preference. I prefer Rust's.

D advantages:

• Metaprogramming: D's metaprogramming is more or less unmatched, though I
haven't experimented with Rust compiler plugins at all. You can probably do
some funky stuff with Rust, but it doesn't feel as integrated into the
language as with D.

• Compiles super fast.

Rust advantages:

• Type system. Rust's type system is ML-esque and generally much more
powerful. I suppose this might not be an advantage to everyone, but personally
I love how ML-y Rust feels.

• Concurrency.

• Ecosystem?

I think ultimately my choice is that _if I 'm going to use a compiled GC
language, I may as well just use OCaml_. D's memory management, or lack
thereof, kills it for me personally, but it's a well designed language
otherwise IMO.

~~~
agumonkey
Which projects use D as the main language ? Rust has Servo. Redox got some
light. But D has always been a language's language.

~~~
gver1
Areas of D usage: [http://dlang.org/areas-of-d-
usage.html](http://dlang.org/areas-of-d-usage.html) Organizations using D:
[http://dlang.org/orgs-using-d.html](http://dlang.org/orgs-using-d.html)

~~~
agumonkey
I should have tried harder. No, I should have tried.

------
jordigh
Other kernels in D: xomb and trinix:

[http://wiki.xomb.org/](http://wiki.xomb.org/)

[https://github.com/Rikarin/Trinix](https://github.com/Rikarin/Trinix)

~~~
steveklabnik
Sadly, XOmB hasn't seen a commit in three years. So it's not going to be
representative of contemporary D. (I was originally involved, long ago.)

~~~
yawniek
there was actually some activity within a fork:
[https://github.com/xomboverlord/xomb/network](https://github.com/xomboverlord/xomb/network)

------
t892
Why is D a good choice for writing a whole OS?

~~~
jordigh
Because it's a modern, safer systems language. It fills more or less the same
niche as Rust except it's more familiar to C++ programmers, or at least that's
been my experience. I know C++ fairly well, and I feel more at home with D
than with Rust.

