Q142: Block allocation for files using linked list.

This is in continuation with Question 141

Question 142: Which of the following is true when the files will be allocated as per the linked list?

  1. Dynamic allocation of the blocks is easy.
  2. Moving to any offset in the file is easy.
  3. Difficult to grow the size of the file.
  4. None of the above

Solution: The correct answer is option 1 as any block can be allocated anywhere in the disk and can be joined via linked list.

Q141: Contiguous block allocation for the files

Question 141: What will be the disadvantage when the files will be allocated only on contiguous blocks on the disk?

  1. Head of the disk will require too much movement to traverse the file.
  2. Head of the disk will require minimal movement as the file is contiguous.
  3. It will be difficult to calculate the block location of block I of a file.
  4. It will be difficult to find the contiguous space for a large file in the disk and file size growth would be a heavy operation.

Solution: The correct answer is option 4. Head of the disk movement will be minimal as the file is contiguous, hence this is advantage. Also, calculating the block “i” would be easy as they are sequential. The problem is that dynamic growth as we are not sure that there will be enough blocks available after the allocated blocks. In the worst case we will need to move the whole file.

Q140: A journaling file system is an example of?

Question 3: A journaling file system is an example of:

Options:

  1. Disk File System
  2. Transactional File System
  3. Network File System
  4. Database File System

Solution: The correct answer is 2nd one. Journaling file systems maintain a log and store information there before committing changes. In the event of crash, log is used to restore system state.

Q137: Journaling File System

Question #137: A journaling file system is a file system that keeps track of the changes that will be made in a journal (usually a circular log in a dedicated area of the file system) before committing them to the main file system. Which of the following statement is not true about journaling in file systems?

Options:

  1. Journaled file system provides data security in case of power failure.
  2. Journaled file system provides data security in case of sudden disconnection of storage devices.
  3. Journaled file system provides data security in case of bad blocks.
  4. Journaled file system adds on overhead.

Solution: The correct answer is the third one. Bad blocks can happen in the existing file system too, hence journaling won’t help in this case. Rather, a solution like RAID would help.

Q97: Unix/Linux file permissions

Question #97: In linux, file permissions to any file can be of the following form:

(r w x) – (r w x) – (r w x)
(user permission) – (group permission) – (others permission)

Where, r means read access, w means write access and x means executable access.

Each bit can be 0 or 1. For example, if ‘w’ bit of user permission is 0, user can’t write on to that file. What will be the file permission value if we want the user to have all read, write and executable permissions while the group and other users should only be able to read the file?

Options:

  1. 0x777
  2. 0x744
  3. 0x722
  4. 0x700

Solution: The correct answer is second one. For user permission, all 3 bits need to be 1 thereby making it 0x7. For group and others, we only need read access; hence bit pattern should be 100, which is 0x4. Hence it becomes 0x744.

Q27: Granularity of disk access

Question #27: File systems perform read/write from disk in a granular manner, usually in chunk of a block which is several hundred bytes. Why do you think file systems do not simply access at the granularity of bytes?

Options:

A) It will be inefficient, as metadata needs to be stored.

B) It is just a norm that is followed for compatibility.

C) Disk read/writes are generally slow. The more data you read/write in a single go, the faster it is.

D) Because file sizes are usually big. So, block size is kept bigger than a byte for efficiency.

Solution: The correct answer is C. If you read 1000 bytes, byte by byte, it will be much slower than if you read 2 blocks of 500 bytes each.

Q23: Bitmaps for tracking allocated sectors

Question #23: Free space bitmap is one way to track allocated sectors in file systems implementation. In the simplest case, each bit in the bitmap represents one sector of the file system. Which of the following is incorrect about bitmaps?

Options:

A) Provides fast random access allocation check

B) Inefficient for large disks as it wastes space

C) Inefficient as finding a free sector in an almost full disk is slow

D) High storage overhead as percentage of disk size.

Solution: Bitmaps take very less space even when sector size is small. Hence statement in option D is incorrect.