Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 File Management Chapter 12. 2 File Management n File management system consists of system utility programs that run as privileged applications n Concerned.

Similar presentations


Presentation on theme: "1 File Management Chapter 12. 2 File Management n File management system consists of system utility programs that run as privileged applications n Concerned."— Presentation transcript:

1 1 File Management Chapter 12

2 2 File Management n File management system consists of system utility programs that run as privileged applications n Concerned with secondary storage

3 3 File System Properties n Long-term storage n Sharable between processes n Structure n Operations: u Delete u Open u Close u Read u Write u Create

4 4 Terms Used with Files n Field u basic element of data u contains a single value u characterized by its length and data type n Record u collection of related fields u treated as a unit F Example: employee record

5 5 Terms Used with Files n File u collection of similar records u treated as a single entity u have unique file names u may restrict access n Database u collection of related data u relationships exist among elements

6 6 File Management System n The way a user of application may access files n Programmer does not need to develop file management software

7 7 Objectives for a File Management System n Meet the data management needs and requirements of the user n Guarantee that the data in the file are valid n Optimize performance n Provide I/O support for a variety of storage device types

8 8 Objectives for a File Management System n Minimize or eliminate the potential for lost or destroyed data n Provide a standardized set of I/O interface routines n Provide I/O support for multiple users

9 9 File System Software Architecture Pile Sequential Indexed Sequential Indexed Hashed Logical I/O Basic I/O Supervisor Basic File System Disk Device Driver Tape Device Driver User Program

10 10 Device Drivers n Lowest level n Communicates directly with peripheral devices n Responsible for starting I/O operations on a device n Processes the completion of an I/O request

11 11 Basic File System n Physical I/O n Deals with exchanging blocks of data n Concerned with the placement of blocks n Concerned with buffering blocks in main memory

12 12 Basic I/O Supervisor n Responsible for file I/O initiation and termination n Control structures are maintained n Concerned with scheduling access to optimize performance n Part of the operating system

13 13 Logical I/O n Allows users and applications to access records n Provides general-purpose record I/O capability n Maintains basic data about file

14 14 Access Method n Reflect different file structures n Different ways to access and process data

15 15 Elements of File Management

16 16 Functions of File Management n Identify and locate a selected file n Use a directory to describe the location of all files plus their attributes n On a shared system describe user access control n Blocking for access to files n Allocate files to free blocks n Manage free storage for available blocks

17 17 File Directories n Contains information about files u attributes u location u ownership n Directory itself is a file owned by the operating system n Provides mapping between file names and the files themselves

18 18 Simple Structure for a Directory n List of entries, one for each file n Sequential file with the name of the file serving as the key n Provides no help in organizing the files n Forces user to be careful not to use the same name for two different files

19 19 Two-level Scheme for a Directory n One directory for each user and a master directory n Master directory contains entry for each user u provides address and access control information n Each user directory is a simple list of files for that user n Still provides no help in structuring collections of files

20 20 Hierarchical, or Tree-Structured Directory n Master directory with user directories underneath it n Each user directory may have subdirectories and files as entries

21 Master Directory System User A User B User C Directory “User B’ Directory “User A’ Directory “User C” Draw Word Directory “Word” Unit A Directory “Draw” ABC Directory “Unit A” ABC File “ABC” File “ABC” Pathname: /User B/Word/Unit A/ABC

22 22 Hierarchical, or Tree-Structured Directory n Files can be located by following a path from the root, or master, directory down various branches u this is the pathname for the file n Can have several files with the same file name as long as they have unique path names

23 23 Hierarchical, or Tree-Structured Directory n Current directory is the working directory n Files are referenced relative to the working directory

24 24 File Sharing n Way to control access to a particular file n Users or groups of users are granted certain access rights to a file

25 25 Access Rights n None u user may not know of the existence of the file u user is not allowed to read the user directory that includes the file n Knowledge u user can only determine that the file exists and who its owner is

26 26 Access Rights n Execution u the user can load and execute a program but cannot copy it n Reading u the user can read the file for any purpose, including copying and execution n Appending u the user can add data to the file but cannot modify or delete any of the file’s contents

27 27 Access Rights n Updating u the user can modify, deleted, and add to the file’s data. This includes creating the file, rewriting it, and removing all or part of the data u Changing protection u user can change access rights granted to other users n Deletion u user can delete the file

28 28 Access Rights n Owners u has all rights previously listed u may grant rights to others using the following classes of users F specific user F user groups F all for public files

29 29 Simultaneous Access n User may lock entire file when it is to be updated n User may lock the individual records during the update n Mutual exclusion and deadlock are issues for shared access

30 30 Record Blocking Methods - Fixed Blocking

31 31 Variable Blocking: Spanned

32 32 Variable Blocking: Unspanned

33 33 Secondary Storage Management n Space must be allocated to files n Must keep track of the space available for allocation n Space is allocated as one or more contiguous units or portions

34 34 Preallocation n Need the maximum size for the file at the time of creation n Difficult to reliably estimate the maximum potential size of the file n Tend to overestimated file size so as not to run out of space

35 35 Portion Size n Contiguity of space increases performance u Lower seek time u May not have portions that are large enough n Large number of small portions increases the size of tables needed u Better usage of space u Higher seek time n Fixed-size simplifies the reallocation of space n Variable-size minimizes waste of unused storage

36 36 Methods of File Allocation – Continuous Allocation n Contiguous allocation u single set of blocks is allocated to a file at the time of creation F Idea is similar to arrays u only a single entry in the file allocation table F starting block and length of the file n Lower seek time n Fragmentation will occur n Difficult to find contiguous blocks of sufficient length n Compaction is needed

37 Contiguous File Allocation 01234 56789 1011121314 1516171819 2021222324 2526272829 3031323334 File Allocation Table (FAT) File NameStart BlockLength FileA FileB FileC FileD FileE 23 95 188 302 263 FileA FileB FileC FileE FileD

38 38 Methods of File Allocation – Chained Allocation n Chained allocation u allocation on basis of individual block u each block contains a pointer to the next block in the chain F Idea is similar to linked lists u only single entry in the file allocation table F starting block and length of file n No fragmentation n Flexible in allocation: Any free block can be added to the chain n No accommodation of the principle of locality u Access time can be high

39 Chained File Allocation 01234 56789 1011121314 1516171819 2021222324 2526272829 3031323334 File Allocation Table (FAT) File NameStart BlockLength... FileB5... 1 FileB

40 40 Methods of File Allocation – Indexed Allocation n Indexed allocation u file allocation table (FAT) contains a separate one- level index for each file u the index has one entry for each portion allocated to the file u the file allocation table contains block number for the index n Better compromise of performance and space

41 Indexed Allocation with Block Portions 01234 56789 1011121314 1516171819 2021222324 2526272829 3031323334 File Allocation Table File NameIndex Block... FileB24 FileB 1 8 3 14 28

42 Indexed Allocation – Variable Length Portions 01234 56789 1011121314 1516171819 2021222324 2526272829 3031323334 File Allocation Table File NameIndex Block... FileC24 Start BlockLength 1 28 14 3 4 1 FileB


Download ppt "1 File Management Chapter 12. 2 File Management n File management system consists of system utility programs that run as privileged applications n Concerned."

Similar presentations


Ads by Google