|
FALL 2000 Lecture Notes 3: File Management FILE MANAGER RESPONSIBILITIES
As well, the File Manager often determines who will have access to what material. Access should be as flexible as possible without compromising security. Some basic definitions: Field: a group of related bytes identified by the user with a name, type and size. Record: a group of related fields. File: a group of related records that contain information to be used by specific application programs. Often called a "flat" file because it has no connection to other files. Database: groups of related files that are Interconnected to give flexibility of access. File Manager must be able to support it. Although program files contain instructions and data files contain data, File Manager treats them the same way. Directories are listings of file names and their attributes. Treated in the same way as files. INTERACTING WITH THE FILE MANAGER Can interact directly or from inside a program. Eg READ, WRITE, OPEN, CLOSE, APPEND from a program CREATE, DELETE, RENAME, COPY etc would be direct. The action of saving a file from an application results in its creation. OPEN FOR WRITE command usually results in creation of file. These commands must be designed to be as simple as possible and devoid of any instructions required to run the device where the file may be stored i.e. device independent. User needs to know nothing about how the file is stored. VOLUME CONFIGURATION Volume: a storage unit, whether removable or not. Volume can contain many files and large files may span many volumes. First part of volume always reserved for volume descriptor, which contains:
Master File Directory is stored immediately after volume description and lists names and characteristics of every file contained in the volume. Can contain program files, data file, system files, and subdirectories. Older operating systems support only a single directory. Many problems:
Subdirectories often used to handle multi-user situation. Subdirectory a file that contains records that contain same information as Master File Directory. Users (or subdirectories) are allowed to have sub-directories. Regardless of the complexity of directory system, each directory entry typically may contain:
FILE NAMING CONVENTIONS Files have relative file names and absolute file names. Often have an extension. Relative file name: Selected by the user when file is created. Every operating system has specific rules that affect the length and allowable characters of the relative file name. Users should try to choose appropriate names. Some extensions may be recognised by operating system eg .exe or .cob. Be careful! Absolute file names: This is the complete name, which may include the path to the file in the directory system, the particular disk drive, the node in the network that holds the user and even a version number if the file has had multiple revisions. User rarely uses absolute file name because File Manager often sets a starting directory when user logs onto system and from then on files are presumed to be in current or working directory. FILE ORGANISATION Record format can be:
Physical file organisation can be:
DOS FILE MANAGER Supports sequential, direct and indexed sequential files. Can have either variable or fixed length records for sequential files. However, fixed length for direct and indexed sequential. File name rules:
Version 2.0 and up permits subdirectories. Formatting lays down sectors of 512 bytes each. Sectors are grouped into clusters or allocation units. The number of sectors per cluster depends on the particular storage device. Formatting also creates the boot sector, the root directory and the FAT (file allocation table). Boot sector is designed to start DOS if it is a bootable disk (otherwise give error "Non-system disk"). Identifies version of DOS that disk was formatted with, identifies size of FAT. In the root directory is stored:
Sample directory listing Volume in drive C is A; Volume Serial Number is 14F6-7366 Directory of C:\
The number of entries is root directory is fixed, but unlimited in sub-directories. File attributes
FAT indicates status of all clusters on the disk – which have been allocated, which are free and which can’t be allocated. Following starting cluster from directory listing, all successive clusters are located by following a chain. Last entry in the chain is FF hex. Which indicated end of file. A file’s sectors do not have to be contiguous. However, fragmentation may ensue.
|