File Systems Flashcards
Give the definition:
Array of persistent bytes that can be created/read/written/deleted
File
Give the definition:
Refers to collection of files. Describes how files are mapped onto physical devices. Also refers to parts of the OS that manages these files
File System (FS)
Give the definition:
Low-level names for files, index node
Inode
What do we call the type of files that are human readable?
Path
What do we call the file type that describes a files runtime state?
File descriptor
What are inodes unique within?
A FS
How many inode numbers does a file have?
1
What does this command do?
$ stat -x <file></file>
Shows inodes
Give the definition:
Reads for getting final inode
Traversal
Give the definition:
Unique ID for a file
Inode
Give the definition:
Human readable name for a file
Path
How does the FS interact with inode numbers?
By using path-to-inode mappings
Where are path-to-inode mappings stored?
In a directory
Give the definition:
Placing directories within other directories
Directory tree/hierarchy
Directories and files can have the same name as long as they’re in…
Different locations of the file system tree
Give the definition:
Runtime name to read & write files
File descriptor
What table contains pointers to open file descriptors?
File descriptor table
Integers used for file I/O are indexes into what table?
File descriptor table
Give the definition:
An API used for manipulation of files
File API
What command in the file API is this?
Returns a file descriptor
open()
What command in the file API is this?
Allows a process to create a new file descriptor that refers to the same underlying open file as an existing descriptor
dup()
What commands in the file API is this?
Calls return the processed bytes
read() & write()
What command in the file API is this?
Deletes a descriptor. Returns 0 for success & -1 for failure.
close()
What command in the file API is this?
read & write non-sequentially
lseek()
What is whence in lseek() set to if offset is set to offset bytes?
SEEK_SET
What is whence in lseek() set to if offset is set to its current location + offset bytes?
SEEK_CUR
What is whence in lseek() set to if offset is set to the size of the file & offset bytes?
SEEK_END
Give the definition:
Writing immediately. Forces buffers to flush to disk, tells disk to flush its write cache.
fsync()
Does a write buffer improve or lower performance?
Improve
Which function for deleting a file is this:
Deletes paths when called
unlink()
What function for deleting a file is this:
function descriptors are deleted
close() / process quitting
What function for renaming files is this?
- Deletes an old link to a file
- Creates a new link to a file
rename(char* old, char* new)
Does the rename() function both change the name of a file, and move data?
No, it only changes the name of the file
What sort of call is the rename() function implemented as?
Atomic - only old/new contents can be seen if crash