开发者

Plan9 file-type

It 开发者_运维问答has been said that in plan 9 everything is a file.

Please list everything,

i.e. all things represented in the filesystem in plan9(especially things that are not files in *nix os-es).


It is not totally true that "everything is a file" but rather that most things have a file-like interface. It may seem like splitting hairs, but there's a difference. I don't think that I'll be able to list everything, but I'll give you some examples.

  • The interface for TCP/IP is a filesystem, /net exposes "files"
  • The text editor acme has associated control files to which textual commands may be written to change text in the window
  • The mouse and keyboard are represented as data files, /dev/mouse for example
  • The windowing system rio exposes a filesystem interface
  • The web browser abaco reads from a mounted webfs filesystem

The interesting thing is what sort of interaction "falls out" of this arrangement. Since most everything is text in a file somewhere, you can use normal shell scripts to implement things like an IRC client (read/write text directly to the network "file").

There are a lot of papers in the /sys/doc directory (and on the web) about the design and implementation of Plan 9.


For a (nearly) complete list have a look at manual sections 3 devices and 4 file servers.

The basic idea is that all resources look like file systems. The kernel exposes resources in the form of devices and user programs in the form of file servers.

This allows for easy sharing of resources in a networked environment. E.g. to use the mouse that is connected to another workstation, you just map (bind in Plan 9 lingo) /dev/mouse from that workstation to your name space. To use another machine as proxy for all tcp connections, just bind /net/tcp from that machine into your name space.

The details are all very well thought out and the system works nicely in practice. Browse the documents and manual pages and if you are still curious after that, give it a try and install it to see yourself.


Plan 9 is file-system centric, so it exposes every element of the system as a file, which was a primal philosophy of UNIX. This way a synergy is promoted into the environment and, as example, you are able to access a supported device from any node of the network, without needing any type of configuration.


As twopoint718 says, the "style" of Plan9 services is to provide a file-like interface.

It is impossible to list "everything" since anybody can write yet another service and expose it through a synthetic file interface.

I like to think of the Plan9 style as a big-chunk object based, or as Alan Kay says: "messaging based", system. You build systems by implementing these servers (microservices in the current paradigm), define their interfaces and then integrate ever more comprehensive systems by "plumbing" the constituent services.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