Interview Q&A / Operating Systems

INTERVIEW Q&A · 42 QUESTIONS

Operating Systems interview questions

Processes, threads, scheduling, memory and deadlocks, in plain words.

  1. A system has 32-bit logical addresses and 4 KB pages. How many bits are the page number and offset, and how large is the page table?

    4 KB = 2^12, so the offset is 12 bits and the page number is 32 - 12 = 20 bits. That gives 2^20 entries; at 4 bytes each, the page table is 4 MB per process.

    IntermediateQuick answer1 min read
  2. Given a segment table, how do you translate the logical address (1, 500)?

    Look up segment 1, compare the offset with its limit, and add the offset to its base. If the offset is not below the limit the hardware traps. With limit 400 here, (1, 500) is invalid; (0, 500) maps to 1900.

    IntermediateQuick answer1 min read
  3. What does a page table entry contain besides the frame number?

    Besides the frame number, an entry holds control bits: valid/present, read/write/execute permissions, a user/supervisor bit, a dirty (modified) bit and an accessed (reference) bit.

    IntermediateQuick answer2 min read
  4. Why do operating systems use multi-level page tables?

    A single flat page table needs an entry for every possible page, even unused ones. A multi-level table splits it into pieces and only allocates the pieces for regions actually in use, saving a large amount of memory.

    IntermediateQuick answer1 min read