🎓 BookMCQ
← Back to 11. File System Interface

📝 Multiple users in File Sharing in Operating System (11 MCQs)

Concurrent File Access by Different Users

Multi-user file sharing allows several users to access files stored within the same operating system or networked file system. The file-system interface uses ownership information, access-control permissions, and sharing mechanisms to regulate operations. Users may read common documents, modify shared resources, or collaborate on stored information according to configured rights. The operating system must also handle simultaneous access and protect data against unauthorised modification.

Why Shared Files Require Ownership and Access Rules

Multiple users may need access to common resources, but unrestricted access can expose private data or cause conflicting updates. Ownership identifies the responsible user or group, while permissions determine which operations are allowed. Shared directories also require appropriate policies so that users can create, delete, or modify files without violating another user's access rights.

Permission Checking and Concurrent File Operations

When a user requests a file operation, the operating system checks the user's identity and applicable ownership, group, and access-control rules. It then permits or rejects the operation. For concurrent modifications, applications may use locks, transactions, or synchronization mechanisms to coordinate updates and avoid inconsistent results. The precise behaviour depends on the filesystem and access protocol.

Two Users Editing a Shared Report

Suppose Ali and Sara both have read permission for a shared report, but only Ali has write permission. Both can open and examine the document, while Sara's attempt to modify it is rejected. An administrator may later grant Sara write access, after which concurrent editing must still be coordinated to prevent conflicting updates.

Collaboration, Permissions and Consistency Risks

Multi-user sharing supports collaboration, centralised resources, and efficient storage use. However, weak permissions can expose confidential information, while simultaneous updates may cause lost changes or inconsistent results. Locking and access-control mechanisms address different problems: permissions determine who may operate on a file, whereas synchronization coordinates how permitted operations interact.

Distinguishing Sharing Permissions from File Locks

'Read permission automatically grants write access' is incorrect because read and write rights are separate. 'A file lock determines user ownership' is incorrect because locking coordinates concurrent operations rather than identifying ownership. 'Shared access guarantees consistent simultaneous updates' is incorrect because applications still need suitable locking, transactional, or synchronization mechanisms.

Exam Focus: User Rights and Concurrent File Sharing

Determine whether a user can read, write, execute, or delete a file under supplied ownership and permission rules. Explain group-based sharing and access-control lists. Distinguish access permissions from file locking and concurrency control. Questions may also assess how simultaneous updates can produce lost changes and why shared-directory permissions affect file creation and deletion.

Key Terms of Multi-User File Sharing

  • Owner - User associated with a file.
  • Group - Collection of authorised users.
  • Read permission - Allows content retrieval.
  • Write permission - Allows content modification.
  • File locking - Coordinates concurrent access.
  • Concurrency - Overlapping operations.
2
Easy
5
Medium
4
Hard

📝 All Multiple users in File Sharing in Operating System MCQs

Q1. What term describes a data structure that holds the first key of each block to enable fast location of records?

A.Pointer
B.Index ✅
C.Buffer
D.Cache
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The structure is called an index because it stores the first key (e.g., the first UPC) of each block, acting like a book index. This allows the system to jump directly to the block containing a desired record, avoiding a full scan. A pointer is a single address, not a collection of keys; a buffer temporarily holds data; a cache stores frequently used data but does not provide ordered keys. Hence, the correct answer is Index, which directly supports fast block location.

Q2. A file contains 120,000 records, each 16 bytes. If each disk block holds 1,024 bytes, how many blocks are required to store the file?

A.1875
B.2000 ✅
C.2125
D.2250
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: First compute total bytes: 120,000×16=1,920,000120{,}000 \times 16 = 1{,}920{,}000 bytes. Divide by block size: 1,920,000÷1,024≈1,8751{,}920{,}000 \div 1{,}024 \approx 1{,}875 blocks, but because a block cannot be partially used, we round up to the next whole block, giving 2,000 blocks. The other options either omit the rounding step or mis‑calculate the total size. Therefore, 2,000 blocks is the correct answer.

Q3. Why does keeping an index in memory reduce I/O operations when searching a large file?

A.Because the index eliminates the need to read any data blocks ✅
B.Because the index allows the system to locate the correct block with a single disk read
C.Because memory is faster than disk, so all I/O is avoided
D.Because the index compresses the file size
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Keeping the index in RAM means the CPU can compare keys without accessing the disk. Once the correct block is identified, only that single block needs to be read, dramatically cutting I/O. Option A is false because data blocks still must be read; option B is partially true but still requires a disk read for the block; option D misstates the purpose of an index. Thus, the primary benefit is reduced I/O due to fast in‑memory lookup.

Q4. What is the main drawback of storing the entire index in memory for very large files?

