Presentation is loading. Please wait.

Presentation is loading. Please wait.

File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are.

Similar presentations


Presentation on theme: "File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are."— Presentation transcript:

1 File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are allocated to store the files contents. The way that this allocation occurs, and the way physical blocks are organized can have an impact on the speed and efficiency of file operations.

2 Simple contiguous Organization FREE File 1 File 3 File 2 File Descriptors In this method, space is allocated to a file as a series of contiguous physical blocks. The beginning address of the first block is recorded as part of the file’s file descriptor, in the directory. This makes directory contents small and simple Random access is efficient A file can only grow in size if adjacent free blocks are free

3 Simple Contiguous with Extents In this organization, a file receives an initial allocation as a series of adjacent blocks. When the file grows beyond its initial allocation, additional adjacent blocks are allocated (possibly in a different area on the disk) and their location recorded as a separate entry in the directory.

4 File 1 File 2 (2) File 1 (2) File 2 File 3 The size of individual extents is a multiple of the physical block size, and do not have to be physically adjacent to the space already allocated to the file. Extents can also be used when the file is first created. If sufficient space is not available when the file is created, a series of extents can be allocated to store the file.

5 Blocked Organizations These are alternatives to algorithms that require allocation of contiguous blocks. In this organization storage space is allocate in discrete blocks, which are equal to or a multiple of the sector size. The system keeps track of blocks that are free, and those that have been allocated to individual size. When space is needed for a file, a series of blocks are allocated, they need not be adjacent, and their association with the file, and each is recorded. With these algorithms, fragmentation is NOT a problem

6 Blocked Chained Organizations Free Pointer File1 File2

7 Blocked Indexed Organizations In File Descriptor

8 Dos FAT DOS uses a variation of the blocked chained organization. In Dos space is allocated in clusters (2- 512K sectors) Each cluster is numbered sequentially starting at zero. The file allocation table (FAT table) contains an entry for each cluster on the disk, and contains information about which files are linked together.

9 File Name First Cluster IO.SYS8 MSDOS.SYS11 MYFILE20 ClusterPointer 0-7system 89 910 … 2021 24 … FF

10 NTFS - Windows file system Also allocates disk space in clusters (each is one or more sectors). It uses logical cluster Numbers as disk addresses, multiplying the logical cluster # by the cluster size yields a physical disk address. The master file table (which is essentially the volume’s master directory) consists of an array of variable length records. First 16 describe the file table itself. Subsequent records provide access to each file or directory on the volume.

11 Standard Information File or directory name Security descriptor Data or index to data ………. A files attributes are recorded in the MFT as an independent byte string that can be created, read, written, and deleted. Small files that are less than 1200 bytes are written directly into the MFT record. For larger files the MFT entry contains index pointers to the clusters that hold the actual data A directory is a file of indexes to other files within the directory.

12 Directory Structure Like files, file descriptors must be stored and organized in some manner.. usually file descriptors are gathered into directories. For a given OS, the directory is always stored at the same location on every disk, so the file system can always find it. When a file is first created or a program is first installed, its name and physical location are recorded in the directory by the file system. To retrieve a program or file, the file system reads the directory, and searches it for the file/program and extracts its starting disk address. When a file/program is deleted, the file system removes its entry from the directory

13 Directories as files A directory is a collection of information, and in many ways can be considered a type of file. Usually directories are assigned a contiguous storage area of fixed size, even if the remaining file area uses a more flexible allocation method. Directories may or may not be expandable by use of extents or similar techniques. –If not expandable, the selection of size is very critical, if too large space will be wasted; if too small the directory may become full, even though space remains in the file area. –File systems that support multiple directories are more likely to treat directories by the same techniques used for files, and provide opportunities for directory space to be allocated as required.

14 Single Directory Simple directory format used on simple single user OS a single large directory is allocated for each volume contains the file descriptor for EVERY FILE on the volume Directory management is simple.. only one directory to manage. But the seek time for an individual file increases because of the potentially large # of files.

15 User directories Expansion of the simple single directory. If multiple users store files on the same volume, we may need to control how one user can access another’s files.In general, we do not want one user to read or write files belonging to another. A user should not be able to see files belonging to other users, when they do a directory listing. A solution is to create a single root directory for the volume, and then a private, directory for each user. When users access the OS they are positioned correctly into their default “home” directory. A user will store every file he/she creates in this “home directory”.

16 Hierarchical Directories An extension of the concept of a private user directory is the concept of a hierarchical directory structure. In a hierarchical structure, users may dynamically create new directories with in their private user directory This allows them to group together logically related files. The structure creates a tree like organization, where each directory may contain file descriptors, and descriptions of other directories. The starting point or “root” of the structure is a single main directory. A file is located or identified by concatenating the names of all directories that contain it and the file’s name. /home/Hayhurst/test1.doc

17 Root / Home HayhurstJonesGraff test1 /home/hayhurst/test1 CS450 Exam1 CS450/Exam1


Download ppt "File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are."

Similar presentations


Ads by Google