Unix file system standard




















Unix doesn't care. A user process and the kernel must agree on names for open file connections. Analogous to the difference between a program and a process, there is a difference between a file and an open "connection" to a file: for example we may have two open connections to the same file, but be in different positions in the file with respect to our next read. So the file name itself isn't really appropriate for communicating which connection you want to read the next byte from.

So the OS and the user process refer to each open connection by a number type int called a file descriptor. Standard input, output and error default to file descriptors 1, 2 and 3 respectively. The process table entry aka process control block contains a table, the file descriptor table that gives the mapping between the descriptor the process uses to refer to a file connection and the data structure inside the kernel that represents the actual file connection. Directories help in organizing the files which are present.

The directories can contain ordinary files, special files or even other directories. All these directories are the descendants of the root directory.

The special files are used to represent physical devices like printer, tape driver or a terminal. Unix considers any device to be a file. Even the terminal is considered to be a file. It is considered as standard input file from where input is read. To link commands Unix provides pipes. The pipe is a temporary file. This also holds data from one command which is kept until it is read by another command.

The output of one command is given to the next command as an input. There is clear segregation between the contents of the file and the information which is present in the file. All files consist of a sequence of characters except for the device and special files.

The information which is needed in the filesystem to handle the files is included in a data structure which is called inode. The inode is used to identify a file. A few attributes must be provided to handle the kernel and filesystem functions. To name a few the attributes are file type, device id, user id of file owner, access rights and file mode, etc. There are many commands which are provided by UNIX which help in working with files. A few of these commands are listed below.

This type of access is called raw device access. This type of access is called block device access. For disk devices though, raw access means reading or writing in whole chunks of data — blocks, which are native to your disk. Pipes — UNIX allows you to link commands together using a pipe. The pipe acts a temporary file which only exists to hold data from one command until it is read by another.

A Unix pipe provides a one-way flow of data. The output or result of the first command sequence is used as the input to the second command sequence. To make a pipe, put a vertical bar on the command line between two commands. Skip to content. Change Language. Related Articles. Table of Contents. Improve Article. Save Article. Like Article. Next The Linux Kernel.



0コメント

  • 1000 / 1000