Operating Systems interview questions and quick answers
Processes, threads, scheduling, memory and deadlocks, in plain words.
Review 772 questions and short answers on Operating Systems. Start with real examples below, then search, practise and follow links to full explanations.
Operating Systems: questions worth revising first
These answers come from AI Tapri's existing question bank and published interview guides. Open each answer and read the linked in-depth guide for examples and context.
01How 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.
Read the full explanation02What 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.
Read the full explanation03What is context switching in an operating system?
Context switching is when the OS pauses the process or thread running on a CPU, saves its state (registers, program counter, stack pointer) in its control block, and loads the saved state of another one so it can continue. It lets many programs share one CPU, but each switch is pure overhead.
Read the full explanation04What is the convoy effect in FCFS scheduling?
The convoy effect is when many short processes queue behind one long CPU-bound process, so the CPU and I/O devices sit idle in turns and average waiting time rises sharply.
Read the full explanation05What is a counting semaphore and when would you use one?
A counting semaphore holds a non-negative integer that tracks how many units of a resource are free. wait() takes one unit (blocking at zero) and signal() returns one. It limits how many threads use a pool at once.
Read the full explanation06What are the FCFS, SJF, Round Robin and Priority CPU scheduling algorithms, and how do you calculate waiting time?
FCFS runs processes in arrival order, SJF picks the shortest job next and gives the lowest average waiting time, Round Robin gives each process a fixed time slice in turn for fair response, and Priority runs the most important process first but can starve low-priority ones unless aging is used.
Read the full explanation07What is a common pitfall related to "How does the Banker's algorithm decide whether a resource request is safe"?
Confusing unsafe state with deadlock. Unsafe only means deadlock is possible.
Read the full explanation08How would you explain "How does the Banker's algorithm decide whether a resource request is safe" in an interview?
"Banker's algorithm tentatively allocates, then looks for a safe sequence: repeatedly find a process whose remaining need fits in the available resources, let it finish and reclaim its holdings. If all can finish, the request is granted. It avoids deadlock but needs maximum needs declared upfront."
Read the full explanationFind your next answer.
Pick a topic, search a keyword, or open a question to reveal the answer.
Operating Systems quick answers
Free to practise. No account needed. Made for quick revision, not rote memorisation.
Keep preparing for Operating Systems
Quick answers help with recall; detailed guides explain the reasoning, examples and common mistakes behind each answer.