🎓 BookMCQ
← Back to 1. Introduction to Operating System

📝 Introduction to Kernel Data Structures in Operating Systems (30 MCQs)

Kernel Information Structures and System State Management

Kernel data structures organise the information required to manage processes, memory, files, devices, and other operating system resources. They allow kernel routines to locate, update, and coordinate system objects efficiently. Common structures include linked lists, queues, trees, hash tables, bitmaps, and arrays. Their selection affects lookup speed, allocation overhead, memory consumption, and the complexity of maintaining consistent system state.

Why Efficient Data Organisation Matters in Kernel Operations

The kernel frequently searches for processes, tracks available memory frames, manages open files, and handles pending I/O requests. Poorly chosen structures can increase lookup time or make updates expensive, particularly under heavy workloads. Different operations require different access patterns, so the kernel selects structures according to search frequency, insertion and deletion costs, ordering requirements, and concurrency constraints.

Lists, Queues, Trees, Hash Tables, and Bitmaps

Linked lists connect dynamically allocated elements and support flexible insertion and removal. Queues organise requests in arrival or priority order, while balanced trees support ordered searches and updates. Hash tables provide efficient average-case lookup through computed keys. Bitmaps represent resource availability using individual bits, and arrays provide direct indexing when identifiers or positions are suitably organised.

Tracking Free Memory Frames with a Bitmap

Suppose physical memory contains 64 frames, and each bitmap bit represents one frame. A bit value of zero may indicate a free frame, while one indicates an allocated frame, according to the implementation's convention. The memory manager searches for a zero bit, marks the corresponding frame allocated, and updates the bitmap when that frame becomes free.

Lookup Complexity, Memory Overhead, and Concurrency

Appropriate data structures reduce search and update costs in heavily used kernel paths. Hash tables can provide average-case constant-time lookup, while balanced search trees offer logarithmic operations. However, collisions, resizing, locking, and memory allocation introduce overhead. Concurrent kernel operations also require synchronisation to prevent inconsistent updates, making correctness as important as algorithmic efficiency.

Misconceptions About Kernel Data Structure Behaviour

'A linked list always provides faster searching than an array' is incorrect because linked-list searches are generally linear, while indexed arrays provide direct access. 'A hash table guarantees constant-time lookup' is incorrect because collisions can increase search costs. 'A bitmap stores complete resource descriptions' is incorrect because it primarily represents states using individual bits.

Exam Focus: Data Structure Selection and Complexity

Be prepared to select suitable structures for ready queues, free-frame tracking, process lookup, and ordered resource management. Calculate bitmap storage requirements and compare the search, insertion, and deletion complexities of arrays, lists, queues, trees, and hash tables. Questions may also examine collision handling, resource-state updates, and synchronisation during concurrent kernel operations.

Key Terms of Kernel Data Structures

  • Linked list - Dynamically connected collection of elements.
  • Queue - First-in-first-out ordered collection.
  • Tree - Hierarchical structure of connected nodes.
  • Hash table - Key-based structure supporting fast lookup.
  • Bitmap - Compact representation of resource states.
  • Collision - Multiple keys sharing a hash location.
10
Easy
10
Medium
10
Hard

📝 All Introduction to Kernel Data Structures in Operating Systems MCQs

Q1. A kernel needs to maintain information about every active process, including its state, saved registers, program counter, scheduling information, and allocated resources. Which data structure represents this information for an individual process?

A.File control block
B.Process control block ✅
C.Interrupt vector
D.Page directory
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: A process control block stores execution state, saved registers, program counter, scheduling information, and resource references needed to manage a process. The tempting source-code option is wrong because code is not process-control metadata.

Q2. A kernel maintains several runnable processes waiting for CPU time. Which data structure is most appropriate for managing processes that should be dispatched in arrival order?

A.Stack
B.Hash table
C.Queue ✅
D.Binary search tree
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A ready queue contains runnable processes waiting for processor service. FIFO removes the earliest enqueued process first. The tempting wait-queue option is wrong because blocked processes cannot run until their awaited event occurs.

Q3. A kernel frequently inserts and removes process descriptors from a collection. It already has a pointer to the descriptor being removed. Which structure supports efficient insertion and deletion when the relevant node is already known?

A.Doubly linked list ✅
B.Unsorted array
C.Static bitmap
D.Sequential file
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A doubly linked list allows insertion and deletion in constant time when the target node is already known. The tempting array option generally requires shifting elements after removal, making such updates more expensive.

