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 status of a data file that is being created or manipulated in a different way. other way. 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 on certain operating systems, but it has since become a more generic term for the structure used to track information about an actively managed file.
A file control block stores basic information about a computer program being used.
An important purpose of a file control block is to help the file system track the state of the file to prevent different operations from trying to modify the file in conflicting ways, such as reading an area of the file being written to. The structure is not only used for data files, it can also be used to track information about directories, although the data structure is often shortened to remove unnecessary fields because a directory cannot contain data.
Two operating systems, specifically Microsoft® Disk Operating System (MS-DOS) and Control Program for Microprocessors (CP/M), were the first operating systems to use a block scheme to manage files. These systems used very similar structures to help manage the files being accessed. As other operating systems and file systems were developed, the block concept remained, but the implementation changed and the data structure varied greatly from one system to another. Most computer operating systems in use in 2011 use some form of file control block, especially when using custom file systems for removable hardware, although the data structure that is employed is not backward compatible without emulation and generally be larger and hidden from most high-end programming applications.
In general terms, a file control block contains information that can change during the operating system’s use of a file. In addition to the name and location, memory pointers to different points within the file itself are kept. This allows sequential read and write as well as random access read and write when paired with a variable on the FCB that stores the size of a random access record. File permissions such as read-only or executable status are also tracked. 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 append information to the end of a file while that same file is being copied to another location.