- A major function of the OS is to hide the peculiarities of the disks and other I/O devices and present the user/programmer with a nice, clean abstract model of device-independent files.
- To provide a place to keep files, most OS have the concept of a directory as a way of grouping files together.
- Every file within the directory hierarchy can be specified by giving its path name from the top of the directory hierarchy, the root directory.
- Absolute path
- Relative path
- Before a file can be read or written, it must be opened, at which time the permissions are checked. If the access is permitted, the system returns a small integer called a file descriptor to use a subsequent operations.
- File management is one of the most visible components of an OS. Computers can store information on several different types of physical media.
- Each medium is controlled by a device, such as a disk drive or tape drive, that also has its own unique characteristics. These properties include access speed, capacity, data-transfer rate, and access method (sequential or random).
- A file is a collection of related information defined by its creator. Commonly, files represent programs and data.
- Another important concept in UNIX is the special file. Special files are provided in order to make I/O devices look like files. That way, they can be read and written using the same system calls as are used for reading and writing files.
- Block special files are used to model devices that consist of a collection of randomly addressable blocks, such as disks.
- Character special files are used to model printers, modems, and other devices that accept or output character stream.
- /dev is the directory. /dev/lp might be the printer (once called the line printer).
- The OS is responsible for the following activities in connection with file management:
- Creating and deleting files,
- Creating and deleting directories to organize files,
- Supporting primitives for manipulating files and directories,
- Mapping files onto secondary storage,
- Backing up files on stable (nonvolatile) storage media.
Cem Ozdogan
2011-02-14