Interview Q&A / Operating Systems

INTERVIEW Q&A · 42 QUESTIONS

Operating Systems interview questions

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

  1. What is the dining philosophers problem and how can it be solved?

    Five philosophers sit round a table with five forks, and each needs two adjacent forks to eat. If all pick up their left fork together, everyone waits forever. Solutions include a fork ordering, a limit of four seated, or an asymmetric pickup.

    IntermediateQuick answer1 min read
  2. 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
  3. How does the Banker's algorithm decide whether a resource request is safe?

    It pretends to grant the request, then checks whether some order exists in which every process can still finish with the resources left. If such a safe sequence exists, the request is granted; otherwise it waits.

    AdvancedQuick answer2 min read
  4. What is the Test-and-Set instruction and how does it provide mutual exclusion?

    Test-and-Set is a hardware instruction that atomically reads a memory flag and sets it to 1. If it returned 0, the caller got the lock; if 1, someone else holds it. Because it is one indivisible step, two threads cannot both see 0.

    AdvancedQuick answer1 min read