Publish a post about programming languages as operating systems

This commit is contained in:
Konstantin Nazarov 2023-09-25 21:42:33 +01:00
parent d008ba3c23
commit d352b6afc6
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22

View file

@ -0,0 +1,27 @@
X-Date: 2023-09-25T22:50:00Z
X-Note-Id: 7fa989b7-530e-4121-b46b-03d8e41e3b69
Subject: Programming languages are operating systems
X-Slug: programming_languages_are_operating_systems
This is a thought that I've been having lately while working on my own programming language: any sufficiently advanced programming language tends to become an operating system.
For example, here's what Go needs to do in order to fit its niche:
- Abstract away the networking differences of its host platforms.
- Implement custom threading and event system.
- Implement its own IPC (channels and co).
- Implement an I/O layer.
- And a package manager.
- And an ABI for modules.
- Unicode layer.
- ...and many others.
In fact, programming in high-level cross-platform languages is almost nothing like programming for a specific operating system. The only exception to this is probably writing in C, where you mostly rely on the abstractions that your OS ships by default (at least in the case of Windows, Linux, and BSD derivatives).
The reason why many languages choose to become operating systems is (in my opinion) the need to have easily distributable programs. As soon as you need to make your app portable, the dependency on the OS-provided libraries goes out the window. You either link everything into the binary or deal with the autotools hell.
My observation is that over time, fewer and fewer programs call into other programs directly (by loading code), and instead opt for a network- or socket-based IPC. This, and the need to provide secure isolation, would likely lead to programs being completely sealed in sandboxes. Which is already partially true for systemd, and more so for desktop apps on MacOS and Windows.
At this point, my question would be whether it makes sense to run programs under an operating system at all? Maybe we should just accept a minimal abstraction layer like Rumprun and use a hypervisor with paravirtualized hardware (including network, disk, and EGL surfaces). Then not only will we get a smaller attack surface, but also easier maintenance.
If every language reimplements a good chunk of abstractions of the OS, maybe the lack of the OS itself won't be that much of a loss?