Q4. A kernel frequently searches for a process using its unique process identifier. Which data structure can provide efficient average-case lookup when an appropriate hash function is available?

A.Stack
B.Hash table ✅
C.Circular queue
D.Linear array
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: A hash table maps process identifiers to locations using a hash function, supporting efficient average-case lookup. The tempting linear-array option requires scanning entries individually and becomes increasingly expensive as the process collection grows.

Q5. A kernel manages 8192 physical memory frames and maintains one bit for each frame to indicate whether it is available or occupied. Which structure is being used?

A.Linked list
B.Binary search tree
C.Priority queue
D.Bitmap ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: A bitmap represents each frame using one bit indicating whether it is free or occupied. The tempting linked-list option can track free frames, but it does not provide the specified one-bit-per-frame representation.

Q6. A processor handles an interrupt while another kernel operation is already executing. The kernel must preserve the current sequence of execution and later resume it correctly. Which data structure naturally supports this nested execution state?

A.Queue
B.Hash table
C.Stack ✅
D.Bitmap
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A stack follows last-in, first-out ordering, making it suitable for nested function calls and saved execution contexts. The tempting queue option removes entries in arrival order and cannot directly support nested return sequencing.

Q7. A kernel receives file descriptor 12 from an application and must locate the corresponding open-file information efficiently. Which structure normally maps this descriptor number to an open-file object?

A.Process file descriptor table ✅
B.Ready queue
C.Interrupt stack
D.Free-frame bitmap
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A process file descriptor table maps descriptor numbers to references to open-file objects. The tempting ready-queue option manages runnable processes, not file references; descriptor lookup uses the process-associated table.

Q8. A kernel implements a fixed-size circular buffer for incoming device events. The implementation reserves one array slot to distinguish a full buffer from an empty buffer. If the array contains 16 slots, how many events can it hold simultaneously?

A.14
B.15 ✅
C.16
D.17
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Reserving one slot avoids ambiguity between equal head and tail positions, leaving 16−1=1516-1=15 usable slots. The tempting 16-event answer assumes an additional count or full indicator is maintained.

Q9. A kernel must maintain relationships between parent processes and their child processes. Which structure most naturally represents these hierarchical relationships?

A.Stack
B.Hash table
C.Circular buffer
D.Tree ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: A tree represents parent-child relationships through hierarchical nodes and edges. The tempting hash-table option supports key-based lookup, but it does not inherently preserve the parent-child organization needed to navigate process ancestry.

Q10. Several kernel threads are sleeping while waiting for a particular disk operation to complete. Which kernel data structure helps organize these sleeping threads until the relevant event occurs?

A.Ready queue
B.Hash table
C.Wait queue ✅
D.Page directory
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A wait queue holds threads sleeping until a specified event or condition becomes satisfied. The tempting ready-queue option contains runnable threads, whereas these threads cannot execute until their awaited disk operation completes.

Q11. A system maintains a bitmap for 32768 physical memory frames, using exactly one bit per frame. How many bytes are required for this bitmap?

A.2048 bytes
B.4096 bytes ✅
C.8192 bytes
D.32768 bytes
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Each frame needs one bitmap bit, so 32768 frames require 32768 bits. Dividing by eight gives 4096 bytes, equal to 4 KiB. The tempting 32768-byte answer treats bits as bytes.

Q12. A kernel uses a circular queue with eight array slots and reserves one slot to distinguish full from empty. After six successful insertions without removals, what is the queue's remaining usable capacity?

A.One element ✅
B.Three elements
C.Two elements
D.Zero elements
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The queue can hold seven elements because one of its eight slots is reserved. After six insertions, only one usable position remains; the tempting two-element answer incorrectly assumes all eight slots are available.

Q13. A kernel maintains process descriptors in a doubly linked list. It receives a pointer to a descriptor that must be removed. Assuming valid neighboring pointers, what is the time complexity of removing that descriptor?

A.O(1)O(1) ✅
B.O(n)O(n)
C.O(nlogn)O(n\\log n)
D.O(n2)O(n^2)
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: With a pointer to the target node, the kernel updates its previous and next links directly. This requires constant work, O(1)O(1); the tempting linear-time answer includes searching for the node, which is unnecessary.

