File Manager Flashcards
What is the file manager?
Keeps track of every file in the system, providing an abstracted view of files to the user and maps this onto a disk.
File Manager Tasks
These include:
- organise files into folders
- map file locations
- map logical structures onto physical locations
- enforces restrictions to files
- deal with open, close, read, write and delete operations.
- provides syscalls.
- liaises with device manager to access physical disks within system.
Disk Blocks
Essentially, each disk is split up into blocks of a certain size in which the OS chooses. Files fill up more than one block normally, but there is only one file per block, so space is wasted if a block if not full.
Disk Format
Each partition of a physical disk will be formatted with a particular disk format, splitting these blocks into equal sizes.
File Allocation Methods
The disk format and block usage are both decided by the file allocation method. There are many ways to allocate files to blocks on disks, three being contiguous, linked and indexed.
This also is used for deciding how blocks in a file are accessed.
Freelist
States whether a block is free or not using 1 and 0 (respectively, in use and free). This is stored on a part of a disk which is reserved for such data.
Metadata
Used to store information about a file. This is stored on a part of a disk which is reserved for such data.
File System Parts
Physical Storage On Disk -> FAT, XFS and EXT4.
Logical Naming Scheme -> File/Directory Names.
Permission Model -> Access control such as permissions used by linux.
Syscalls -> System calls, standardised programmatic access to files via kernel.
System calls in the file system
fopen
fclose
fread
fwrite
fseek
fflush
Any program using these system calls can manipulate data in these files.
User programs can see the logical view of the file system via syscalls.
Logical View
- Filenames with extensions, like .txt
- folder hierarchies
- shell with drag and drop and copy/paste in terms of files
For example, file explorer for windows can be considered a logical view of the file management system.
Physical View
- directories and files are just bit patterns stored in blocks of the disk
- OS needs to know which block belongs to which file
- contains metadata and freelist
- arrangement and usage of blocks depends on file allocation method
Inodes and Disk Format with Inodes
Something we use to map logical to physical. Inodes point to physical blocks on disk, with each file having an inode which stores metadata on it. This builds up an inode table, which is then stored on disk in the free allocated space. The parts of the disk then include:
Housekeeping data (contains metadata about the file system)
Freelist
Inode table
Data blocks
Housekeeping Data
This is data that is used for administrative or management purposes, rather than for direct use by end-users or applications. Essentially, metadata about the file system.
Sequential File Access
Start with first block and read each block in order until correct one with wanted data is found.
Direct File Access
Goes directly to the block that contains required data, skipping over other blocks in the meantime.