patternMinor
What is a file?
Viewed 0 times
filewhatstackoverflow
Problem
I'm looking for a formal definition of file that does not only include storage but also abstractions like procfs or /dev/null (or any fuse-based file) that do not relate to storage.
So far I know that all files are abstractions that
however I was unable to find any useful formal definition in any OS book I've read so far.
So far I know that all files are abstractions that
- can be identified
- can have names (usually organized in hierarchical structures)
- can be accessed as a byte stream
- usually provide permissions and other (system specific) metadata
however I was unable to find any useful formal definition in any OS book I've read so far.
Solution
According to Wikipedia, a computer file is simply a resource for storing information. The term appears to have originated in the punch card era, where a computer program was literally stored in a file (as in, a box used to store loose pages, see image below). As other forms of media were introduced, such as disks, the nomenclature followed.
From a *nix point of view, everything is a file: sockets, devices, terminals, screens/monitors, data files, pipes, and so on. Microsoft Windows, in contrast, tends to call permanent storage data "files", and volatile resources as whatever they are, such as named pipes, sockets, raster devices, etc. Other systems may have similar definitions somewhere between these two extremes.
Unfortunately, as I've just stated, there's no single definition of what a file is, because it is different things to different people, except that everyone tends to agree on the base-line definition that a file is a named resource that stores data on permanent media (permanent does not imply that it can never be modified, simply that it persists through power cycles).
(Wikipedia)
From a *nix point of view, everything is a file: sockets, devices, terminals, screens/monitors, data files, pipes, and so on. Microsoft Windows, in contrast, tends to call permanent storage data "files", and volatile resources as whatever they are, such as named pipes, sockets, raster devices, etc. Other systems may have similar definitions somewhere between these two extremes.
Unfortunately, as I've just stated, there's no single definition of what a file is, because it is different things to different people, except that everyone tends to agree on the base-line definition that a file is a named resource that stores data on permanent media (permanent does not imply that it can never be modified, simply that it persists through power cycles).
(Wikipedia)
Context
StackExchange Computer Science Q#67696, answer score: 6
Revisions (0)
No revisions yet.