A File in a Computer is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished. Computer files can be considered as the modern counterpart of paper documents which traditionally are kept in offices' and libraries' files, and this is the source of the term.
File have the following contents,
- File Size : At any instant in time, a file might have a size, normally expressed as number of bytes, that indicates how much storage is associated with the file. In most modern operating systems the size can be any non-negative whole number of bytes up to a system limit. However, the general definition of a file does not require that its instant size has any real meaning, unless the data within the file happens to correspond to data within a pool of persistent storage. A special case is a zero byte file; these files are either an accident (a result of an aborted disk operation) or serve as some kind of flag in the file system.
For example, the file to which the link /bin/ls points in a typical Unix-like system probably has a defined size that seldom changed. Compare this with /dev/null which is also a file, but its size may be obscure.
Organizing the data in a file : Information in a computer file can consist of smaller packets of information (often called "records" or "lines") that are individually different but share some trait in common. For example, a payroll file might contain information concerning all the employees in a company and their payroll details; each record in the payroll file concerns just one employee, and all the records have the common trait of being related to payroll—this is very similar to placing all payroll information into a specific filing cabinet in an office that does not have a computer. A text file may contain lines of text, corresponding to printed lines on a piece of paper. Alternatively, a file may contain an arbitrary binary image (a BLOB) or it may contain an executable. The way information is grouped into a file is entirely up to how it is designed. Most computer files are used by computer programs which create, modify or delete the files for their own use on an as-needed basis. The programmers who create the programs decide what files are needed, how they are to be used and (often) their names.In some cases, computer programs manipulate files that are made visible to the computer user. For example, in a word-processing program, the user manipulates document files that the user personally names. Although the content of the document file is arranged in a format that the word-processing program understands, but the user is able to choose the name and location of the file and provide the bulk of the information (such as words and text) that will be stored in the file.
File operations : At the most basic level there are only two types of file operations; read and write. For example: adding text to a document involves; opening the file (read), inputting the text and saving the file (write) Files on a computer can be created, moved, modified, grown, shrunk and deleted. In most cases, computer programs that are executed on the computer handle these operations, but the user of a computer can also manipulate files if necessary. For instance, Microsoft Word files are normally created and modified by the Microsoft Word program in response to user commands, but the user can also move, rename, or delete these files directly by using a file manager program such as Windows Explorer (on Windows computers).In Unix-like systems, user-space processes do not normally deal with files at all; the operating system provides a level of abstraction which means that almost all interaction with files from user-space is through hard links. Hard links allow a name to be associated with a file (or they can be anonymous - and therefore temporary); files do not have names in the OS. For example, a user-space program cannot delete a file; it can delete a link to a file (for example, using the shellrm or mv or, in the anonymous case, simply by exiting), and if the kernel determines that there are no more existing hard links to the file (symbolic links will simply fail to resolve), it may then allow the memory location for the deleted file to be allocated for another file. Because Unix-like systems only delete the pointer to the file the data remains intact on disk, this creates what is know as free space, which is commonly considered a security risk due to the existence of file recovery software. Such a risk has given rise to the secure deletion programs such as srm. In fact, it really is only the kernel that deals with files, but it serves to handle all user-space interaction with (virtual) files in a manner that is transparent to the user-space programs commands
Post a Comment