File Systems Flashcards
what is a file?
a variable length sequence of bytes
what attributes do files have? (7)
- name
- identifier
- type
- location
- size
- protection
- creation/modification time, date and user id
name 6 file operations
- creation/opening
- reading
- writing
- repositioning
- deletion
- truncation
what is an open file table? what are two types?
- the open() system call will return a pointer to an entry in the open file table
- this acts as an identifier for the open tile
- used as a parameter to all subsequent file operation
system-wide file table:
- all currently open files
- a count of how many processes have the file open
- contains copies of FCBs of all open files
per-process open file table:
- files that a process currently has open
- entries point to a systemwide entry
- current file pointer values for the process
- the access mode
remember that file locking is the same as database locking
shared locks and exclusive locks
what is a file extension and what’s the point?
infers a file’s use. a file ending in .pdf should be opened in a reader
difference between sequential and direct access?
sequential - a linked list. have to read or write from the current position in the file and advance the pointer
direct access - an array. allows random access. supported by disks
what is partitioning?
splitting a device into multiple storage volumes
describe the acyclic structure
- there can be multiple names/paths for the same file or directory
- space allocated to a file can be reclaimed only when the last reference is deleted, by maintaining a reference count. incremented when a reference is added
- need to prevent cycles. in Linux symbolic linking to an already existing directory is forbidden
what is a file control block (FCB)?
fcb contains information for individual files. these are inodes in unix
what is a VFS?
a virtual file system allows unix to support the use of multiple different file systems
the same system call interface can be used for different types of file system
the os provides a single API and so an os can use different file systems for different disks or on the network
local files are distinguished from remote ones
describe contiguous allocation
- files are on the disk contiguously
- there is no additional head movement, no seeking
- move one track when switching cylinders
- can be direct access, access i starting from b saying b
problems:
- allocating dynamic space
- when files expand they may run up against other files, and have to be copied to larger spaces
- external fragmentation issues
describe the read operation steps
- read is called at index i
- the process is found in the per-process open file table at i
- that entry points to the system wide file table
- the inode in the system wide table points to the data block
described linked allocation, pros and cons
- files in the style of a linked list (not really a linked list)
- can have variable file sizes
- no fragmentation
cons: - not resistant to data loss
- only sequential access, direct access is impossible
- head movement may be great, because the blocks aren’t contiguous
- requires overhead for pointers
describe a FAT
file allocation table
a variantion on linked allocation
- section of the disk holds the FAT
- – one entry per disk block
- – indexed by block number
- used like a linked list
- directory contains block number of first block of file
- like a linked list of list heads