journaling and file locking Flashcards
how are journaling file systems fast
it decouples the file writes from the disk head movement
the flush operation can do in-order block/sector writes
the transaction log could be on a faster disk/media
how are journalling file systems resillient
the log can be replayed in event of system failure as transactins must be atomic and idempotent
idempotent
can be repeated a number of times and still have the same result
atomic
all or no subparts of the transaction must be complete
how does a Journaling file system work
the file system updates are written as transactions to a journal or log
the transactions are periodically flushed to a disk
entries are only removed from the log when confirmed written/flushed
how is a journaling file system circular
the log has a fixed size and reuses space by overwriting the oldest entries when its full
shared lock
can have as many as you want
cannot include any data with an exclusive lock
exclusive lock
only one transaction can hold the lock at a time
if a transaction requests a lock on a byte thats already locked then it fails
blocking lock request
hangs until the bytes are available (have no other locks on them)
non-blocking lock requests
immediately returns if the bytes are unavailable
which operation are shared locks used for
reading
which operation are exclusive locks used for
writing