什么是文件系统协议以及它如何工作?

发布于 2024-10-11 14:06:37 字数 560 浏览 2 评论 0原文

作为示例,我将选择 Plan9 的文件系统协议,称为 9P(又名 Styx)。 正如维基百科的文章所述:

9P 是一种网络协议,作为连接组件的方式而开发(...) Plan 9 系统的组成

的角度来看,应该使用哪些技术来构建这样的模块通信系统。支持该协议的操作系统(阅读 Unix 衍生版本)有哪些要求。

在我的理解中,整个网络的每个组件(id est,应用程序,模块)都必须有一个私有控制器(或者这个控制器应该在整个系统中共享?),以发送请求和接收响应,能够执行单个应用程序的内部逻辑和通信协议本身(可能是特定语言,例如 XML?、数据库,甚至某种信息的文件系统反映?)之间的转换任务。从这个(我的)观点来看,所描述的系统可以被定义为客户端-服务器体系结构的变体,但被投射到本地或受限网络范围,并强调直接数据访问和效率。这就是我对文件系统协议设计的看法...

我刚刚开始研究操作系统的进程/应用程序通信技术,并希望开发一个迷你文件系统协议来看看这个概念的实际应用。由于理论基础的泄露,我没有任何实际和具体的工作计划,所以欢迎任何解释、文献建议、例子和只是评论!

Just as example I will pick up Plan9's filesystem protocol called 9P (a.k.a Styx).
As the article in Wikipedia states:

9P is a network protocol developed (...) as the means of connecting the components
of a Plan 9 system

I want to know, from the programming perspective, what are the technologies that should be used to build such a module communication system. And what are the requirements for the operating system (read Unix derivatives) to support this protocol.

In my understanding, each component (id est, application, module) of the entire network must have a private controller (or should this controller be shared across the system?), to send requests and receive responses, with the ability to perform the translation tasks between the internal logic of the individual application and the communication protocol itself (may be a specific language such as XML?, database, or even some kind of filesystem reflection of information?). From this (my) point of view the described system may be defined as a variant of client-server architecture but been projected to the local or restricted network scope and with emphasis on direct data access and efficiency. That's how I see the design of a filesystem protocol...

I just initiated the study of operating systems' process/application communication techniques and would like to develop a mini filesystem protocol to see this concepts in action. I don't have any real and concrete work plan due to leak of theoretical fundaments so any explanations, literature suggestions, examples and just comments will be welcome!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

好菇凉咱不稀罕他 2024-10-18 14:06:37

您可以在 /sys/doc 部分(或在线 html, ps、pdf)。

其工作的高级方式与您的理解类似,系统有 17 种协议消息(例如 opencreatewalk删除)。有一个 RPC 机制负责从服务器发送和接收消息。以下是该论文的引用:

内核数据结构,通道,是文件服务器的句柄。对通道的操作会生成以下 9P 消息。 sessionattach 消息验证通过 9P 外部方式建立的连接,并验证其用户。结果是一个引用服务器根的经过身份验证的通道。 clone 消息使新通道与现有通道相同,非常类似于 dup 系统调用。可以使用walk消息将通道移动到服务器上的文件以降低层次结构中的每个级别。 statwstat 消息读取和写入通道引用的文件的属性。 open 消息为后续的 readwrite 消息准备通道以访问文件的内容。 Createremove 对通道引用的文件执行其名称所暗示的操作。 clunk 消息丢弃通道而不影响文件。

Plan9 的巧妙之处在于该接口在操作系统中无处不在。很多东西都提供这个接口(文件服务器)。

You can read all about the Plan9 network in the /sys/doc section (or online html, ps, pdf).

The high-level way that this works is similar to your understanding, the system has 17 protocol messages (stuff like open, create, walk and remove). There is an RPC mechanism that takes care of sending and receiving the messages from the server. Here's a quote from the paper:

A kernel data structure, the channel, is a handle to a file server. Operations on a channel generate the following 9P messages. The session and attach messages authenticate a connection, established by means external to 9P, and validate its user. The result is an authenticated channel referencing the root of the server. The clone message makes a new channel identical to an existing channel, much like the dup system call. A channel may be moved to a file on the server using a walk message to descend each level in the hierarchy. The stat and wstat messages read and write the attributes of the file referenced by a channel. The open message prepares a channel for subsequent read and write messages to access the contents of the file. Create and remove perform the actions implied by their names on the file referenced by the channel. The clunk message discards a channel without affecting the file.

What's neat about Plan9 is that this interface is ubiquitous in the operating system. Lots of things present this interface (a file server).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文