
Writing Network Drivers in Go [pdf] - crunchiebones
https://www.net.in.tum.de/fileadmin/bibtex/publications/theses/2018-ixy-go.pdf
======
hardwaresofton
This is something I've noticed recently -- more and more researchers are
starting to write reference implementation code for networking and distributed
systems in Golang. In my own head, it makes sense -- golang is simple to read
if not verbose, doesn't require crazy formatting, has excellent standard
library support, and has relatively painless concurrency, and _can_ be run as
a scripting language. No it's not as easy to get started with as Python, Ruby
or Perl, but only one of those has easy-to-spawn native threads, nevermind
lightweight coroutines (and the one with native threads encourages illegible
code).

If you're not doing type theory work or very specific exploration in a
specific field, I don't know another language that is so easy to get up and
running with. On top of all this go's performance is pretty great/consistent
as well, JS is the only other scripting language that comes close generally,
but then you have to submit to the event loop.

I've always thought one of Go's true killer features is how hard it makes
cleverness.

I'm starting to seriously think Go's popularity is going to continue shooting
up. As I always note I think Go will supplant Java as the incumbent in the
enterprise software in one or two decades max.

[EDIT] - Forgot to include the most recent example that made me think this:
WPaxos(AKA WAN Paxos)[0] and the included github repo[1]. To be fair
CASPaxos[2] included gryadka[3] which is in JS.

[0]: [https://cse.buffalo.edu/tech-
reports/2017-03.pdf](https://cse.buffalo.edu/tech-reports/2017-03.pdf)

[1]: [https://github.com/ailidani/paxi](https://github.com/ailidani/paxi)

[2]: [https://arxiv.org/abs/1802.07000](https://arxiv.org/abs/1802.07000)

[3]: [https://github.com/gryadka/js](https://github.com/gryadka/js)

~~~
lkurusa
Let's not forget the Biscuit operating system by MIT just recently published
at OSDI'18:

\- The paper:
[https://pdos.csail.mit.edu/papers/biscuit.pdf](https://pdos.csail.mit.edu/papers/biscuit.pdf)

\- The code: [https://github.com/mit-pdos/biscuit](https://github.com/mit-
pdos/biscuit)

~~~
hardwaresofton
Awesome thanks that looks like a very interesting read.

Oh yeah another thing that just showed up on the front page actually, someone
writing network drivers for their bachelor's thesis in Go:

[https://www.net.in.tum.de/fileadmin/bibtex/publications/thes...](https://www.net.in.tum.de/fileadmin/bibtex/publications/theses/2018-ixy-
go.pdf)

------
pmoriarty
It looks like this is not a pure Go implementation:

 _" We originally implemented these functions in pure Go and tried to force
reads and writes through empty C calls as Go does not have the volatile key
word or an equivalent for our needs as far as we know. This resulted in
strange behaviour: while initialization seemed to work, including the
corresponding register getters and setters, the program failed later when the
NIC never set flags that were necessary to continue. We invested a lot of time
in this specific problem but could not find a reason for this behaviour. With
the help of cgo, which enables the use of C code in Go programs, we imported
the corresponding functions in device.h alongside log.h of the original C
driver and replaced our go functions. This fixed the aforementioned problem
though we never were able to provide an exact explanation due to limited time
constraints."_

It's still an interesting effort, and it makes me wonder if we'll ever see a
day when a significant portion of Linux is written in a safer language.

~~~
hazz99
> It's still an interesting effort, and it makes me wonder if we'll ever see a
> day when a significant portion of Linux is written in a safer language.

I really hope Ada makes a comeback, especially in commercial kernel
programming.

~~~
vasilia
We can start with nodejs. Nodejs with async model will be the best solution to
achieve the best performance(after 'delete spaces' method of course).

~~~
Itaxpica
Someone suggesting re-writing the Linux kernel in nodejs may be a strong
contender for Peak HN

~~~
vasilia
Why Linux? It's a simple hybrid kernel. It will be better to rewrite HURD/L4.

------
pjf
These guys are so positively insane! :) See [https://github.com/ixy-
languages/ixy-languages#overview](https://github.com/ixy-languages/ixy-
languages#overview)

------
romed
If nothing else this would be a fun and easy way to develop a driver from
scratch for unfamiliar hardware, even if you intended to port the whole thing
back to C in the end, after it was all figured out.

------
godelmachine
Contrast this with
[https://news.ycombinator.com/item?id=18405515](https://news.ycombinator.com/item?id=18405515),
which is trending at the top.

------
skocznymroczny
How do they handle the GC?

~~~
otterley
The driver only allocates memory on the stack, so no GC is required.

