作为示例,我将选择 Plan9 的文件系统协议(protocol),称为 9P(又名 Styx)。
正如维基百科中的文章所述:
9P is a network protocol developed (...) as the means of connecting the components of a Plan 9 system
我想知道,从编程的角度来看,应该使用哪些技术来构建这样的模块通信系统。操作系统(阅读 Unix 衍生产品)支持此协议(protocol)的要求是什么。
在我的理解中,整个网络的每个组件(id est、application、module)都必须有一个私有(private)的 Controller (或者这个 Controller 是否应该在整个系统中共享?),来发送请求和接收响应,并具有执行翻译的能力单个应用程序的内部逻辑和通信协议(protocol)本身之间的任务(可能是一种特定的语言,例如 XML?、数据库,甚至是某种文件系统信息的反射?)。从这个(我的)观点来看,所描述的系统可能被定义为客户端-服务器架构的变体,但被投影到本地或受限网络范围,并强调直接数据访问和效率。这就是我如何看待文件系统协议(protocol)的设计......
我刚刚开始研究操作系统的进程/应用程序通信技术,并想开发一个迷你文件系统协议(protocol)来查看这些概念的实际应用。由于理论基础的泄露,本人没有任何真实具体的工作计划,欢迎大家多多解释、文献建议、实例和评论!
最佳答案
您可以在 /sys/doc
中阅读有关 Plan9 网络的所有信息。部分(或在线 html 、 ps 、 pdf )。
这个工作的高级方式与您的理解相似,系统有 17 条协议(protocol)消息(诸如 open
、 create
、 walk
和 remove
之类的东西)。有一个RPC负责从服务器发送和接收消息的机制。这是论文的引述:
A kernel data structure, the channel, is a handle to a file server. Operations on a channel generate the following 9P messages. The
session
andattach
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. Theclone
message makes a new channel identical to an existing channel, much like thedup
system call. A channel may be moved to a file on the server using awalk
message to descend each level in the hierarchy. Thestat
andwstat
messages read and write the attributes of the file referenced by a channel. Theopen
message prepares a channel for subsequentread
andwrite
messages to access the contents of the file.Create
andremove
perform the actions implied by their names on the file referenced by the channel. Theclunk
message discards a channel without affecting the file.
Plan9 的巧妙之处在于该接口(interface)在操作系统中无处不在。很多东西都存在这个接口(interface)(文件服务器)。
关于filesystems - 什么是文件系统协议(protocol),它是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4674824/