CS FundamentalsHardGATE CS (PYQ pattern)
A file of 100,000 bytes is stored on a disk with 512-byte blocks. Under linked allocation each block holds a 4-byte next-pointer and 508 data bytes; under FAT allocation all 512 bytes are data and the whole FAT is already cached in memory. Starting from the directory entry (in memory), how many disk-block reads does each scheme need to fetch the byte at offset 60,000 (offsets start at 0)?
- A. linked 118, FAT 1
- B. linked 197, FAT 1
- C. linked 119, FAT 118
- D. linked 119, FAT 1
Correct answer: D. linked 119, FAT 1
Linked: offset 60,000 lies in block index 60000 / 508 = 118 (0-based), and every block 0..118 must be read to follow the pointers: 119 reads. FAT: the chain is walked in the cached table, so only the data block (index 60000 / 512 = 117) is read: 1 read. Using 512 data bytes per linked block (or forgetting the target block) gives 118; 197 is the whole file; FAT 118 ignores that the FAT is cached.
More Operating Systems questions
- A 2^40-byte disk uses 4 KB blocks. Free space can be tracked either by a bitmap (1 bit per block) or by a plain list of free block…
- A 10,000 RPM disk has an average seek time of 5 ms and a sustained transfer rate of 100 MB/s (1 MB = 10^6 bytes). It serves a stream of…
- A one-slot buffer uses semaphores mutex = 1, empty = 1, full = 0. The producer runs twice: wait(mutex); wait(empty); print p…
- Five processes with CPU bursts 5, 12, 3, 9 and 7 ms all arrive at time 0 in that order. Context switches are free. Among the quanta 2, 4…
- A 32-bit machine uses two-level paging with 10 + 10 + 12 address bits. For the running process, root-table entries 3 and 0x2FF are valid…
- Assume every fork() succeeds and output is not lost or duplicated. int x = 1; int main(void) { int p = &x; if (fork() == 0) { p += 2; if…