file management
DESCRIPTION
File Management. Chapter 12. File Management. File management system consists of system utility programs that run as privileged applications Concerned with secondary storage. File System Properties. Long-term storage Sharable between processes Structure Operations: Delete Open Close - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/1.jpg)
1
File Management
Chapter 12
![Page 2: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/2.jpg)
2
File Management
File management system consists of system utility programs that run as privileged applications
Concerned with secondary storage
![Page 3: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/3.jpg)
3
File System Properties
Long-term storage Sharable between processes Structure Operations:
Delete Open Close Read Write Create
![Page 4: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/4.jpg)
4
Terms Used with Files
Field basic element of data contains a single value characterized by its length and data type
Record collection of related fields treated as a unit
Example: employee record
![Page 5: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/5.jpg)
5
Terms Used with Files
File collection of similar records treated as a single entity have unique file names may restrict access
Database collection of related data relationships exist among elements
![Page 6: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/6.jpg)
6
File Management System
The way a user of application may access files
Programmer does not need to develop file management software
![Page 7: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/7.jpg)
7
Objectives for a File Management System
Meet the data management needs and requirements of the user
Guarantee that the data in the file are valid Optimize performance Provide I/O support for a variety of storage
device types
![Page 8: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/8.jpg)
8
Objectives for a File Management System
Minimize or eliminate the potential for lost or destroyed data
Provide a standardized set of I/O interface routines
Provide I/O support for multiple users
![Page 9: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/9.jpg)
9
File System Software Architecture
Pile SequentialIndexed
Sequential Indexed Hashed
Logical I/O
Basic I/O Supervisor
Basic File System
Disk Device Driver Tape Device Driver
User Program
![Page 10: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/10.jpg)
10
Device Drivers
Lowest level Communicates directly with peripheral
devices Responsible for starting I/O operations on
a device Processes the completion of an I/O request
![Page 11: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/11.jpg)
11
Basic File System
Physical I/O Deals with exchanging blocks of data Concerned with the placement of blocks Concerned with buffering blocks in main
memory
![Page 12: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/12.jpg)
12
Basic I/O Supervisor
Responsible for file I/O initiation and termination
Control structures are maintained Concerned with scheduling access to
optimize performance Part of the operating system
![Page 13: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/13.jpg)
13
Logical I/O
Allows users and applications to access records
Provides general-purpose record I/O capability
Maintains basic data about file
![Page 14: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/14.jpg)
14
Access Method
Reflect different file structures Different ways to access and process data
![Page 15: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/15.jpg)
15
Elements of File Management
![Page 16: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/16.jpg)
16
Functions of File Management
Identify and locate a selected file Use a directory to describe the location of
all files plus their attributes On a shared system describe user access
control Blocking for access to files Allocate files to free blocks Manage free storage for available blocks
![Page 17: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/17.jpg)
17
File Directories
Contains information about files attributes location ownership
Directory itself is a file owned by the operating system
Provides mapping between file names and the files themselves
![Page 18: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/18.jpg)
18
Simple Structure for a Directory
List of entries, one for each file Sequential file with the name of the file
serving as the key Provides no help in organizing the files Forces user to be careful not to use the
same name for two different files
![Page 19: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/19.jpg)
19
Two-level Scheme for a Directory
One directory for each user and a master directory
Master directory contains entry for each user provides address and access control
information Each user directory is a simple list of files
for that user Still provides no help in structuring
collections of files
![Page 20: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/20.jpg)
20
Hierarchical, or Tree-Structured Directory Master directory with user directories
underneath it Each user directory may have
subdirectories and files as entries
![Page 21: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/21.jpg)
Master DirectorySystemUser AUser BUser C
Directory “User B’Directory“User A’
Directory“User C”
DrawWord
Directory “Word”
Unit A
Directory “Draw”
ABC
Directory “Unit A”
ABC
File“ABC”
File“ABC”
Pathname: /User B/Word/Unit A/ABC
![Page 22: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/22.jpg)
22
Hierarchical, or Tree-Structured Directory Files can be located by following a path
from the root, or master, directory down various branches this is the pathname for the file
Can have several files with the same file name as long as they have unique path names
![Page 23: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/23.jpg)
23
Hierarchical, or Tree-Structured Directory Current directory is the working directory Files are referenced relative to the working
directory
![Page 24: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/24.jpg)
24
File Sharing
Way to control access to a particular file Users or groups of users are granted
certain access rights to a file
![Page 25: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/25.jpg)
25
Access Rights
None user may not know of the existence of the file user is not allowed to read the user directory
that includes the file Knowledge
user can only determine that the file exists and who its owner is
![Page 26: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/26.jpg)
26
Access Rights
Execution the user can load and execute a program but
cannot copy it Reading
the user can read the file for any purpose, including copying and execution
Appending the user can add data to the file but cannot
modify or delete any of the file’s contents
![Page 27: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/27.jpg)
27
Access Rights
Updating 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
Changing protection user can change access rights granted to other
users Deletion
user can delete the file
![Page 28: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/28.jpg)
28
Access Rights
Owners has all rights previously listed may grant rights to others using the following
classes of users specific user user groups all for public files
![Page 29: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/29.jpg)
29
Simultaneous Access
User may lock entire file when it is to be updated
User may lock the individual records during the update
Mutual exclusion and deadlock are issues for shared access
![Page 30: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/30.jpg)
30
Record Blocking Methods - Fixed Blocking
![Page 31: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/31.jpg)
31
Variable Blocking: Spanned
![Page 32: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/32.jpg)
32
Variable Blocking: Unspanned
![Page 33: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/33.jpg)
33
Secondary Storage Management
Space must be allocated to files Must keep track of the space available for
allocation Space is allocated as one or more
contiguous units or portions
![Page 34: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/34.jpg)
34
Preallocation
Need the maximum size for the file at the time of creation
Difficult to reliably estimate the maximum potential size of the file
Tend to overestimated file size so as not to run out of space
![Page 35: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/35.jpg)
35
Portion Size Contiguity of space increases performance
Lower seek time May not have portions that are large enough
Large number of small portions increases the size of tables needed Better usage of space Higher seek time
Fixed-size simplifies the reallocation of space Variable-size minimizes waste of unused
storage
![Page 36: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/36.jpg)
36
Methods of File Allocation – Continuous Allocation
Contiguous allocation single set of blocks is allocated to a file at the time
of creation Idea is similar to arrays
only a single entry in the file allocation table starting block and length of the file
Lower seek time Fragmentation will occur Difficult to find contiguous blocks of sufficient
length Compaction is needed
![Page 37: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/37.jpg)
Contiguous File Allocation
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
25 26 27 28 29
30 31 32 33 34
File Allocation Table (FAT)
File Name Start Block Length
FileAFileBFileCFileDFileE
2 39 5
18 830 226 3
FileA
FileB
FileC
FileE
FileD
![Page 38: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/38.jpg)
38
Methods of File Allocation – Chained Allocation
Chained allocation allocation on basis of individual block each block contains a pointer to the next block in
the chain Idea is similar to linked lists
only single entry in the file allocation table starting block and length of file
No fragmentation Flexible in allocation: Any free block can be
added to the chain No accommodation of the principle of locality
Access time can be high
![Page 39: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/39.jpg)
Chained File Allocation
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
25 26 27 28 29
30 31 32 33 34
File Allocation Table (FAT)
File Name Start Block Length
... ... ...
......FileB 5
...1
FileB
![Page 40: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/40.jpg)
40
Methods of File Allocation – Indexed Allocation
Indexed allocation file allocation table (FAT) contains a separate one-
level index for each file the index has one entry for each portion
allocated to the file the file allocation table contains block number for
the index Better compromise of performance and space
![Page 41: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/41.jpg)
Indexed Allocation with Block Portions
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
25 26 27 28 29
30 31 32 33 34
File Allocation Table
File Name Index Block
...
...
...
...FileB 24
FileB
1831428
![Page 42: File Management](https://reader036.vdocuments.us/reader036/viewer/2022070501/56816924550346895de05b35/html5/thumbnails/42.jpg)
Indexed Allocation – Variable Length Portions
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
25 26 27 28 29
30 31 32 33 34
File Allocation Table
File Name Index Block
...
...
...
...FileC 24
Start Block Length
12814
341
FileB