Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 操作系统 > Linux > unix/linux是如何实现文件共享的?
【标  题】:unix/linux是如何实现文件共享的?
【关键字】:unix/linux
【来  源】:http://www.cublog.cn/u/6889/showart.php?id=124799

unix/linux是如何实现文件共享的?

Your Ad Here

The kernel uses three data structures to represent an open file, and the relationships among them determine the effect one process has on another with regard to file sharing.

  1. Every process has an entry in the process table. Within each process table entry is a table of open file descriptors, which we can think of as a vector, with one entry per descriptor. Associated with each file descriptor are

    1. The file descriptor flags (close-on-exec; refer to Figure 3.6 and Section 3.14)

    2. A pointer to a file table entry

  2. The kernel maintains a file table for all open files. Each file table entry contains

    1. The file status flags for the file, such as read, write, append, sync, and nonblocking; more on these in Section 3.14

    2. The current file offset

    3. A pointer to the v-node table entry for the file

  3. Each open file (or device) has a v-node structure that contains information about the type of file and pointers to functions that operate on the file. For most files, the v-node also contains the i-node for the file. This information is read from disk when the file is opened, so that all the pertinent information about the file is readily available. For example, the i-node contains the owner of the file, the size of the file, pointers to where the actual data blocks for the file are located on disk, and so on. (We talk more about i-nodes in Section 4.14 when we describe the typical UNIX file system in more detail.)

    Linux has no v-node. Instead, a generic i-node structure is used. Although the implementations differ, the v-node is conceptually the same as a generic i-node. Both point to an i-node structure specific to the file system.

  4. Figure 3.6. Kernel data structures for open files

 
Figure 3.7. Two independent processes with the same file open


iptableas中文手册:【上一篇】
忘记Linux的root登录密码时怎么办:【下一篇】
【相关文章】
  • 学习UNIX/LINUX的几个好网站
  • unix/linux体系结构图
  • (转)UNIX/Linux Shell的程序编写
  • Unix/Linux 操作系统快速入门
  • unix/linux中的dup()系统调用
  • 免费unix/linux shell帐号!
  • UNIX/Linux Shell编程实例精解代码下载
  • Unix/Linux 平台任务的自动化(zz)
  • UNIX/LINUX中使用MRTG自动画虚拟主机流量图(虚拟主机)
  • Unix/Linux下的“魔法兔仔”, webmin
  • 【随机文章】
  • Win32 ASM详解-超类化
  • 怎样把肉鸡做成SOCK5代理跳板
  • Cisco模块化路由器 1750
  • 加密算法之DSA算法
  • Simple ADO Database Read, Insert, Update and Delete using C#.
  • C 语言函数库总结
  • Eclipse下的Java反编译插件:Jode Decompiler
  • 舞蹈机器人步进电机驱动电路和程序设计
  • What static_cast is actually doing
  • [抄书]The Pipes and Filters pattern
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.