Skip to main content

Must-know Operating systems interview questions

5 reported frequent at Databricks, Cognizant and Wipro. “Reported” because the company tags have no public source. Every quick answer is free.

Questions on this page
5
Must know
0
picked by the editor
Reported frequent
5
company tags, reported
Companies
3
with a frequent tag

Reported frequent· 5

Tagged as frequent at a company. Reported: the tags have no public source.

  1. Implement a thread-safe asynchronous logger in Java that lets many threads write log entries concurrently while a single writer thread flushes them to disk efficiently.Use a bounded BlockingQueue: producer threads enqueue entries in memory, one writer thread drains batches and writes them to disk. Choose block (backpressure) or drop-with-counter when full, and stop with a poison pill so the writer drains everything before exit.Advanced₹499 (Pro plan required)Reported frequent at Databricks
  2. What is the difference between a process and a thread?Process: own address space and resources, isolated, heavier, needs IPC. Thread: runs inside a process sharing its memory, own stack/registers, cheaper, needs synchronisation.BeginnerFreeReported frequent at Cognizant
  3. Implement a bounded blocking queue (producer-consumer) from scratch using locks and condition variables.Fixed buffer guarded by one lock and two condition variables (notFull, notEmpty); put/take wait in while loops (never if, to handle spurious wakeups) and signal after mutating state. Use notifyAll or two separate Conditions to avoid deadlock. O(1) per op; handle shutdown with a poison pill.Advanced₹99 (Interview Prep or Pro plan required)Reported frequent at Databricks
  4. Implement a thread-safe rate limiter in Java that allows at most N operations per second, callable safely from many threads.For a strict limit of at most N per second, use a synchronized sliding-window log: keep timestamps of accepted calls, drop those older than 1 second, accept only if fewer than N remain. A token bucket is cheaper (O(1) memory) but allows bursts above N in one window.Advanced₹499 (Pro plan required)Reported frequent at Databricks
  5. How can deadlocks be prevented, avoided, detected and recovered from?Prevent by breaking a Coffman condition (e.g. global lock ordering, all-at-once requests); avoid with safe-state checks (Banker's algorithm); detect via cycles in a wait-for graph; recover by aborting/rolling back victims.Intermediate₹99 (Interview Prep or Pro plan required)Reported frequent at Wipro

Reported frequent at

Must-know questions for other tools