A.The index becomes too large to fit in available RAM
B.The index becomes slower to search than a disk‑based index
C.Memory indexes cannot be updated dynamically ✅
D.Storing an index in memory increases disk usage
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: When a file grows, the number of index entries grows proportionally. Eventually the index may exceed the size of the computer’s RAM, causing swapping or failure to load the index entirely. This memory pressure negates the speed advantage. Options B and D are incorrect because memory lookups are inherently faster and do not affect disk usage; option C is false because memory indexes can be updated, though they may require additional synchronization.

Q5. How does a multi‑level index (index of index) improve search performance compared to a single‑level index?

A.It reduces the number of disk accesses by first locating a secondary index block, then the data block
B.It eliminates the need for any disk access ✅
C.It stores the entire file in memory
D.It doubles the size of the index for redundancy
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A multi‑level index adds a top‑level (primary) index that points to secondary index blocks. The search first reads a small primary block, then a secondary block that points to the data block, cutting the total disk reads from many to just a few. Option B is impossible because at least one data block must be read; option C misrepresents the purpose of indexing; option D describes redundancy, not performance. Therefore, the hierarchical lookup is the key performance gain.

Q6. A file of 120,000 records has an index of 2,000 entries. Using binary search on the index, what is the maximum number of index reads required to locate the correct block?

A.5
B.10
C.11
D.12 ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Binary search requires ⌈log⁡22,000⌉\lceil \log_2 2{,}000 \rceil comparisons. Since 211=2,0482^{11}=2{,}048 exceeds 2,000, the worst‑case number of steps is 11. Each step may involve reading an index block if the index is not cached, so the maximum index reads equals 11. Options A and B underestimate the logarithm; option D adds an extra step that is not needed. Hence, 11 reads is the correct worst‑case count.

Q7. In a two‑level indexing scheme where each secondary index covers 100 data blocks, a file occupies 2,000 data blocks. How many secondary index blocks are needed and what is the size of the primary index if each pointer occupies 4 bytes?

A.20 secondary blocks, 80‑byte primary ✅
B.10 secondary blocks, 40‑byte primary
C.25 secondary blocks, 100‑byte primary
D.40 secondary blocks, 160‑byte primary
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Each secondary index handles 100 data blocks, so 2,000÷100=202{,}000 \div 100 = 20 secondary blocks are required. The primary index stores one pointer per secondary block, giving 20 pointers. At 4 bytes per pointer, the primary index size is 20×4=8020 \times 4 = 80 bytes. The other options miscalculate either the count of secondary blocks or the pointer size, leading to incorrect totals.

Q8. When retrieving a single record, how many disk I/O operations does a sequential‑simulation on a direct‑access file typically require compared to an indexed sequential‑access method?

A.2,000 vs 2
B.2,000 vs 12
C.2 vs 2,000
D.12 vs 2,000 ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: A sequential simulation may need to read every block up to the target, worst‑case 2,000 reads for a 2,000‑block file. An indexed sequential method first performs a binary search on the index (≈11 reads) and then reads the data block (1 read), totaling about 12 I/O operations. Options A and C reverse the counts; option D suggests both methods require the same number, which is inaccurate. Therefore, the indexed method dramatically reduces I/O to roughly 12 reads.

Q9. Multiple users concurrently read and write a direct‑access file that uses a shared in‑memory index. Which concurrency control technique best prevents lost updates while maintaining high throughput?

A.Strict two‑phase locking ✅
B.Optimistic concurrency with version numbers
C.Read‑only lock for all operations
D.No locking at all
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Optimistic concurrency allows users to proceed without acquiring locks, checking a version number before committing changes. If a conflict is detected, the transaction is rolled back and retried, which reduces lock contention and keeps throughput high. Strict two‑phase locking (A) would serialize access, hurting performance; a read‑only lock (C) blocks writes; no locking (D) risks lost updates. Hence, optimistic concurrency with version numbers is the most balanced solution.

Q10. In ISAM, what is the primary function of the master index?

A.It stores the actual data records
B.It contains pointers to secondary index blocks
C.It caches frequently accessed records ✅
D.It compresses the data file
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The master (or primary) index in ISAM holds pointers to secondary index blocks, forming a two‑level lookup hierarchy. When searching, the system first reads the master index to locate the appropriate secondary block, then uses that block to find the data record. Options A and D describe data storage, not indexing; option C describes caching, which is unrelated to the master index’s role. Therefore, the master index’s purpose is to point to secondary index blocks.

Q11. Given a block size of 1,024 bytes, a record size of 16 bytes, and an index entry size of 10 bytes, does the entire index for a 2,000‑block file fit into 64 KB of RAM?

A.Yes, 20 KB
B.No, 20 KB exceeds the limit
C.Yes, 40 KB ✅
D.No, 80 KB exceeds the limit
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The index has one entry per block, so 2,000×10=20,0002{,}000 \times 10 = 20{,}000 bytes, which is roughly 20 KB. Since 64 KB of RAM is available, the index comfortably fits with room to spare. Options B and D incorrectly claim the index exceeds memory, and option C overestimates the size. Thus, the correct answer is that the index fits, using about 20 KB.

🔗 Related Topics (MCQs)