file" -- Definition" "

The way to access bits

The term file is used throughout the world of computing. Because there are several distinct types of COHERENT ``files,'' understanding what COHERENT means by a ``file'' can help you grasp how COHERENT works.

A file is a mass of bits that is given a name and is stored on some physical medium (e.g., floppy disk, hard disk, RAM disk, or CD-ROM). These bits may represent data (e.g., ASCII or EBCDIC characters) or machine-executable instructions. COHERENT defines a number of different types of files. A file's type defines its behavior. Some common file types include the following:

rreegguullaarr
This file points to a location on a disk, which can be read or written. The location pointed to can contain data (e.g., text) or executable instructions in the form of shell commands or binary instructions. Regular files are sometimes called ordinary files.

ddiirreeccttoorryy
A directory holds the names and addresses of other files, including other directories.

ssppeecciiaall
Special files designate COHERENT devices. A device can represent a physical device, such as a floppy disk drive, a printer port, or a serial port. It can also represent a part of a physical device, such as a RAM disk (representing part of memory) or one partition of a hard disk. It can also represent a logical device that has no physical counterpart, like the bit bucket /dev/null. Special files come in two flavors: _c_h_a_r_a_c_t_e_r _s_p_e_c_i_a_l and _b_l_o_c_k _s_p_e_c_i_a_l. The former access data in streams (that is, one character at a time), and so access devices like tape drives and serial ports. The latter access one block at a time, and so access disk drives and other devices that return their data in block-sized chunks. (COHERENT defines a block as being 512 characters.)

FFIIFFOO
This is a variety of regular file that contains semantics to hook together two processes, just like a pipe `|' in the COHERENT shell. See the Lexicon article nnaammeedd ppiippee for details on this variety of file.

pprroocceessss
This kind of file corresponds one-to-one with the existence of a process on a system. It tends to be short- lived.

Files live with a _f_i_l_e _s_y_s_t_e_m, which organizes the files hierarchically within directories. The Lexicon entry for the command mmkkffss gives some technical information on how a file system is constructed. The Lexicon entry for the command mmoouunntt gives some information on how a file system relates to device on which it lives, and how different file systems from different partitions are hooked together to form one large file system for the entire computer.

The same file can have (and be accessed by) more than one name. The Lexicon entry for the command llnn shows how you can link additional names to a file. The entry for the system call uunnlliinnkk(()) gives some details on the relationship between a file and its names.

Finally, a file has _p_e_r_m_i_s_s_i_o_n_s associated with it. Every file is owned by someone; and the owner can restrict access to the file if she wishes. The Lexicon entry for the command llss describes what permissions are available for a file. The entry for the command cchhmmoodd shows how you can change permissions on a file. The entry for the command uummaasskk shows how you can change the permissions that COHERENT gives by default to any files that you create.

See Also