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 a condition variable and why does wait() release the lock?

    A condition variable lets a thread sleep until some condition becomes true. wait() atomically releases the lock and sleeps so other threads can change the state; on wakeup the thread reacquires the lock and rechecks.

    IntermediateQuick answer1 min read
  2. What is a monitor in operating systems, and how is it different from a semaphore?

    A monitor bundles shared data with the procedures that access it, and the language guarantees only one thread is inside at a time. A semaphore is a bare counter that the programmer must use correctly everywhere.

    IntermediateQuick answer1 min read