当前位置:网站首页>UNIX Environment advanced programming --3-file io---3.10 file sharing
UNIX Environment advanced programming --3-file io---3.10 file sharing
2022-06-13 09:38:00 【LuckyDog0623】
1、 The kernel is used for all IO Data structure of
Open the back of the file :fd = open("/tmp/text.c", O_RDWR | O_CREATE, 0777); fd Behind it 3 Data structures , It is this. 3 Data structures , Determines the properties of the open file , And the impact of multiple processes on the same file ( File sharing );
(1) Each process has a record entry in the process table , There is an open file descriptor table in the record entry , That is, a vector , Each descriptor occupies a vector bit ; Associated with each file descriptor is :① file descriptor flags (close_on_exec);② Pointer to a file table entry
(2) The kernel maintains a file table for all open files , Each file table entry contains :① Document status flag : read 、 Write 、 Sync 、 Non blocking, etc ;② Current file offset ;③ Point to the file v node Pointer to table entry
(3)v The node pointer points to a v The node structure ,v The node contains the file type and pointers to functions that perform various operations on this file ,v The contents of the node contain the contents of the file i node

2、i node


analysis :
①i The blocks of nodes are only stored in i Content of node ( file type , File access rights , File length and number of files pointed to ), Data block this contains data content , Fragmented space , Catalog items, etc
② Two directory entries point to the same i node , In other words, two more links can be found i Content of node
③stat The structure contains st_nlink( Hard links ) Member records how many times this node has been linked , So delete a directory entry using unlink Function instead of delete
④ Each file ( equipment ) Can I only correspond to one i node , that i What to do after the nodes are used up ?
⑤ When renaming a file , Just construct a pointer i New directory entry for node , And delete the old directory entries
⑥ The catalog is essentially ” file “, Creating a directory will also point to i node
边栏推荐
- 架构师必备:系统容量现状checklist
- (bfs+GOOD) acwing 845. Eight digit
- C language: file operation
- Can the operation of the new BMW I3 meet the expectations of the famous products of the 3 series?
- Summary of string, vector and array learning
- Tree and binary tree: basic operation and implementation of binary tree
- Haproxy + keepalived for high availability load balancing of MySQL
- (topological sorting +bfs) acwing 848 Topological sequence of digraph
- (dfs+ tree DP) acwing 846 Center of gravity of tree
- C language: Address Book
猜你喜欢

Exploitation of competitive loopholes in attacking and defending world PWN play conditions
![[Luogu p1403] Research on divisor](/img/c1/b2a91ddad264d5f8283abf27dc8839.jpg)
[Luogu p1403] Research on divisor

Heap

GCC compilation process

(dijkstra+ shortest path + edge traversal 0 (m)) acwing 850 Dijkstra finding the shortest path II

Figure: concept of figure
![1-4 message passing interface [CSP authentication]](/img/db/aecda548693cdfb0e740bcf1a1c823.jpg)
1-4 message passing interface [CSP authentication]
![[51nod 2493] sum of binary distances [bit operation]](/img/e9/8a8393f41cac7c323712c34f4d3e01.jpg)
[51nod 2493] sum of binary distances [bit operation]

Exercise 7-7 string replacement (15 points)

云计算企业崛起 甲骨文数据库市场主导地位动摇
随机推荐
[most comprehensive and detailed explanation] detailed explanation of knapsack problem
Alibaba senior experts analyze the standard design of protocol
(Dijkstra + shortest circuit + by point n^2) acwing 849 Dijkstra finding the shortest path I
(bfs) acwing 844. Labyrinth
Sort() sort function
C language: minesweeping
SpEL表达式 简单使用
全新BMW i3的操控,能符合对3系之名产品的期待吗?
[51nod p3058] Xiao ming'ai set [set]
(bfs) acwing 847. Hierarchy of points in the graph
1-4 message passing interface [CSP authentication]
LeetCode 剑指 Offer 30. 包含min函数的栈
【动态规划】入门篇
acwing 790. The third root of a number (dichotomy)
(dp+ memory) acwing 901 skiing
VDD,DVDD,AVDD,VCC,AFVDD,DOVDD,IOVDD
Tree and binary tree: storage structure of binary tree
VGA common resolution and calculation method
Acwing785. quick sort (sort+ quick sort + merge sort)
[51nod P3210] binary statistics