Chapter Eight: File Management
Chapter Eight: File Management
Understanding Operati 1
ng Systems
The File Manager
Understanding Operati 3
ng Systems
Important Definitions
Understanding Operati 4
ng Systems
Definitions - 2
Understanding Operati 5
ng Systems
Interacting With File Manager
• Embedded commands:
– OPEN & CLOSE pertain to availability of file for
program invoking it.
– READ & WRITE are I/O commands.
– MODIFY – specialized WRITE command for existing
data files that allows for appending/rewriting records.
Understanding Operati 6
ng Systems
Interactive Commands
Understanding Operati 8
ng Systems
Typical Volume Configuration
Understanding Operati 10
ng Systems
Volume Descriptor
Creation Date Date when volume was created
Pointer to Directory Area Indicates first sector where directory
is stored
Pointer to File Area Indicates first sector where file is
stored
File System Code Used to detect volumes with incorrect
formats
Volume News User-allocated name
Understanding Operati 11
ng Systems
Some Major Disadvantages of Single
Directory Per Volume
1. Takes long time to search for an individual file, especially
if MFD was organized in an arbitrary order.
2. If user has many small files stored in volume, directory
space fills before disk storage space fills. User told “disk
full” when only directory full.
3. Users can’t create subdirectories to group related files.
4. Multiple users can’t safeguard files from other users
browsing file lists ‘cause entire directory listed on request.
5. Each program in entire directory needs unique name.
• E.g., Only 1 person using directory can name program
PROG1.
Understanding Operati 12
ng Systems
About Subdirectories
Understanding Operati 13
ng Systems
Subdirectories Can Be Implemented As an
Upside-down Tree
• Today’s File Managers allow users to create subdirectories
so related files are grouped together.
– Extension of previous two-level directory structure.
• Tree structures allow system to efficiently search
individual directories due to fewer entries in each.
• Path to requested file may lead through several directories.
• When user wants to access specific file, file name is sent to
File Manager. File Manager searches MFD for user's
directory. Then searches user's directory & any
subdirectories for requested file & location.
Understanding Operati 14
ng Systems
File Descriptor
Understanding Operati 15
ng Systems
File Names
Understanding Operati 16
ng Systems
File Naming Conventions
Understanding Operati 18
ng Systems
File Organization : Record Format
Understanding Operati 19
ng Systems
Physical File Organization
Understanding Operati 20
ng Systems
Characteristics Considered When
Selecting File Organization
• Volatility of data—frequency with which additions &
deletions made.
• Size of file.
Understanding Operati 21
ng Systems
Sequential Record Organization
Understanding Operati 23
ng Systems
Advantages of Direct Access Organization
Understanding Operati 24
ng Systems
Collisions Are a Problem With Direct
Access Organization
• Several records with unique keys may generate same
logical address (collision).
• Program generates another logical address before
presenting it to File Manager for storage.
• Colliding records stored in overflow area via links.
• File Manager handles physical allocation of space.
• Maximum file size established when created & eventually
file is full or too many records are stored in overflow area.
• Programmer must reorganize & rewrite file.
Understanding Operati 25
ng Systems
Indexed Sequential Record Organization
• To access any record in file, system begins by searching index file &
then goes to physical location indicated at that entry.
• Overflow areas are spread throughout file
– Existing records can expand & new records are in close physical &
logical sequence.
– Last-resort overflow area is located apart from main data area but
is used only when the other overflow areas are completely filled.
• When retrieval time becomes too slow, file has to be reorganized..
• Allows both direct access to a few requested records & sequential
access to many records for most dynamic files.
• A variation of indexed sequential files is B-tree.
Understanding Operati 27
ng Systems
Physical Storage Allocation
• File Manager must work with files not just as whole units
but also as logical units or records.
• Records within file must have same format but can vary in
length.
• Records are subdivided into fields.
– Structure usually managed by application programs, not
OS.
• When we talk about file storage, we’re actually referring to
record storage .
Understanding Operati 28
ng Systems
(a) Unblocked, fixed-length
R1 R2 R3 R4 R5 R6 records
Understanding Operati 30
ng Systems
Noncontiguous Storage
Understanding Operati 31
ng Systems
Linking File Extents
Understanding Operati 32
ng Systems
Indexed Storage
Understanding Operati 34
ng Systems
Data Compression
Understanding Operati 35
ng Systems
Data Compression: Repeated Terms
Understanding Operati 36
ng Systems
Data Compression : Front-end
Compression
3. Front-end compression used for index compression.
– For example, student database where the students’
names are kept in alphabetical order could be
compressed Original list Compressed list
Smith, Betty Smith, Betty
Smith, Gino 7Gino
Smith, Donald 7Donald
Smithberger, John 5berger, John
Smithbren, Ali 6ren, Ali
Smithco, Rachel 5co, Rachel
Smither, Kevin 5er, Kevin
Smithers, Renny 7s, Renny
Snyder, Katherine 1nyder, Katherine
Understanding Operati 37
ng Systems
Access Methods
Understanding Operati 39
ng Systems
Direct Access & Fixed-Length Records
Understanding Operati 40
ng Systems
Direct Access & Variable-Length Records
Understanding Operati 41
ng Systems
Access of Records in Indexed Sequential
File
• Accessed either sequentially or directly,
• Either CBA computations apply but with one extra step.
– Index file must be searched for pointer to block where data stored.
– Because index file is smaller, kept in main memory & quick
search to locate block where desired record is located.
– Block retrieved from secondary storage & beginning byte address
of record calculated.
• In systems with several levels of indexing, index at each
level must be searched before computing CBA.
– Entry point to this type of data file is usually through index file.
Understanding Operati 42
ng Systems
Levels in a File Management System
Understanding Operati 44
ng Systems
Access Control Verification Module
Understanding Operati 45
ng Systems
File Access Control Methods
Understanding Operati 46
ng Systems
Access Control Matrix
Understanding Operati 48
ng Systems
Access Control List Example
File Access
File 1 USER1 (RWED), USER2 (R-E-), USER4 (RWE-),
USER5 (--E-), WORLD (----)
File 2 USER2(R-E-), USER3 (R-E-), USER4 (--E-), WORLD (-
---)
File 3 USER2(RWED), USER4 (--E-), WORLD (----)
File 4 USER1(R-E-), USER5(RWED), WORLD(----)
File 5 USER5(RWED), WORLD (----)
Understanding Operati 49
ng Systems
Capability Lists
Understanding Operati 50
ng Systems
Lockword Control
Understanding Operati 51
ng Systems
Terminology
Understanding Operati 52
ng Systems
Terminology - 2
• logical address
• master file directory (MFD)
• relative address
• relative file name
• sequential record organization
• subdirectory
• variable-length record
• volume
• working directory
Understanding Operati 53
ng Systems