Karteikarten
SCC 211 - File Systems
Karten in diesem Stapel (53)
- 1State some common file system operations?• Create
• Open
• Read
• Write
• Seek - Reposition within file
• Close
• Link - Create alias for file (hard link*)
• Unlink - Remove file or alias - 2State common file attributes?• Name
• Unique Identifier
• File type
• Location
• Size
• Access Control Lists/ Flags
• Time and Date (accessed, modified, …)
• Ownership (user/ group) - 3State the different types of access?• Types of access
– Read, Write, Execute, Append, Delete, List - 4Access control options range between?– Simple User, Group, Other
– More complex object-capability based approaches - 5What modes are used to represent access control options in unix and Windows NT?• Unix: rwx modes for User, Group, Other
• NT: rich set of access permissions - 6What happens if we allow multiple links to a file?– File-system becomes Directed Acyclic Graph (DAG)
– Supporting links to directories
allows loops
• Processes scanning
directories can get trapped - 7Describe the hierarchy off directory, sub-directory, files?Root directory , Sub-directory, files
- 8Within virtual file system, what does common interface hide?• Common interface hides
– Multiple file-systems
– File-system differences
– Network file-system - 9How are files layed out in contiguous file allocation?– Each file fills set of adjacent blocks in filesystem
- 10What does contiguous file allocation allow?– Fast access
- 11What do you need to know before finding a gap for a file within contiguous file allocation and what does it work for?– Need to know file size before finding gap for file
• Works for CD-ROMs, but not ideal in other systems
• Could create file in pieces of known size, known as extents - 12What does contiguous allocation suffer from?– Suffers from external fragmentation
• End up with free/ unused blocks between files
– In this scheme files can’t be split, so we have to place whole file
• Same dynamic allocation problem saw in segmentation - 13What does linked list allocation avoid and what doesn't it avoid?– Avoids external fragmentation problem
• Blocks no longer need to be contiguous
– All blocks can be used, but pointers take space
• Fragmentation (in this case internal) confined to last block - 14What type of access is linked list allocation?– Only offers sequential access
• Must follow each block link to reach given file position - 15What does the file allocation table separate and what information does it store?Separates pointers from data blocks
– File Allocation Table (FAT) holds block numbers
– Keep multiple on-disk copies of FAT for resilience - 16Typically copy of the whole FAT can reside in memory, what does this ensure?– Limits size of FAT and thus filesystem
– Allows fast access to any block in any file - 17Index allocation keeps dedicated index blocks, what does this enable?• Quick access to any position/ address in file
– Simple mapping to { Block, Offset } - 18What can index allocation support?– Can support holes
• i.e. we don’t allocate space for ‘empty’, 0 filled blocks
• Good for code storing data/ records at calculated file offsets
– open(file); seek(file_position); write(record); close( ); - 19Three approached to indexed allocation?• linked, multi-level, and combined…
- 20What happens within index linked allocation?– Index block holds set of block addresses
- 21What happens within multi-level allocation?– Can be any number of levels deep
- 22What happens within combined allocation?– First entries are direct, single level entries
– Last entries are multi-level entries - 23Advantages and disadvantages of linked allocation?– Simple and fast
– Limited file size: only room for n block pointers in index block - 24Advantages and disadvantages of multi-level allocation?– Supports large file sizes
– Number of indexes can be tuned to max desired file size
• But still fixed when file-system created
– Access time increases with number of index levels - 25Advantages and disadvantages of combined (unix approach)?– Good compromise: fast for small files
– Access time slows as file size increases - 26Describe the file lookup process• Often
– Search from last directory entry read
• Processes typically scan directories sequentially
– Use filename caches to speed up access - 27How does the kernel speed up access to files?• Kernel maintains cache of recently used inodes
– Known as Active inode table
– Accessed using hash of inode and device number - 28What does buffer allow?– Decoupled byte and block reads
– Caching* of blocks to reduce disk activity
– Use read-ahead to speed up access (leverage locality) - 29Within buffering, what handles file blocks?– Disks handle blocks
- 30Within buffering, what reads and write bytes?Processes read and write bytes
- 31What happens if there are high volume of reads and writes?– Naïve per byte or word: read, modify, write
– Easy to spend all time moving disk blocks - 32Internal buffers must be regularly flushed/ sync’d to disk using Filesystem Flush/ Sync (-hronise) why?– Protect against lost data in event of system failure
– Speed up reuse of Least Recently Used (LRU) buffers
• Less chance of victim being dirty (out of sync with on-disk copy)
• Any modified buffers must be written out before they are reused - 33What do we use to flush dirty buffers to disk?– Regular/ periodic sync to flush ‘dirty’ buffers to disk
– Sync command/ system-call can force this
• Usually called, for example, as part of system shutdown process - 34What do we use to track updates?• Use a dirty flag to track updates
- 35Why do we use POSIX File Locking: lockf( )?• Often only way to coordinate unrelated applications
- 36Describe properties of a shared lock?– Any number of shared locks possible
– Cannot include any data byte under an exclusive lock - 37Describe properties of an exclusive lock?– Fails if any requested byte subject to existing lock
- 38• API allows blocking and non-blocking lock requests, what happens to a blocking lock request?– Blocking lock request hangs until bytes available (no locks)
- 39Block size and efficiency wasting for POSIX file locking?– Wastage as percentage of disk space
– Larger block sizes allow for larger files
• More links per index block
• More data in each referenced data block - 40When is efficiency best in terms of block and file sizes and what is the problem with this?• Efficiency best when block and file sizes matched, but
– Small blocks tend to suit small files
– Large blocks tend to suit large files - 41What are you tended to do as file size increases?Tended to move to larger blocks as file sizes increased
– Media files, etc. - 42What can some file systems do in relation to handling blocks?Some file-systems can allocate fragments of blocks
– i.e. 4 x 1K fragments from a single 4K disk block - 43Blocks must be what of the disk sector size?• Blocks must be multiple of disk sector size
- 44How should you check for file system consistency and what should happen?• Maintain used and free lists or counts for all blocks
• Each block should appear
– Once and only once
– On either used list or free list, but not both - 45What should happen if there are missing block( on neither list)?• Missing blocks (on neither list): Add block to free list
- 46What should happen if a block appears more than once on a free list?More than once on free list: Rebuild free list
- 47What should happen if there are blocks on both lists?On both lists: Remove from free list
- 48What should happen if a block is used more than once in used list?– Copy block and place one copy in each file referencing block
– One or more files may be corrupt but file-system will be intact - 49What should you also do when checking for file consistency?Also count directory entries and check against stored values
- 50What are file system updates written as?File-system updates written as transactions to journal/ log
– Transactions periodically flushed to disk
– Entries only removed from log when confirmed written/ flushed - 51Why are file systems fast?Fast as decouples file writes from disk head movement
– Flush operation can do in-order sector writes
– Transaction log can be on faster disk/ media - 52Why are file systems resilient?Resilient as log can be ‘replayed’ in event of system failures
– Transactions must be atomic and idempotent - 53What is idempotent?Idempotent is the property of certain operations in mathematics and computer science, that can be applied multiple times without changing the result beyond the initial application.
Informationen
- Beschreibung
- Karteikarten am SCC 211 - File Systems, erstellt von Ayo Olutobi am 21/04/2017.
- Erstellt von
- Ayo Olutobi
- Aufrufe
- 0
- Bewertung