Q14. A kernel uses the hash function h(k)=kbmod5h(k)=k\\bmod5 to organize process identifiers. Three identifiers are 12, 17, and 22. Which bucket receives all three identifiers when separate chaining is used?

A.Bucket 0
B.Bucket 1
C.Bucket 2 ✅
D.Bucket 4
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: All three identifiers have remainder two when divided by five: 12bmod5=212\\bmod5=2, 17bmod5=217\\bmod5=2, and 22bmod5=222\\bmod5=2. Therefore bucket 2 contains their chain; the tempting bucket 4 has no matching remainder.

Q15. A kernel stores memory-region descriptors in a balanced binary search tree. A process has 4095 descriptors. What is the expected worst-case search complexity for locating a descriptor by its ordered key?

A.O(1)O(1)
B.O(logn)O(\\log n) ✅
C.O(n2)O(n^2)
D.O(nlogn)O(n\\log n)
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: A balanced search tree maintains logarithmic height, so finding a descriptor requires examining approximately O(logn)O(\\log n) nodes. The tempting linear-time option describes an unbalanced or sequential structure rather than a balanced tree.

Q16. A kernel scheduler must repeatedly insert runnable tasks and remove the highest-priority task. Which data structure is particularly suitable when efficient priority-based insertion and extraction are required?

A.Unordered linked list only
B.Bitmap of process identifiers
C.Ordinary FIFO queue
D.Binary heap ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: A binary heap maintains priority ordering while supporting insertion and removal of the highest-priority element in logarithmic time. The tempting FIFO queue selects by arrival order, not by priority.

Q17. Two kernel subsystems share a reference-counted memory object. Its reference count is initially two. One subsystem releases its reference. What should the kernel do?

A.Reduce the count to zero immediately
B.Increase the count to three
C.Reduce the count to one and retain the object ✅
D.Delete the object immediately
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Releasing one of two references changes the count from two to one, so another subsystem still owns it. The tempting immediate deletion is incorrect because the object must remain available until its reference count reaches zero.

Q18. A kernel implements a single-producer, single-consumer ring buffer. The producer writes event data into a free slot and then advances the published write index. Why must the data be stored before the index is published?

A.To ensure the consumer never observes a published entry before its contents are ready ✅
B.To force the buffer to become permanently full
C.To prevent the producer from using consecutive slots
D.To increase the number of hash collisions
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Publishing the index after storing data ensures the consumer does not read an incomplete event. The tempting reverse ordering can expose uninitialized contents, especially when compiler or processor memory reordering occurs.

Q19. A kernel monitoring tool records the number of entries in a wait queue: Time 0: 3 entries ; Time 1: 5 entries ; Time 2: 8 entries ; Time 3: 6 entries ; Time 4: 4 entries. At which time is the queue longest?

A.Time 0
B.Time 1
C.Time 3
D.Time 2 ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The recorded queue length reaches its maximum of eight entries at time 2. The tempting time 3 answer identifies a later measurement, but the queue has already decreased from eight to six entries.

Q20. A kernel uses a hash table with six buckets to store 18 process-related objects. Assuming uniform distribution, what is the average load factor?

A.2
B.3 ✅
C.6
D.18
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The load factor is the number of stored entries divided by the number of buckets: 18/6=318/6=3. This means three entries per bucket on average; the tempting six reverses the ratio.

Q21. A kernel hash table uses separate chaining. Due to a poor hash function, every one of its 1000 entries maps to the same bucket. What is the worst-case lookup complexity?

A.O(1)O(1)
B.O(logn)O(\\log n)
C.O(n)O(n) ✅
D.O(nlogn)O(n\\log n)
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: When every entry maps to one bucket, lookup may require examining all 1000 chained entries. Its worst-case complexity becomes O(n)O(n); the tempting constant-time answer assumes collisions remain sufficiently distributed.

Q22. A kernel stores non-overlapping virtual memory regions in a balanced search tree, ordered by starting address. It searches for the region containing a specified virtual address. Which approach gives the appropriate search complexity?

A.Inspect every region sequentially
B.Sort the entire tree before every lookup
C.Follow the parent process hierarchy
D.Find the greatest starting address not exceeding the target and check its ending address ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Because regions are ordered and non-overlapping, the kernel can find the greatest starting address not exceeding the target using a balanced-tree search. Checking its endpoint determines containment; scanning every region is unnecessarily linear.

