Hacker News new | ask | show | jobs
by wishinghand 1616 days ago
I’m too rudimentary of a developer. What’s a Userland? What is this doing that writing apps as Go executables doesn’t or can’t do?
3 comments

Maybe the easiest way to visualize it is that there is no filesystem at all. No shell, no "libc", no "ssh into the machine", no "cp", "mv" "ls", etc.

They do provide a way to get one filesystem in place, but you can only interact with it using golang calls within your application.

"no filesystem" does not fit into this list of things. There is definitely a filesystem. It has an optional sshd, and an optional shell that includes cp, mv, ls, etc, but there is always a filesystem.
https://en.wikipedia.org/wiki/User_space#Overview says:

“The term userland (or user space) refers to all code that runs outside the operating system's kernel.”

I see a difference between userland and user space. For userland I would add “and that’s needed to bring the OS to a usable state”. You need code that is triggered when an USB device is plugged in, tools to query what hardware is available, tools to format disks, etc.

“Usable state” is up for discussion, though. For example, I don’t think X11 or Wayland are needed, but opinions on that will vary. That may be why the table in the link I gave has parts shaded yellow.

I don’t think (but Wikipedia disagrees with that by making user space and userland synonymous) anybody calls QT, the Gimp or Open Office part of userland, even though they run in user space.

QT, Gimp and Open Office are 100% considered userland. I'd be surprised if you could find very many people who disagree.
Until someone more experienced than me comments: The userland is the collection of programs and functionality that run outside of the kernel. AFAIK you need some things (but I'm not sure which) apart from the kernel if you want to run your executables, and it looks like Gokrazy provides those.
To clarify a bit, you don’t need additional things to run your executables per se (for example, pure Go binaries can run directly on the Linux kernel) but there are a lot of utilities that you will probably want—things like a process manager, SSH daemon, a shell, etc. These are all userland components.
To expand on this, it means that once the kernel is done booting, the first (and only) program it will start is the bundled go-written application. This differs from the usual chaining to the "init" (like systemd) process, which would then spawn a myriad of other programs.