Jay Taylor's notes

back to listing index

Why Plan 9? (2001) | Hacker News

[web search]
Original source (news.ycombinator.com)
Tags: plan9 news.ycombinator.com
Clipped on: 2016-07-22

Image (Asset 1/2) alt= Hacker News new | threads | comments | show | ask | jobs | submit jaytaylor (1969) | logout
Image (Asset 2/2) alt=
Why Plan 9? (2001) (marc.info)
102 points by _acme 41 days ago | hide | past | web | 53 comments | favorite

Incidentally, the Raspberry Pi image was recently updated and has better multi-core support. Pretty nice for a near-instant boot terminal, although the non-UNIXness of it becomes a little bit grating when trying to remember how to SSH in a hurry.

(On mobile, so I'll add the link later, but http://taoofmac.com/space/os/Plan9 has my notes)

More on Raspberry Pi port in case others are interested. Raspberry Pi port is interesting, because it allows us to run plan9 on native hardware (access keyboard, mouse, video and probably audio - haven't checked). It doesn't matter that there isn't much power in it, because plan9 is designed to be distributed. Once you have a terminal, you can set up a cpu server and file server to run under a linux hypervisor in the same network.

You can think of a cpu server as being similar to this scenario: you ssh to a fast box, and run an app on that remote machine. However, due to the elegance of the plan9 architecture, instead of having the app run in the terminal window or over a laborious x-windows protocol, it writes quickly over the network to the window that you invoked the command from.

Unlike the unix experience, cross-compiling is trivial in this environment. Hence, it's fine to run varying architectures in the same system. Setting up a Raspberry Pi terminal is easy and cheap.

Some might ask - why? My motive: I see it as a different approach to software development. Instead of bolting monolithic systems together, I'll be able to implement platforms as devices that are exposed over 9p. Consider how much easier it is to do init for multi-host applications. Convential unix approach is and ugly spaghetti of scripts+ssh. In this design, just mount the apps and script them from one host. The network becomes transparent: you just script against devices.

> However, due to the elegance of the plan9 architecture, instead of having the app run in the terminal window or over a laborious x-windows protocol, it writes quickly over the network to the window that you invoked the command from.

I don't understand the distinction you are trying to make with the phrsase "quickly over the network". SSH and networked X aren't exactly slow. The latter can be a slug with a bad network, but I recently had to do something kind of fringe and ended up running firefox over wifi with ssh -Y, and it was usable.

You can argue that protocols, implementation, API, etc. are better with plan9 (consistent with claims I heard before) but I don't totally understand how that would necessarily translate into performance (if anything I would expect things used by more people over more time would be better tuned).

Oh, God. Are you serious? Listen try sitting in Texas some time and opening a X application even over a compressed SSH link from Delaware. It literally takes minutes for a splash screen to paint. And using applications are nearly impossible due to interaction lag. You're better off using a VMware console, RDP heck even Citrix which at one time was itself supposedly X based.

X is simply awful over the WAN, trust me. Please note: I'm not talking about an essentially text-only experience like xterm, which works fine. I mean actually using X as a graphical client.

The problem there is not so much X, as software devs not using X but instead just painting everything into "image" that is then dumped into X. This means you are effectively looking at what amounts of a VNC session, without the benefit of compression.

There are at least one X extension out there that offer compression for long distance connections. But for some reason they never really took off.

I did mention compression of the X session itself by way of compressing the SSH tunnel. The problems run deeper than "software devs just painting everthing into image". X itself has a mix of synchronous and asynchronous calls that are very sensitive to latency. XCB instead Xlib and use of LBX can help but do not eliminate the performance issues with X Window.

See http://keithp.com/~keithp/talks/usenix2003/html/net.html and http://vis.lbl.gov/Events/SC08/RemoteX/index.html for more details.

As it relates to the original topic I'd be interested to see real-world performance comparisons between Plan 9 and X because as the papers state X stinks on ice over the WAN.

Does plan9 works well over a WAN? (Genuine question)

Yes. For remote control, drawterm (a client to "cpu" into a plan9 box from a non-plan9 box) can even make the GUI feel local over poor connections (except if you try to play doom or something).

That's over a LAN. But what about over the distances earlier in the thread - the earlier example was a line across a significant bit of continental US. [More interesting still would be Sydney to London.]

No, I was talking about WAN, not LAN. (Note that 9front's fork of drawterm is a lot faster than the normal version - a regular drawterm can be a bit slow)

I am not located in the US, but hopping borders in europe does not seem to be a problem. It's less of a problem than with X-forwarding or VNC.

As for regular fs mounts (note that a remote control session on plan9 is actually also just a regular fs mount), I mount things from the US every once in a while, and I am located in Sweden. It's obviously not fast due to very high latency and limited bandwidth, but it works just fine within those constraints.

But of course, if the RTT >1 second, then it will take >1 second for a keystroke to show up on screen in a remote control session. You cannot be resistant to this (mosh tries to guess how things would look if the keystrokes had gone through, which is a major hack, and not really an issue).

Nomachine worked reasonably well for me cities apart. I believe it was adding some compression to X at the time; circa 2011.

Thanks for the corrections. There are many reasons to dislike X, but sounds like speed isn't one.

It's available at http://plan9.bell-labs.com/sources/contrib/miller/.


> Finally, Plan 9 fits well with a networked environment. Since files or directory trees can be imported from other machines, and all resources are files or directory trees, it's easy to share resources. Want to use a different machine's sound card? Import its /dev/audio. Want to debug processes that run on another machine? Import its /proc. Want to use a network interface on another machine? Import its /net. And so on.

Does this kind of abstraction actually work well? Networks are generally quite unreliable so does it really work well to treat everything as files even when the latency can be so different depending on if the resource is local or remote? Do the plan9 APIs make it natural to write code that deals well with random blocking when reading/writing to files?

I've not used Plan9; but one ought to consider that any IO may not be successful, and this is regardless of the device.

It may generally be less likely to encounter disk read errors than it is to encounter network timeouts, but both will eventually occur.

The 9P protocol is designed to deal with arbitrary blocking, as synthetic filesystems commonly block reads until some data is present. There are also automatic reconnection proxies (aan), and when a mountpoint is entirely unresponsive (lost connectivity), you can just unmount it. The pending calls will all fail gracefully.

The abstraction works well. The main issue is when you lose access to your root device. Just like if you booted a Linux machine from NFS, the root disk connection must be stable (how do you unmount without being able to read the binary). All other mounts can be arbitrarily flakey.

> how do you unmount without being able to read the binary

We have enough RAM now that there's no reason (even on embedded devices!) to ever unload the initrd/initramfs. An OS should be able to be configured such that you can unmount your rootfs whenever you like, and just automatically be de-pivot-root'ed and end up back in your initramfs, where you can mount the rootfs again.

What's your definition of embedded? It's not embedded if you're running a full blown OS on a regular ARM chip.

Anyway, you could make a ramdisk, put things in it and put it in your path. I doubt that a linux box will survive a dead root without hardcore sysadm skills, but it should work on plan9. Initrd is not meant to stay behind after boot, though.

This abstraction works fantastically well in QnX, a system used in production the world over so I see absolutely no reason why it wouldn't work in plan9.

I found that the web browser that comes with Inferno, which is a very interesting variant (not a distribution) of Plan9, is quite a bit better than the one found in the "original" Plan9. Inferno is amazing in its own right and is worth having a look at.

I've never really understood Inferno. Sometimes it is described as something you run from a browse and others as a standalone OS. Which is it?

The userspace is compiled to something kind of like Java byte code, that runs in a VM. A hardware kernel exists that provides this VM, but it also has implementations that run in userspace on the big three OSes.


It's great terminal emulation doesn't exist in Plan9, but with that you lose 99% of terminal application functionality, especially curses.

People tend to conflate the concept of text based interfaces with terminals and curses but it's possible to have text interfaces without curses. Most plan 9 applications have text interfaces but do not use terminals.

What's the curses equivalent?

For what it's worth, anything that does more than just print to stdout breaks in 9term.

Windows in plan 9 are images that are drawn to. There are libraries for drawing fonts and various shapes.

Another thing that get conflated with text interfaces is keyboard control. For whatever reason the plan 9 developers were very adverse to this and preferred mouse based interaction.

Anyway plan 9 is interesting because of how it's different. If you're approaching it asking "Where's emacs and vim?" or "Why can't I get my shell history by pressing up?" you're probably not getting the full value out of it. Part of the problem is probably that it's close enough to unix to make people put unix expectations on it.

Here's a video about acme, a programmer's interface for plan 9.


Check out these man pages. http://plan9.bell-labs.com/magic/man2html/2/window http://plan9.bell-labs.com/magic/man2html/2/graphics http://plan9.bell-labs.com/magic/man2html/2/draw

Thanks for the long reply, though I must admit I'm aware of all that. I was hoping for some surprise information.

Your comment of it seeming like Unix might be the key point to take away. I know that I'm supposed to search in the buffer for history and use the mouse to select and rerun it, but having tried it multiple times, I cannot get comfortable with a mutable terminal buffer. That's also why in Emacs I only use term and not the editable terminals. Maybe one day I'll get comfortable.

Curses has nothing to do with the unix philosophy, and "terminal application" should not be confused with what is actually characteristic of unix: its IPC and IO model, and its possibilities for composing programmes through those. The fact that you most often utilise these features through a terminal emulator that runs a shell does not mean that curses and the ilk are essential to unix because they happen to draw interfaces in those terminal emulators. Curses it not more or less unixy than any other windowing/UI-widget library.

I don't understand what you're replying to. I didn't say curses==unix. Most terminal based applications use curses, therefore the lack of it limits the pool of applications.

devdraw, which is more of an X equivalent than curses, but oh well.

Again, the vt terminal emulator is available if you want vim over ssh.

What you lose is VT escape sequences, a hack to try to make TUI's when there was no alternative. In Plan9, your terminal windows naturally transition to be fully fledged GUI's when needed.

Also note that there is vt (at least on 9front), a terminal emulator for plan9, if you really want to use such applications. There's ssh too, if you need it.

A thing I forgot to mention: this means that if you "cpu" into another host, you can run text based commands, but you can also start the browser, mothra, or even doom in the same window. There is no difference between telnet and x forwarding on plan9.

When I ran Plan 9 inside of VMWare Fusion, the one thing I missed was Readline/Libedit. I honestly don't know how people did without them.

If you make use of a real UNIX, you will be surprised how many GNU and BSD goodies improve the usability.

An out of the box installation is hardly better than UNIX System V.

There's an emulator, IIRC.

Do you mean Plan9's terminal? If so, the whole point of it is that it's not constrained to emulating TTY.

vt(1) [1] is a terminal emulator installed on Plan 9 which can emulate a vt100 for any program which needs it. So you have something which can give you curses if you want it.

[1] http://plan9.bell-labs.com/magic/man2html/1/vt

Cool, hadn't seen that before. Unfortunately, doesn't seem to be in plan9port.

That's because the OSes on which plan9port runs already have plenty of apps that can emulate a vt100.

Your question suggests to me that you still don't get it: nothing in Plan 9 -- not the shell, not the ability to issue command lines and get stdout and stderr back -- depends on vt(1). vt(1) is used only to communicate with (tty drivers on) other OSes, over the network.

Just as most of time, a user of OS X has no need for an X server, most of the time, a Plan 9 user has no need for vt(1) or for ncurses.

I'm not suggesting you give Plan 9 a try BTW: on its best day ever, it had fewer than 1000 users, and if it was ever going to break 1000 users, it would have done so by now. The whole OS (excluding some fonts) has been available under an OSI- FSF- and DFSG-approved license since 2002.

So for example, Plan 9 will almost certainly never have a web browser capable a delivering a satisfactory experience on more than half of the 1000 most popular web sites -- because porting such a web browser to Plan 9 would cost 10s of millions of dollars in programmer time, and no one is going to spend that money to get fewer than 1000 new users.

And Plan 9 will never have more than 1000 users because it can't get a web browser to deliver a satisfactory experience.

It's a horrible chicken-and-egg thing.

There is a potential path. Someone builds a killer app that uses a 9p mechanism to deliver content, or else a better experience for an existing app. With this done, a browser decides to implement drawterm as a browser mode. Once you had that, it could start challenging html/css/javascript.

Which is a great thing, as we can then focus on what matters/we care about. Normal people are annoying, and tend to be demanding. :)

mothra(1) delivers

Agreed, and I know, so I should have said my use case is more with plan9port which is used with existing Unix applications. Therefore I had the desire to open a special win in acme that would support some level of tty emulation.

Is there a usable version of plan9 we can install?

Couple of options: Raspberry Pi, or virtualisation.

9front say to avoid virtualbox, but it works. Here's a tutorial, https://www.youtube.com/watch?v=n5XAhsHyqow

Qemu is a thousand times better if your OS has KVM support. Especially for running terminals since the only files you'll need are plan9.ini (a short text file) and 9pcf (the terminal kernel). You don't even have to set up a disk image, it just mounts root from your file server and you have everything ready to go!


Is the image for the Rasperry Pi. Is said to be working with Pi 0/1/2.

Has be a quite frustrating experience for me. I recommend to run it on qemu or virtual box. 9vx is the coolest way to run plan 9 (it's thin virtualisation layer that allows access to the host) but it does not seem to work 9front.

9front runs on virtual machine and on hardware just fine.


Some may find the plain text version easier to read:


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact