100 likes | 313 Views
Unix File Access. Unix file access is accomplished via a series of tables Process file table System file table v-nodes (sometimes i-nodes) . File Access Facts. When an entry is allocated in a process’ file table, it is always the lowest numbered unused file descriptor
E N D
Unix File Access Unix file access is accomplished via a series of tables • Process file table • System file table • v-nodes (sometimes i-nodes)
File Access Facts • When an entry is allocated in a process’ file table, it is always the lowest numbered unused file descriptor • File table entries can be shared among related processes • Symbolic links are files that hold another file path/name; direct analogy to pointers
Process A Simple Version Process file table System file table File Pointer Each i-node has pointers into the data area 1 . i-node 0 i-node 1 i-node 2 Process B i-node 3 Process file table i-node 4 File Pointer 6 . 3 . same file! Process C Process file table Boot Super i-list block block file area File Pointer 1 .
v-nodes & i-nodes • i-nodes contain the actual links to file data • UNIX inode • File attributes stored (size, time, ID, etc.) • 12 ptrs to direct blocks • 3 ptrs to 1, 2, 3 levels of indirection • Compromise between fast access for small file, # of levels of indirection (slower access) for larger files • v-nodes are used in virtual file systems, where remote file systems can be mounted
v-nodes Client file system uses vnode as much as it would use inodes Purpose is to make access uniform, regardless of whether file/device is local or remote Abstract file location & details of access Virtual Node Layer Special device Local disk 1 Network file system Local disk 0
i-node Why indirect? Permits more data blocks to be accessed
Questions to Address in Class • What happens to a process’ file table on a fork? • What happens if a process with a pipe containing data calls fork()? • What do file tables look like when complex shell commands are executed? • How does dup2 affect the file table? • When are entries in the system file table shared? • What happens to fully buffered data if a fork occurs between buffering and output? • When is output fully buffered? • When are system file table entries shared, and when are inodes shared?