File Systems Flashcards
(103 cards)
What is the purpose of a file system?
Reliable long-term storage of significant quantities of data
How is the file system typically implemented?
Using disks
Are tapes suitable for general purpose file systems? Why/why not?
No, as they are too slow
Is main memory suitable for general purpose file systems? Why/why not?
No, as it is volatile and too small; however, main memory can be used for temp files (/tmp on unix)
What constitutes a file?
A named sequence or collection of bytes stored on disk.
This abstract data type has the following operations defined for it:
1) create
2) write
3) read
4) reposition within file
5) delete
6) truncate
7) open(fi): search directory structure on disk for entry fi and move contents of it to memory
8) close(fi): move content of entry fi to directory on disk (from memory)
What operations are available on files?
1) create
2) write
3) read
4) reposition within file
5) delete
6) truncate
7) open(fi): search directory structure on disk for entry fi and move contents of it to memory
8) close(fi): move content of entry fi to directory on disk (from memory)
How are files named and protected?
Usually named with an extension, separated by a dot (.)
Each have unique identifier (inode)
How is free space managed? What advantages/disadvantages are there? Which method do most modern OSs use?
Free lists: list of free disk blocks pointing to next.
Disadvantage: free block must be read before it can be allocated
or
Bitmaps: 1 bit per block, 1 if free, 0 otherwise. These have the advantage of being able to search for free block within certain neighbourhood. Most modern OS use bitmaps for this reason.
How can kernel ensure fast access to files?
Buffer cache
How can file system recover from crashes?
…
Why is a file a logical storage unit?
Because the fact it is made up of a “bunch of blocks” stored on device (from OS standpoint) means that it is a good abstraction
How does UNIX view files?
As a sequence of bytes. Any structure on top of this is strictly for user programs.
What are some UNIX file types?
eg. executable, archive
What are the attributes of a file?
1) Name: only info kept in human readable form
2) Identifier: unique tag to identify file in file system
3) Type: needed for systems that support different types
4) Location: pointer to file location on device
5) Size: current file size
6) Protection: controls who can do reading, writing, executing
7) Time, date and user identification: data for protection, security and usage monitoring
Where is information about files kept?
Directory structure, which is maintained on disk
What does the file extension do?
Indicates ‘purpose’ of the file
What was early directory structure like?
Fixed structure consisting of home directory and variable number of subdirectories - one for each project user is involved in
What is directory structure like now?
Subdirectories may have subdirectories - these form a tree structure. Uses . for self directory and .. for parent directory
What is an inode?
(information node) contains all information kernel has about a file EXCEPT its name
What do . and .. refer to at the root?
These refer to the same inode as each other
Do files have to have extensions in UNIX?
No
What is a UNIX filename?
Sequence of names separated by slashes (/). Kernel translates this to inode number by looking up each component in sequence
How does kernel translate UNIX filename into an inode number?
Looks up each component in the sequence. If file name begins with slash, start searching in root directory. Otherwise start at inode of current directory of the process
If a filename begins with a slash, where will the kernel start search for it? If not?
If file name begins with slash, start searching in root directory. Otherwise start at inode of current directory of the process