Live data from Hacker News

Linux Namespaces Are a Poor Man's Plan 9 Namespaces

yotam.net

261–270 of 311 posts

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#261

Earlier quoted context omitted.

> The same person Go was designed by: - Robert Griesemer, known for nothing else, - Rob Pike, primarily known for sam(1), acme(1) and several other Plan 9 tools, the Blit (Unix's own graphical terminal), UTF-8 (with Ken Thompson), Inferno and Limbo, - and Ken Thompson, ancient god.

Before Go, Robert Griesemer worked on: - Strongtalk: https://www.strongtalk.org/history.html - Object Oberon: https://en.wikipedia.org/wiki/Object_Oberon - Sather: https://www.gnu.org/software/sather/docs-1.2/tutorial/intro2...

This is the first time I've heard about any of these. Thank you!

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#262

Earlier quoted context omitted.

> The same person Go was designed by: - Robert Griesemer, known for nothing else, - Rob Pike, primarily known for sam(1), acme(1) and several other Plan 9 tools, the Blit (Unix's own graphical terminal), UTF-8 (with Ken Thompson), Inferno and Limbo, - and Ken Thompson, ancient god.

All these things you listed are objectively bad and a tumor and I'm glad that those that are gone, are gone for good, because the one that stayed is a menace to any programmer caring about his sanity.

Are you including UTF-8 in "those things" that are "objectively bad and a tumor" ?

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#263
post #202
post #194

Earlier quoted context omitted.

For one, encoding and decoding text is slower than binary calls to a function with solid parameters that don't need to be converted. It's far too easy to pretend reality is not complex and that "elegant" solution somehow will fit everything

Netlink sockets in Linux input and output packed C structures. Doesn't get more efficient than that. Such an interface definitely doesn't have to be strings-only. But of course, you cannot use it with just 'echo' in that case.

Passing data in registers is more efficient, that's what you lose with serialization. Serialization gets you generality at the cost of some performance.

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#264

Earlier quoted context omitted.

When everything is a file, what is a "file" becomes flexible. In Plan 9, you send signals and messages to a file by writing to it. And read messages by reading from it. It's in essence no different than OOP or actor model or what have you.

An attempt is being made to reduce everything to: interface UniversalInterface { fun open(…) fun read(…) fun write(…) fun close(…) } If you went to a software engineering design review meeting, proposing that several different kinds of objects representing everything from files, network sockets, to arbitrary devices should all use the interface above, you’d be laughed out of the room. Ultimately, when someone does en…

> you’d be laughed out of the room

Doubtful. Why are the main paradigms?

Everything is an object

Everything is a function

Everything is a resource (REST)

Uniform interfaces are common for good reason: you gain a lot of flexibility for redirection, introspection and policy control.

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#265
post #206

Earlier quoted context omitted.

> Coercing random access memory into a serial file just to go and emulate a random access over that file is... not a great way to deal with a high-performance primitive. The file doesn't need to have an on-disk representation. I don't see why an mmap-ed file should behave any different from a SHM segment. They are basically the same thing, the SHM segment even has a file descriptor. It just doesn't have a name somewh…

To reverse that question, what do you gain by defining a `read` and `write` API over that memory segment? Because if you just add some high-level interface without any concern for performance, yeah, you get what Linux does today. But if you make them a core concern of your shared memory interface, you will certainly lose performance on the cases it's mapped as memory. And "everything is a file, but this one here is a…

Yeah, "everything has a filename" and "everything is a file" are very similar concepts but they aren't quite the same, and it might be that most of the value comes from the former.

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#266

Earlier quoted context omitted.

To elaborate on those points a bit further, past what I already said about pidfd being introduced exactly to treat processes as files: 1. ioctls can make any "syscall" on a file. 2. a process does not have to be a singular file. All processes have most if not all their attributes exposed as files /proc/$PID/ as files, and can have this arbitrarily extended. In plan9, passing a signal (technically a note) is done by w…

This is an absurd interpretation of "everything is a file." The kind that makes you go "arghwhat?!" A file descriptor is exactly nothing like a file. You cannot write to a pidfd. You cannot waitid an eventfd. You cannot getsockopt on a regular file. The only operations that all file descriptors have in common is close, dup, poll and some other basic operations. So "file descriptor" basically just means "kernel interf…

A file descriptor is a handle to a file, and anything you have an fd to is a file. This file carries a vfs implementation, such as that of pidfd, a device driver, or disk storage. The kernel does not distinguish between these.

If not being able to write makes it not a file, then files stop existing when a disk is full, and means that /dev/zero and /dev/null are not files - despite being at the heart of the whole "everything is a file" paradigm.

Pidfd was not made to make processes behave like files - that is what /proc is - but to solve problems with process related syscalls and PIDs, which are flawed and racey. The solution to that was to make APIs that treat processes as files, which gives you the ability to poll it like a file.

A streaming socket is exactly like a normal file. You read, write and poll. The only thing that is special is how to create it, but that is a design decision, not a technical limitation - see the plan9 file based API for making TCP sockets, which is trivially implementable in Linux.

Domain sockets are a bit different because of their side channel and would require more ctl files, but Linux's API is 99% magic files and ioctls so this is not that weird.

ioctls are not themselves bad design. In fact, scoping kernel functionality onto file handles is a great design and why that's almost the entirety of the kernel (device driver calls dwarf syscalls). The problem is not the design itself, but the fact that ioctl was not originally meant for it and got overloaded through several design iterations. This is what happens when you do organic design through more than 3 decades.

If you start out by defining a way to do file-scoped syscalls - and file does and always will mean "an fd" to a kernel - then you wouldn't have that awkwardness. That is what plan9 did: Take the learnings, and implement them clean instead of on legacy.

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#267

Earlier quoted context omitted.

The Windows NT kernel is surprisingly well-designed. Everything is an 'object' to the kernel (or file descriptor). Concepts like ACLs apply to all kernel objects. I summarized about some of its capabilities previously: https://news.ycombinator.com/item?id=34914776 One concrete example of its design: exercising administrator (sudo) permissions causes a User Account Control (UAC) dialog to pop up, which takes over the…

Isn't the kernel API banned from usage by userspace applications that aren't kernel32.dll (plus deliberately breaks ABI all the time) ? I can appreciate the strengths of the NT kernel, but if nobody is allowed to use it... (I suppose kernel drivers can, but that's still a very narrow range of applications) Also, while IOCP has the advantage of being older w.r.t. availability, I wonder how io_uring competes - I haven'…

There's a quote that goes something like "the last piece of software ever written for a novel OS is the UNIX compatibility layer". kernel32.dll is essentially that, except it isn't even UNIX compatible!

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#268
post #202

Earlier quoted context omitted.

Netlink sockets in Linux input and output packed C structures. Doesn't get more efficient than that. Such an interface definitely doesn't have to be strings-only. But of course, you cannot use it with just 'echo' in that case.

Passing data in registers is more efficient, that's what you lose with serialization. Serialization gets you generality at the cost of some performance.

Right, registers are even faster.

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#269

Earlier quoted context omitted.

I used "half-baked" in the context of UNIX history, where the legend goes that UNIX was the stop-gap solution for AT&T failing to come up with a better designed system on schedule. Unfortunately, today, UNIX is by and large all we have. Other things are either some kind of UNIX but with a twist, or very underdeveloped. Looking into the future, I'm very enthusiastic about OS-as-a-library approach, but I don't think we…

I think one approach in (re)designing an OS should be to go back to fundamentals: what makes an Operating System? I think fundamentally, there are only a few things it has to do: Allow applications to run (on the CPU/other hardware), Allow applications to communicate between themselves (establish communication standards), Allow access to disk, Manage the time given to each application well/fairly, Define permissions…

Theseus OS is a Safe-Language OS which solves almost all problems of today’s OSes by leveraging Rust’s compiler guarantees.

https://www.theseus-os.com/Theseus/book/index.html

Re: Linux Namespaces Are a Poor Man's Plan 9 Namespaces

#270
post #206

Earlier quoted context omitted.

> Coercing random access memory into a serial file just to go and emulate a random access over that file is... not a great way to deal with a high-performance primitive. The file doesn't need to have an on-disk representation. I don't see why an mmap-ed file should behave any different from a SHM segment. They are basically the same thing, the SHM segment even has a file descriptor. It just doesn't have a name somewh…

To reverse that question, what do you gain by defining a `read` and `write` API over that memory segment? Because if you just add some high-level interface without any concern for performance, yeah, you get what Linux does today. But if you make them a core concern of your shared memory interface, you will certainly lose performance on the cases it's mapped as memory. And "everything is a file, but this one here is a…

Having a cursor to access files is mostly legacy no? The difference between memory and storage is getting very small, e.g. ssds and optane
Post reply on HN