• PaX [comrade/them, they/them]@hexbear.net
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      8 months ago

      Ooh okay, so, Plan 9 from Bell Labs (these nerds specifically named it that so it would be impossible to market lmao) is a computer “research” operating system (operating system developed primarily to try out new concepts) in the late 80s into the very early 2000s by the same team who originally developed Unix (which originated pretty much all popular operating systems today except Windows, but even that has been highly influenced by Unix) to try to transcend the flaws of Unix while keeping its best concepts: system resources are represented as (ideally plain-text) files (file metaphor: you can read, write, create, and delete them) and that the system should be made up of small programs that combine together to accomplish great things.

      By the time Plan 9 was being developed, the limitations of Unix’s design were becoming more and more cumbersome. Unix was developed in a time where all computation was done on big (huge by today’s standards) computers that users would connect to with a dumb terminal and share system resources with many other users. Now pretty much no one does that and yet so many of the most fundamental aspects of modern Unixes’ design assumes this. From little things like the talk program being included by default with Linux distributions (lol, lmao, there’s no one logged onto my system but me) to more concerning things like the Unix security model being incapable of controlling system resource access for separate programs running under the one user on the system unless you starting adding shit on top of it (like SELinux, AppArmor, OpenBSD’s pledge, Linux’s Seccomp, whatever else the Linux people are cooking these days) or different Unix systems being unable to share resources unless some program is written specifically for a specific purpose (what other Unix system? Aren’t you connected to your universities big iron?). When a lot of non-Plan-9pilled people talk about Unix they always say something like what I said some of the big ideas about Unix are (everything is a file, small programs, etc)… but that hasn’t actually been true since… like… the mid 80s? It’s something more like “everything is an ioctl or a system call” lol. The fact is Unix was never designed for an era of ubiquitous, internet-connected, powerful computers with many capabilities that are often only used by one person but people just kept adding more stuff on top of it.

      So after the 10th edition of Research Unix, the Unix people threw it all away and started from scratch, keeping only the best concepts of Unix. One of the best things they came up with is a protocol called “9P” or the Plan 9 Filesystem Protocol. Essentially, this dead-simple protocol is used for accessing all resources on the system (and this system can be distributed across multiple computers, because once you start addressing all resources as files, it no longer matters if that resource is actually on your local computer, the Plan 9 kernel will just transparently speak 9P across the network to transfer files). I’m not exactly sure rn how to describe it further in abstract terms so maybe an example: all network connections on the system are represented under the directory /net/. If you go to /net/tcp/, you will see a clone file (you can open this file to make a new connection) and a series of other directories number 0-whatever that each contain a ctl file that you can use to control the connection and a data file which you can write to send data over the connection (although there are library functions and programs that can handle this for you). Or… something more familiar: let’s say you want to use another computer’s speakers. Because to send audio to output devices on the system you write audio data to a file called /dev/audio you can use the import (or rimport if you’re on 9front) program to “import” that file into your view of the filesystem or even replace your /dev/audio with it and any programs that use it will transparently send it to the other system and it will play out of that system’s speakers. Pretty much everything on the system is like this. And most of it is even in userspace, really the only thing the Plan 9 kernel does is handle 9P connections for you and manage hardware… so I guess you could even call it a microkernel lol. Web pages are files, audio is a file, network connections are files, etc etc. Careful use of this abstraction (among others) has made it so that Plan 9 is able to do many things Linux can with a tiny, tiny fraction of the code size and complexity.

      So my joke was that Twitter could be a filesystem too hehe. If you want to learn more about Plan 9 from people who know a lot more than me, you can read some of the papers that come with Plan 9, describing it:

      https://doc.cat-v.org/plan_9/4th_edition/papers/

      Or you can watch this video (and other really great videos) on Youtube by adventuresin9 that covers why Plan 9 is so weird and why it’s like this lol (I didn’t even talk about namespaces or how different programs can have different views of system resources/files):

      https://www.youtube.com/watch?v=VYAyINkDjNk

      Oh and 9front is just the most modern and maintained distribution of Plan 9, Bell Labs shut down a while ago sadly :(

      You can find their website here: https://9front.org/

      In short, I once heard Plan 9 described as: what if the things they told you about Unix were actually true? I hope all that made sense, I’m not so good at writing

      • AernaLingus [any]@hexbear.net
        link
        fedilink
        English
        arrow-up
        2
        ·
        7 months ago

        Thank you for such a thorough introduction! This sounds like such an interesting approach to an operating system, especially given that it’s something Bell Labs pursued. I’m actually wresting with some really annoying audio routing issues right now so the file abstraction for audio devices in particular sounds like a dream come true.

        I’ll definitely be delving into those additional resources you linked–you may make a Plan 9 convert out of me yet!

        Also you were bang-on about Lemmy not putting your first reply in my inbox because of the bot–what’s the deal with that, if you don’t mind me asking?

        • PaX [comrade/them, they/them]@hexbear.net
          link
          fedilink
          English
          arrow-up
          2
          ·
          7 months ago

          I’m glad you liked it!

          Also you were bang-on about Lemmy not putting your first reply in my inbox because of the bot–what’s the deal with that, if you don’t mind me asking?

          Lemmy will mark replies to you as read if anyone (or anything) replies to them at all for some reason. I keep missing replies cuz of this lol