12/04/2022, 09:27 Exam/File Systems – COMP3231/COMP9201/COMP3891/COMP9283
File Systems
1. File Systems
1. Filesystems can support sparse files. What does
Copyright By PowCoder代写 加微信 powcoder
this mean? Give an example of an application’s file organisation that might benefit from a file system’s sparse file support.
2. Give an example of a scenario that might benefit from a file system supporting an append-only access right.
3. Give a scenario where choosing a large filesystem block size might be a benefit; give an example where it might be a hinderance.
4. Give an example where contiguous allocation of file blocks on disks can be used in practice.
5. What file access pattern is particularly suited to chained file allocation on disk?
6. What file allocation strategy is most appropriate for random access files?
7. Compare bitmap-based allocation of blocks on disk with a free block list.
8. How can the block count in an inode differ from the (file size / block size) rounded up to the nearest integer.
9. Why might the direct blocks be stored in the inode itself?
10. Given that the maximum file size of combination of direct, single indirection, double indirection, and triple indirection in an inode-based filesystem is approximately the same as a filesystem solely using triple indirection, why not simply use only triple indirection to locate all file blocks?
11. What is the maximum file size supported by a file system with 16 direct blocks, single, double, and triple indirection? The block size is 512 bytes. Disk block numbers can be stored in 4 bytes.
12. Both the Berkeley Fast Filesystem (BFFS) and ext2fs use the idea of block groups. Describe what this idea is and what improvements block groups have over the simple filesystem layout of the System V file system (s5fs).
13. What is the reference count field in the inode? You should consider its relationship to directory entries in your answer.
14. The filesystem buffer cache does both buffering and caching. Describe why buffering is needed. Describe how buffering can improve performance (potentially to the detriment of file system robustness). Describe how the caching component of the buffer cache improves performance.
15. What does flushd do on a UNIX system?
16. Why might filesystems managing external
storage devices do write-through caching (avoid buffering writes) even though there is a detrimental affect on performance.
https://wiki.cse.unsw.edu.au/cs3231cgi/Exam/File Systems
12/04/2022, 09:27 Exam/File Systems – COMP3231/COMP9201/COMP3891/COMP9283
Filesystems can support sparse files. What does this mean? Give an example of an application’s file organisation that might benefit from a file system’s sparse file support.
File systems can support files that are mostly empty. This is usually accomplished by writing brief information (metadata) representing the empty blocks to disk instead of the actual “empty” space which makes up the block, using less disk space. A contrived example would be a file that has 1 byte written at address 0, and 1 byte written at address 10000: all the space between would not be actually allocated, with only the file metadata updated. One application that might benefit from sparse file support is a virtual machine. Virtual machines simulate disks by using files, but the disk may not ever be fully used.
Give an example of a scenario that might benefit from a file system supporting an append-only access right.
Log files (e.g. used for auditing). Append-only prevents the modification of any existing log entries.
Give a scenario where choosing a large filesystem block size might be a benefit; give an example where it might be a hinderance.
Faster sequential access as this reduces the number of IO operations required to access a file of a given size.
Improves economy of storage by reducing the amount of metadata used for a file of a given size.
Drawbacks:
Increased internal fragmentation. For example, a file that is smaller than a block will waste less space when the filesystem block size is smaller.
Slower random access, as each IO operation will load more irrelevant data when accessing a portion of data in a file that is smaller than a block.
Give an example where contiguous allocation of file blocks on disks can be used in practice.
CD-ROMs – you know how big all the files are prior to burning the disk and you can’t update the files.
What file access pattern is particularly suited to chained file allocation on disk?
Sequential file access is suited to chained file allocation. The blocks in the file form a chain or linked list, with the location of the next block stored at the end of the current block. In contrast, sequential access of an inode-based file requires returning to the inode (or indirect blocks) to find the location of the next file.
https://wiki.cse.unsw.edu.au/cs3231cgi/Exam/File Systems
12/04/2022, 09:27 Exam/File Systems – COMP3231/COMP9201/COMP3891/COMP9283
What file allocation strategy is most appropriate for random access files?
Indexed allocation is appropriate for random access, as it takes a constant amount of time (slowing down very slightly with increased indirection levels) to access any part of a file.
Compare bitmap-based allocation of blocks on disk with a free block list.
Bitmap-based allocation: store a bitmap on disk indicating which blocks are free.
+ Can concentrate allocations in one area.
+ Fast to find contiguous free blocks.
– Can be large in size. This can be alleviated using a multilevel table – Expensive to search
Free block list: link unused blocks to each other in a linked list. One block is kept in memory.
+ Doesn’t use up extra disk space.
+ Can just keep a block of pointers in memory, saving memory space
– Difficult to find free blocks as the list doesn’t guarantee contiguity (though this can be alleviated with background tasks that reorganise the list to some degree)
– Can use a lot of disk IO when block in memory is close to full or empty. This can be alleviated by moving the block to disk when it reaches a ‘high water mark’.
How can the block count in an inode differ from the (file size / block size) rounded up to the nearest integer.
Block counts include any blocks used for indirection and metadata. Blocks may not be allocated for every part of the file in a sparse file.
Why might the direct blocks be stored in the inode itself?
This provides quick access to the blocks in the start of the file by eliminating the need to seek and rotate from the inode to another part of the disk where the direct block is stored. For small files, the entire file can be stored in the inode hence dramatically improving performance. Most files are small so this change improves the performance of file system operations in the majority of situations.
Given that the maximum file size of combination of direct, single indirection, double indirection, and triple indirection in an inode-based filesystem is approximately the same as a filesystem solely using triple indirection, why not simply use only triple indirection to locate all file blocks?
It is slower to access a triple indirect block than a direct block. Let us assume that the inode is in memory and that any other blocks are on the disk. A direct block requires 1 memory access to find the block number, and 1 disk access to load the block. A triple indirect block requires 1 memory access plus 3 disk accesses to find the block number, and another disk access to load
https://wiki.cse.unsw.edu.au/cs3231cgi/Exam/File Systems
12/04/2022, 09:27 Exam/File Systems – COMP3231/COMP9201/COMP3891/COMP9283
the block. The performance hit of using triple-indirection does not affect most files, because most files are small and only use direct blocks.
What is the maximum file size supported by a file system with 16 direct blocks, single, double, and triple indirection? The block size is 512 bytes. Disk block numbers can be stored in 4 bytes.
Block size = 512 bytes
Number of block numbers per block
Maximum number of blocks
Maximum file size:
Both the Berkeley Fast Filesystem (BFFS) and ext2fs use the idea of block groups. Describe what this idea is and what improvements block groups have over the simple filesystem layout of the System V file system (s5fs).
File system is made up of a boot block and a number of equally sized block groups. Each block group stores:
Super block: stores information about the entire file system. Group descriptor: stores information about the block group. Data block and inode bitmaps
Inode list
Data blocks Improvements over s5fs:
Improved locality by keeping inodes and data blocks close to each other in a block group, instead of being on separate parts of the disk.
Improved redundancy by duplicating the super block in each block group. In s5fs, there is only 1 super block so if that block is corrupted, the filesystem may become unusable.
What is the reference count field in the inode? You should consider its relationship to directory entries in your
= Block size / Size of block number
= 16 + 128 + 128^2 + 128^3
= 2,113,680
= Maximum number of blocks * Block size
= 2,113,680 * 512
= 1 082 204 160 bytes
= 2,113,680 * 0.5 KB = 1,056,840 KB
https://wiki.cse.unsw.edu.au/cs3231cgi/Exam/File Systems
12/04/2022, 09:27 Exam/File Systems – COMP3231/COMP9201/COMP3891/COMP9283
The reference count field in an inode counts the number of directory entries pointing to inode. When multiple directory entries refer to the same inode, they are said to have hard links to each other.
When a new directory entry is created that points to inode, the file system increments the inode’s reference count. Likewise, the reference count is decremented when a directory entry pointing to the inode is deleted.
When the reference count reaches zero, we can mark the inode as free and reuse it to store another different file.
The filesystem buffer cache does both buffering and caching. Describe why buffering is needed. Describe how buffering can improve performance (potentially to the detriment of file system robustness). Describe how the caching component of the buffer cache improves performance.
Buffering is required when the unit of transfer is different between two entities – for example, updating 1 byte in a disk block requires buffering the disk block in memory. Buffering improve performance at the cost of reducing file system robustness to ungraceful shutdowns.
Writes to disk can be buffered and written to disk in the background.
Allows for read ahead, improving the performance of subsequent reads. Caching is loading used data into the buffer cache, such that subsequent reads to the same block of data are accelerated by using the data in memory instead of on the disk. This is only benefits when the principle of locality holds, i.e. data that has been used recently is likely to be reused in the near future and data that is close to each other is likely to be used close in time.
What does flushd do on a UNIX system?
Periodically syncs (writes) dirty blocks to disk (every 30 seconds) to avoid significant data loss on unexpected OS shutdown/powerloss.
Also indirectly improves performance as it increases the number of clean blocks, and clean blocks can be booted immediately from buffer cache rather than writing them back.
Why might filesystems managing external storage devices do write-through caching (avoid buffering writes) even though there is a detrimental affect on performance.
External devices have no guarantee of connectivity. To ensure filesystem consistency, writes should be made immediately without caching and be made as atomic as possible in case the drive is removed before the write has been committed to the drive.
Exam/File Systems (last edited 2018-06-20 21:27:11 by anonymous)
https://wiki.cse.unsw.edu.au/cs3231cgi/Exam/File Systems
12/04/2022, 09:27 Exam/File Systems – COMP3231/COMP9201/COMP3891/COMP9283
https://wiki.cse.unsw.edu.au/cs3231cgi/Exam/File Systems
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com