A file control block (FCB) is a data structure used by an operating system to maintain the state of a data file. It contains information about the file, including its name, location, and dynamic information such as the current address within the file being read. The FCB helps prevent conflicting operations on the file and can be used for directories as well. Different operating systems use different implementations of the FCB, but it generally contains information that can change while the operating system is using a file, including memory pointers and file permissions.
A file control block (FCB), also called a file descriptor, is a type of data structure that is temporarily allocated by a computer operating system to maintain the state of a data file that is being created or otherwise manipulated. In most cases, a file control block is used to store basic information about a file, such as its name, extension, and location on a logical drive, as well as dynamic information such as the current address within the file being read . Originally, a file control block was a very well-defined structure in certain operating systems, but it has since become a more generic term for the structure used to track information about an actively maintained file.
An important purpose of a file control block is to help the file system keep track of the state the file is in to prevent different operations from trying to modify the file in conflicting ways, such as reading from an area of the file that is currently being written to. The structure is not only used for data files, but can also be used to track information about directories, although the data structure is usually shortened to remove unnecessary fields, since a directory cannot contain any data.
Two operating systems, namely Microsoft® Disk Operating System (MS-DOS) and Control Program for Microprocessors (CP/M), were the first operating systems to use a block diagram to manage files. These systems used very similar structures to help manage the files that were being accessed. As other operating systems and file systems developed, the block concept remained, but the implementation changed and the data structure varied greatly from system to system. Most computer operating systems in use as of 2011 use some form of file control locking, especially when using custom file systems for removable hardware, although the data structure used is not backwards compatible without emulation and is generally larger and hidden from most high-level programming applications.
In general, a file control block contains information that can change while the operating system is using a file. Aside from the name and location, memory pointers to different places within the file itself are kept. This allows for sequential reading and writing, as well as random access reading and writing when paired with a variable in the FCB that stores the size of a random access record. File permissions, such as read-only or executable status, are also monitored. Using an FCB also provides a mechanism to prevent two or more processes from operating on the same file in unpredictable ways, such as trying to add information to the end of a file while the same file is being copied to another location.
Protect your devices with Threat Protection by NordVPN