Everything is a file

Everything is a file (English for everything is a file ) describes one of the defining features of Unix and its derivatives, that a wide range of Ein-/Ausgabe-Ressourcen such as documents, folders, disks, modems, keyboards, printers and even inter-process and network connections are available as a simple byte streams via the file system.

The advantage of this approach is that the same tools and programming interface to access all of these resources can be used. When a file is opened, the program receives from the kernel a file descriptor. For all subsequent operations of this serves as Ein-/Ausgabe-Schnittstelle. As for anonymous pipes and network sockets file descriptors are created, but have no path, the principle frequently is also Everything is a file descriptor (' Everything is a file descriptor ') or, according to Linus Torvalds, Everything is a stream of bytes (, Everything is called a byte stream ').

In addition there are a number of virtual file systems and pseudo file systems to make information about the system state and processes hierarchically structured available.

The term is consistently used as a slogan for the otherness of Unix-like systems in dealing with files. He is not sharply defined and aims, as indicated above, depending on use of different aspects. While the above features are also now found only in unix -like operating systems and are widely connected to Everything is a file, even innovations are assumed to Unix, which are now ubiquitous. The following sections describe the aspects in detail.

Directory structure as a namespace

The directory structure is a unified, hierarchically structured name space across which a file is given a path, under whose name it is available. A directory is a special file that lists all the directory entries contained. These may be both files and directories again. This location resulting directory hierarchy can span multiple devices. In this form, the file system was already in Multics, a precursor of Unix included. Such directory structures are now widely used, albeit with some variations. For example, they are not uniform in MS -DOS and Windows: Paths also contain a device-specific drive letter.

The namespace is also used by named pipes and serves as the basis for the widespread System V IPC interface, act in the existing files as a sort of meeting point of two processes. POSIX analogue POSIX IPC name, not based on files.

Secondary storage and files

Another interpretation of the principle, which is no longer used today, refers to the innovation that files exist on UNIX from a simple sequence of bytes and beyond, subject to any restrictions in their format (as opposed to then widespread record - oriented file systems ). The aim was to flatten the device specifications to abstract from the memory organization, and to leave as many decisions userspace:

" [ ... ] The UNIX kernel does not support file access methods, file disposition, file formats, file maximum size, spooling, command language, logical records, physical records, assignment of logical file names, logical file names, more than one character set at operator 's console, to operator, log -in or log-out. Many of thesis things are symptoms rather than features. Many of thesis things are Implemented in user software using the kernel as a tool. "

This understanding of files is now self-evident and can be found in most mainstream operating systems.

Devices

The idea to make devices available about files, comes by its own account by Dennis Ritchie.

321948
de