next up previous
Next: Networking Up: Comparison between Original Previous: Deadlock Handling

File System

  The main characteristic of the definition of a file is that it is an array of bytes, that is, no particular structure (e.g. length of a line) is not assumed by the system. The format of file structure is determined by the programs that use the file. The allocation strategy of files is the indexed allocation. The index block of 64 bytes is called i-node. It uses variable multiple-level indexing as follows. An i-node contains 13 disk addresses. The first 10 addresses point the disk blocks store the file contents. For a file larger than 10 blocksgif (one block is 512 bytes, hence 5120 bytes in total), the 11th block points the block that contains the addresses of the next 128 blocks (70656 bytes). The 12th block points to at up to 128 blocks, each pointing to 128 blocks of the file. Files yet larger (8,459,264 bytes) use the 13th address for ``triple indirect'' address [2]. The maximum size allowed in this strategy is 1,082,201,0871 bytes.

Except for block allocation information, an i-node contains the following informations of a file: owner, protection bits, physical disk or tape on which the file exists, size, the time last modified, the number of links, whether an ordinary file or a directory, whether an ordinary file or a special file (I/O device, mentioned below), whether large or small (i. e. information of level of indirect indexing). A link is the connection between the name and the entity of a file. By multiple links to a file, the file can have multiple (path) names. Deleting such a file means just reducing the number of links in the i-node. However if the number reduces to 0, the file effectively does not exist and the disk blocks occupied by the file will be used by another file. A remarkable point in the original Unix is that the length of a file name is limited to 14 characters. According to the stdio.h file of SunOS 5.2, each element of the path name can be up to 256 characters and 1024 characters in total.

Accessing an I/O is easy in Unix as it is just like accessing a file. We can use the same system calls for the file manipulation such as open, read, write. Also the name and syntax, and meaning of protection bits of an I/O device is the same as a file. This feature is supported in Unix by the special file associated with each I/O device. The special files for all I/O devices reside in the directory /dev and are protected from indiscriminate access. The idea of ``unique access method'' is inherited to later versions of Unix. For example as we have seen in the section 1.2, socket is accessed by the same method as files.

The mounted file system is another feature that was introduced in the original Unix. The hierarchy of the file system can distribute among several disk devices (however root of the file system is fixed to a device). The mount system call takes two argument, an ordinary file name as a leaf of the hierarchy tree, and the device name. Accesses to the file name are converted to the accesses to the root of the mounted disk. The files on the root device and mounted devices are treated identically with on exception; cross-device link is prohibited. Otherwise we have to remove all the links to the files on the unmounted disks. The idea of mounted file system is extended to NFS (Network File System) in the later version of Unix (including Solaris 2 ) and will be mentioned in the next section. Blocked I/O devices (e. g. disks) are buffered (cached) and buffers are replaced by LRU algorithm in the original Unix.

In Unix, physical disks are divided into smaller pieces. These pieces are called partition (pre-SVR4) and slices (SVR4). Although this has not been confirmed, Solaris 2 is expected to have the same feature as SVR4. Both pre-SVR4 and SVR4 have up to 8 partitions (slices). Unlike pre-SVR4, SVR4 specifies the use of each slice: Slice 0, 1, 2, are used for system's root file system, swap, and whole disk, respectively. Slices 3 to 6 are used for other operating system files. Only slice 7 can hold user files.



next up previous
Next: Networking Up: Comparison between Original Previous: Deadlock Handling



Hitoshi Oi
Wed Dec 20 23:53:45 EST 1995