chapter 12 - file management Flashcards
3 desirable properties of files
Long-term existence: kept on secondary storage
Sharable between processes: for shared access
Structure: some file systems manage the internal structure of a file, which can be organized in a way suitable for particular applications
what are the 6 file operations?
create, delete, open, close, read, write
what is the file structure?
field, record, file, database
what is a field? (file structure)
basic element of data, characterized by its length and data type, contains single value
what is a record? (file structure)
collection of related fields
ex. employee record
can be variable length
what is a file? (file structure)
collection of similar records, treated as single entity
what is a database? (file structure)
collection of related file(s)
what are Unix files?
streams of bytes, don’t have internal structure as far as OS is concerned
what is a file management system?
set of system software providing file services to users and applications
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.
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.
what is involved in a file system architecture?
Device driver: communicates directly with hardware device.
Basic file system: handles physical I/O.
Basic I/O supervisor: responsible for file I/O initiation and termination, device selection, I/O scheduling, buffer allocation.
Logical I/O: Enables users and applications to access records. Provides record-oriented I/O capability.
Access method: access files based on their structure and method of access.
what are the 5 file management functions?
identify and locate a selected file
enforce user access control (shared system)
employ access method on the records
provide blocking for file I/O
manage secondary storage
5 criteria for choosing a file organization?
Rapid Access
Ease of update
Economy of storage
Simple maintenance
Reliability
5 fundamental file organizations?
Pile
Sequential file
Indexed sequential file
Indexed file
Direct or hashed file
what is a pile? (fundamental file org)
data collected in the order it arrives
Purpose is to accumulate a mass of data and save it
Records may have different structures or no structure.
Data access is by exhaustive search
May be useful to store data prior to processing
what is sequential file? (fundamental file org)
Fixed format used for records.
Records are the same length.
All fields the same (order and length).
Field names and lengths are attributes of the file.
One field is the key field
- Uniquely identifies the record
- Records are stored in key sequence
New records are placed in a log file or transaction file.
Log file is periodically merged with the master file.
Useful in batch processing.
what is an indexed sequential file? (fundamental file org)
File is like a sequential file with key and data.
Index provides a lookup capability to quickly reach the vicinity of the desired record.
Greatly reduces the time required to access a single record, while still providing sequential processing.
Additions can be handled by an overflow file, which can be periodically merged with the main file.
what is an indexed file? (fundamental file org)
Uses multiple indexes for different key fields.
Abandons sequential format with single key.
Records are accessed only by their index.
Records can be variable length.
Exhaustive index has pointers to every record.
Partial index only has pointers to records having the field of interest.
Useful in applications such as an airline reservation system that need to access particular records quickly, but rarely need to process them sequentially.
what is a direct/hash file? (fundamental file org)
Turn key value into an address to support direct access of records in the file.
Gives very rapid access to data.
Useful if records are only accessed one at a time.
what is a B-tree?
indexes often implemented as this.
has large branching factor leading to tree of low height -> results in fewer disk accesses to traverse the tree in a search
what is a directory?
contains info about file (attributes, location, ownership)
is a file itself, owned by OS, managed by file system
2 issues that arise from file sharing
access rights and simultaneous access
2 approaches for simultaneous access
- lock entire file when it needs to be updated
- lock individual record during update
when does record blocking occur? when does unblocking occur?
when writing data to file
when reading data in file
what are the 3 blocking methods (record blocking)
Fixed: fixed-length records. May cause internal fragmentation.
Variable-length spanned: variable-length records which may span blocks. Permits unlimited record size. May require multiple I/O’s.
Variable-length unspanned: variable-length records which do not span blocks. May cause internal fragmentation.
2 management issues in secondary storage management
allocating blocks to files and maintaining a list of free blocks
what are the 2 methods of allocation portion size in a file
Large, variable-length contiguous portion.
Good performance.
May cause fragmentation.
Allocation table is simple, just need pointer to beginning and length.
Small fixed-sized blocks.
Good flexibility.
Requires more complicated allocation table to keep track of non-contiguous blocks.
3 file allocation methods
contiguous, chained, indexed
contiguous allocation
a single contiguous set of blocks is allocated to a file at the time of file creation.
is a preallocation method of a variable-size portion.
May require periodic compaction due to fragmentation.
Good for sequential file access.
chained allocation
allocate individual blocks
each block contains a pointer to the next block
indexed allocation
an index specifies the location of each block
what does a disk allocation table do
keeps track of available space
what are the 4 techniques for free space management
Bit tables: each bit represents a block
Chained free portions: free portions are chained together.
Indexing: index keeps track of every free portion as if it was a file.
Free block list: blocks are numbered and list of free block numbers is maintained.