GATE CS 2022 Set 1 — Question 63
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+2 / -0HardFile Allocation MethodsFile SystemsOperating System
Operating System → File Systems → File Allocation Methods
Last updated
Question
Consider two files systems and , 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 and 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 and are and , respectively, then the value of is _________.
Correct answer
153 to 153
Solution
For File System A (Contiguous Allocation):
- The file has 100 blocks. We need to insert a new block between the and blocks (i.e., at position 51).
- This requires shifting the blocks from index 51 to 100 (total blocks) one position to the right (to indices 52 to 101) to create space.
- Shifting 50 blocks involves reading each block and writing it to the new location.
- Number of Reads = 50
- Number of Writes = 50
- After shifting, we write the new block at index 51.
- Number of Writes = 1
- Total disk accesses for A () = .
- To insert a block after the block, we must traverse the linked list from the beginning to reach the block (since linked allocation does not support random access).
- We read blocks 1 to 50 to find the pointer in the block.
- Number of Reads = 50
- We then update the pointer of the block to point to the new block, and the new block points to the old block.
- We write the updated block and the new block to disk.
- Number of Writes = 2
- Total disk accesses for B () = .
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on File Systems
2026 Set 2 Q23Which one of the following CPU scheduling algorithms cannot be preemptive?2026 Set 1 Q29With respect to deadlocks in an operating system, which of the following statements is/are FALSE?2026 Set 1 Q31In the context of relational database normalization, which of the following statements is/are true?2026 Set 1 Q35Consider a system consisting of instances of a resource , being shared by 5 processes.…2026 Set 2 Q51Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A…