Hacker News new | comments | show | ask | jobs | submit login
Inferno, Part 3: Let's Make a Filesystem (debu.gs)
99 points by kryptiskt 579 days ago | hide | past | web | 16 comments | favorite

The 9P protocol truly is a beautiful work of engineering. There's actually another informal extension called 9P2000.e which is used by Erlang on Xen that adds session keys and a few new macro-operations (read whole file; overwrite contents) composed from lower level T/Rmsgs, but with ability to gracefully fall back to 9P2000. Linux v9fs has its own 9P2000.L in addition to the standard: https://github.com/chaos/diod/blob/master/protocol.md

Either way, it's much more elegant and portable than something like FUSE.

but why is FUSE used more often?

FUSE is an informally specified one-stop library that explicitly targets the Linux VFS, so it might be considered more convenient for whatever reason. There's also a general lack of knowledge about Plan 9 and Inferno on anything beyond a superficial level, though this might be improving.

9P is a small generic protocol that is often independently implemented because of its simplicity, so there are many heterogenous libraries for it.

However, FUSE implementations are actively maintained for all the BSDs and OS X as well.

Which required significant kernel additions in the case of the BSDs, and is a third-party kext for OS X.

In contrast, 9P is just a byte stream protocol that ranges from weekend project implementations in ~1000 LoC (yet still perfectly usable) to full strength client-server libraries. It's much more versatile and can be done entirely in userspace without special kernel cooperation beyond a basic POSIX runtime.

What's the typical way to handle transport security on 9p2000 or 9p?

See for instance: http://plan9.bell-labs.com/wiki/plan9/9p_services_using_srv,...

TLS tunneling is common. v9fs and diod give SSH port forwarding as an option. It's very generic, so the options are plentiful. 9P is formally transport-agnostic, from what I recall. Plan 9 natively preferred IL over TCP for a while before officially deprecating it around 2003.

It's just SSL; you can get more information at http://plan9.bell-labs.com/sys/doc/auth.html. There is also factotum, which serves a purpose somewhere between ssh-agent and an OS X-style Keychain.

I've been reading about Plan9 for a while. While I love the elegance of everything being a file addressable through the 9P protocol, I wonder about the feasibility of piping a "framebuffer" or other heavy process. Does someone know how the Plan9 holds, in this area, agains Unix in performance?

Back when I was excited about Plan9, I saw Tom Duff at Siggraph and I asked him if there was anyone present who would be interested in talking about the new Plan 9 window system, rio (which provides a compositing algebra-based raster graphics layer). He just said "no", basically, which led me to conclude that graphics on Plan 9 was not flourishing, even though the rio model is interesting. Performance over the network can't really be much worse than X11 for raster-heavy applications. I suggest you experiment with Plan 9/rio in a VM if you are really curious.

I should add that the model of an application that is split across the network (e.g. Rob Pike's Sam editor) offers ways to improve that. I can't speak to the efficiency losses of locally using pipes rather than some kind of shared memory, DMA, or direct graphics access, but maybe inferno has some multimedia-oriented fixes for that, I don't remember.

This looks great. Can someone recommend more books / papers / blogs / tutorials on writing file systems? I want to deep dive into it during Thanksgiving and want to create toy filesystems to play around with.

The book "Introduction to Operating Systems Abstractions using Plan 9 from Bell Labs" (also known informally as 9.intro) by Francisco Ballesteros has some well-written content that should be suitable even for beginners.

Find it here: http://lsub.org/who/nemo/9.intro.pdf

Ideas on how to present resources as file systems can be found in the original Plan 9 and Inferno papers. In addition, Charles Forsyth's "The Ubiquitous File Server in Plan 9" might also prove useful.


After that, there's always the source code of the 9P file systems shipped with Plan 9.

This tutorial is a good intro: http://blog.gopheracademy.com/cron-filesystem/

The Plan 9 web pages are really good (if dense).

If you write in Go, check out github.com/rminnich/go9p.

For a deep dive, "A Cached WORM File System" is a good read [http://doc.cat-v.org/plan_9/misc/cw/].

Dominic Giampaolo wrote "Practical File System Design with the Be File System" which he has made freely available at: http://www.nobius.org/~dbg/practical-file-system-design.pdf

I found it to be well written and interesting when I was a university student first going deep on the subject.

The Design and Implementation of the FreeBSD Operating System (2nd Edition) by McKusick is also well written and covers some of the same ground.

He was probably thinking more of 9P fileservers, rather than disk filesystems.

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