Q1: Consider two files systems A and B , that use contiguous allocation and linked allocation, respectively. A file of size 100 blocks is already stored in A and also in B. Now, consider inserting a new block in the middle of the file (between 50 th and 51 st block), whose data is already available in the memory. Assume that there are enough free blocks at the end of the file and that the file control blocks are already in memory. Let the number of disk accesses required to insert a block in the middle of the file in A and B are n A and n B , respectively, then the value of n A + n B is (2022)
(a) 50
(b) 51
(c) 101
(d) 153
Ans: (d)
Sol: Contiguous Allocation ::
In case of Contiguous allocation we can directly go to the 50 th element. After this, we have to insert a block here, and since the
allocation is Contiguous , therefore you need to shift all the remaining 50 blocks to the right. [As enough free blocks are available to the right and no free blocks are available in the beginning, so we can only shift the blocks to he right only].
So,
50 Read Operations + 50 Write Operations +1 [1 operation to write a newly inserted block] = 101 Operations in Total.
Also, we know from the Contiguous Memory allocation concept that overwriting an element simply means deleting it. Therefore, we don't have to worry about deleting an element specifically. We can just overwrite them, thus saving the cost of operations.
Linked Allocation ::
In Linked Allocation , 50 operations to read first 50 elements , 2 operations are needed to delete the next pointer of the
50 th element, connect that link to the block which is to be inserted, and then connect the next pointer of that block to the 51 st element. This takes 2 operations.
So, Total 52 operations are needed in this case.
Q2: The index node (inode) of a Unix-like file system has 12 direct, one single-indirect and one double-indirect pointer The disk block size is 4 kB and the disk block addresses 32-bits long. The maximum possible file size is (rounded off to 1 decimal place) __________ GB. (2019)
(a) 1
(b) 2
(c) 4
(d) 8
Ans: (c)
Sol: Given 12 direct, 1 single indirect, 1 double indirect pointers
Size of Disk block = 4KB
Disk Block Address = 32 bit = 4 B
Number of addresses= Size of disk block/address size = 4KB \ 4KB = 2 10
Maximum possible file size = 12 * 4KB + 2 10 * 2 10* 4KB
4.00395 GB ≅ 4GB
Hence 4GB is the correct answer
Q3: In a file allocation system, which of the following allocation schemes(s) can be used if no external fragmentation is allowed? (2017 SET 2)
I. Contiguous
II. Linked
III. Indexed
(a) I and III only
(b) II only
(c) III only
(d) II and III only
Ans: (d)
Sol: Internal fragmentation occurs when a process is allocated more memory than required, few space is left unused.
External fragmentation occurs when blocks of memory are there, but they are non-contiguous and can’t fill the upcoming request for memory.
Linked and indexed allocation are free from external fragmentation but contiguous allocation scheme suffered from external fragmentation problem.
Q4: A FAT (file allocation table) based file system is being used and the total overhead of each entry in the FAT is 4 bytes in size. Given a 100x 10 6 bytes disk on which the file system is stored and data block size is 10 3 bytes, the maximum size of a file that can be stored on this disk in units of 10 6 bytes is _______. (2014 SET 2)
(a) 18.7
(b) 99.6
(c) 800
(d) 112
Ans: (b)
Sol: Each data block will have its entry.
|So, Total Number of entries in the FAT
= Disk Capacity / Block size = 100 MB / 1KB
Each entry takes up 4B as overhead
So, space occupied by overhead = 100 K × 4 B = 400 K B = 0.4 M B
We have to give space to Overheads on the same file system and at the rest available space we can store data.
So, assuming that we use all available storage space to store a single file = Maximum file size =
Total File System size - Overhead 100 MB - 4. 0 MB = 99.6 MB
Q5: A file system with 300 GB ytes disk uses a file descriptor with 8 direct block addresses, 1 indirect block address and 1 doubly indirect block address. The size of each disk block is 128 Bytes and the size of each disk block address is 8 Bytes. The maximum possible file size in this file system is (2021)
(a) 3 KB ytes
(b) 35 KB ytes
(c) 280 KB ytes
(d) dependent on the size of the disk
Ans: (b)
Sol: Direct block addressing will point to 8 disk blocks 8 X 128 B = 1KB
Singly Indirect block addressing will point to 1 disk block which has 128 / 8 disc block addresses = (128 / 8) X 128 B = 2KB
Doubly indirect block addressing will point to 1 disk block which has 128 / 8 addresses to disk blocks which in turn has
128 / 8 addresses to disk blocks = 16 X 16 X 128 B = 32 KB
Total = 35 KB
Answer is (B).
Q6: The data blocks of a very large file in the Unix file system are allocated using (2008)
(a) contiguous allocation
(b) linked allocation
(c) indexed allocation
(d) an extension of indexed allocation
Ans: (d)
Sol: The data blocks of a very large file in the unix file system are allocated using an extension of indexed allocation or EXT2
file system. Hence, option (D) is the right answer.
10 videos|99 docs|33 tests
|
1. What are the different types of file systems used in computer science engineering? |
2. How does a journaling file system work? |
3. What is the purpose of a file system in computer science engineering? |
4. Can different operating systems share the same file system format? |
5. How does fragmentation affect file system performance? |
|
Explore Courses for Computer Science Engineering (CSE) exam
|