Presentation is loading. Please wait.

Presentation is loading. Please wait.

Files An operating system, maintains descriptive information about files in a data structure called a file descriptor. NameDeletion control Storage Organization.

Similar presentations


Presentation on theme: "Files An operating system, maintains descriptive information about files in a data structure called a file descriptor. NameDeletion control Storage Organization."— Presentation transcript:

1 Files An operating system, maintains descriptive information about files in a data structure called a file descriptor. NameDeletion control Storage Organization Visibility Control IdentifierVersion Number OwnerFile History TypeCurrent Use SizeLocation Access Restrictions Record Organization Access type Extension Control

2 Internal Structure of Files Unstructured series of bytes

3 Fixed length records Record 1Record 2Record 3Record 4 Physical Record, The number of logical records that can be stored in a single physical record is dependant upon the logical record length. If the physical block size is 512k, and each record is 132 bytes then the number of records that can be stored per physical block is: 512000 / 132 = 3878 with 104 bytes left over

4 Variable length records 3R135R2 End of data Where is a files data stored within the physical blocks allocated to it?

5 File Operations File operations are supported using two internal data structures –Buffers –File control blocks

6 Creating a file –The file is created with no data –An entry is recorded in the main directory Deleting a file Open Close Writing a file

7 Reading a file Repositioning within a file (seek) Truncating a file Append Rename

8 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.

9 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 (on disk) 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

10 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.

11 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.

12 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 other is recorded. With these algorithms, fragmentation is NOT a problem

13 Blocked Chained Organizations Free Pointer File1 File2

14 Blocked Indexed Organizations In File Descriptor


Download ppt "Files An operating system, maintains descriptive information about files in a data structure called a file descriptor. NameDeletion control Storage Organization."

Similar presentations


Ads by Google