unix file system Flashcards
double/triple indirect reference
index block points to index block etc
what is an inode
a top level index block that contains permissions, the owner, the group the file belongs to, time stamps, reference count, block count
why is it a benefit that unix uses multilevel and indexed approach
allows both large files and small files to have fast access
what is the reference count
the number of directories/ file entries that reference this file
what happens when the reference count of a file goes to 0
it is deleted so the space can be freed
hard links
the aliases are the same and you cant tell which was first to be referenced
what happens to the reference count when a file is deleted by a user
theyre only deleting the reference to the inode so the reference count drops
symbolic links
creates a separate file so we get a new inode with a ref count of 1
the content of this file is the path to the actual file in text (basic file path)
what are the two alias types
hard and symbolic links
what is a positive of symbolic links
the link isnt specific or constrained by a single file system
what is a negative of symbolic links (broken link)
dont know what it exists until the path is traversed so when its deleted the file will be deleted too as the ref count is now 0 -> broken link
what is the purpose of the open file descriptor table
optimises the way files are accessed by processes
how does the open file descriptor table work
processes need to record all the files they have open and the position within that file
the table has the position the mode of access and the inode of the file
what happens when an unrelated process opens a file already in the file descriptor table
it gets a separate entry within the table but with different information (e.g. access modes)
why is it important to match the block size to the average file size
bigger block size with smaller files means a greater penalty for them
larger files with small block size means youll be using a lot of blocks = bigger overhead
tend to go for larger blocks as smaller files can occupy a fraction of it
how does the directory structure work
each entry has an inode number, length, type and name length
what does the length of an entry tell us
where the next inode entry is
what does the inode numbr of an entry tell us
the index
why do we store both the name length and the length in the entry
length - name length = how much unused space between it and the next entry if the space adjacent is empty
how do we look up file paths in this directory
we simply search for the name then follow the pointers to the next inode, then search for the name etc