Q23. Two processors simultaneously scan a kernel free-frame bitmap and both observe that frame 40 is available. Both attempt to allocate it. Which mechanism prevents both processors from successfully claiming the same frame?

A.Atomic bit testing and setting or an appropriate lock ✅
B.Increasing the number of bitmap bits
C.Using a FIFO ready queue
D.Sorting all process identifiers
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: An atomic test-and-set or correctly protected bitmap update ensures only one processor claims the available frame. The tempting ordinary bit check is insufficient because both processors may observe the same old value concurrently.

Q24. A kernel developer inserts node N between nodes A and B in a singly linked list. The developer executes A.next=N followed by N.next=A.next. What is the error?

A.The insertion creates a correctly ordered list
B.The new node becomes its own successor because A.next was overwritten first ✅
C.Node B is automatically removed from memory
D.The list is converted into a binary tree
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The flawed step overwrites A.next before preserving B, so N.next subsequently points to N itself. The correct order saves the old successor first, assigns N.next to B, then changes A.next to N.

Q25. A circular queue has six array slots. Its front index identifies the first item, and its tail identifies the next insertion position. Initially front=4, tail=4, count=0. The kernel enqueues A, B, and C, dequeues A, then enqueues D and E. Which state is correct?

A.front=4, tail=3, count=4
B.front=0, tail=4, count=4
C.front=5, tail=3, count=4 ✅
D.front=5, tail=4, count=5
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Insertions occupy indexes 4, 5, and 0, advancing tail to 1. Removing A advances front to 5; inserting D and E advances tail to 3, leaving four entries.

Q26. A kernel hash table records chain lengths as follows: Bucket 0: 2 entries ; Bucket 1: 5 entries ; Bucket 2: 1 entry ; Bucket 3: 4 entries ; Bucket 4: 3 entries. Which bucket requires the most node examinations for a complete unsuccessful chained lookup?

A.Bucket 0
B.Bucket 1 ✅
C.Bucket 2
D.Bucket 3
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: An unsuccessful lookup in separate chaining examines every entry in the selected bucket. Bucket 1 has five entries, the largest chain shown; the tempting bucket 3 contains only four entries.

Q27. A multicore kernel maintains a separate runnable-task queue for each processor instead of placing all tasks in one global queue. What is the main benefit of this organization?

A.Every processor must acquire the same global queue lock
B.All processes are forced to execute on processor zero
C.Local queues eliminate the need for any scheduling decisions
D.Reduced contention on shared scheduling structures ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Per-processor queues reduce contention because processors can manipulate their local runnable-task structures independently. The tempting global-lock design increases coordination; load balancing may still be needed when one processor becomes overloaded.

Q28. A kernel thread is interrupted during a function call, and a nested interrupt handler executes before the original handler completes. Why does the kernel maintain an appropriate kernel stack for each executing thread?

A.To store all files opened by the thread permanently
B.To preserve nested call frames, return addresses, and local execution state independently ✅
C.To replace the process identifier with a memory address
D.To eliminate the need for process control blocks
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A kernel stack preserves function frames, return addresses, and local variables during nested execution. The tempting file-storage option confuses execution context with persistent file metadata, which belongs in separate kernel structures.

Q29. A kernel manages 1024 physical blocks using a two-level bitmap. Each second-level bitmap word describes 32 blocks, and one summary bit indicates whether each word contains a free block. The summary identifies word 19, whose first available position is bit 7. Which block number is free, using zero-based indexing?

A.615 ✅
B.607
C.608
D.631
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Word 19 covers blocks starting at 19times32=60819\\times32=608. Adding bit position 7 gives 608+7=615608+7=615. The tempting 607 subtracts instead of adding the zero-based position within the identified word.

Q30. A process descriptor participates simultaneously in the kernel's global process list and its parent's child-process list. Why might the descriptor contain separate linked-list pointers for these relationships?

A.A node can belong to multiple independent lists without one relationship overwriting the other's linkage ✅
B.Separate pointers automatically increase CPU scheduling priority
C.Every linked list must contain exactly one process
D.A process cannot have a parent when it has a global-list entry
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Separate linkage fields allow the same descriptor to participate in multiple independent lists simultaneously. Reusing one pair of pointers would corrupt one relationship when the other list changes; the tempting single-link design is unsafe.

🔗 Related Topics (MCQs)