Operating System Interview Questions and Answers
Operating systems fundamentals that come up in technical rounds, with clear answers.
Q1. What is the difference between a process and a thread?
- A. Threads of a process share its memory; processes have separate memory
- B. Processes are faster to create
- C. There is no difference
- D. Threads cannot run in parallel
Show answerHide answer
Answer: A. Threads of a process share its memory; processes have separate memory
That's why threads are lighter but need synchronisation.Q2. Which scheduling algorithm can cause starvation of long jobs?
- A. None of them
- B. Round Robin
- C. First Come First Served
- D. Shortest Job First
Show answerHide answer
Answer: D. Shortest Job First
Short jobs keep jumping ahead, so long ones may wait forever. Aging fixes it.Q3. Round Robin scheduling uses:
- A. Random selection
- B. Priorities only
- C. A fixed time slice (quantum) for each process in turn
- D. The shortest job first
Show answerHide answer
Answer: C. A fixed time slice (quantum) for each process in turn
It's fair and good for time-sharing systems.Q4. A deadlock requires which four conditions?
- A. Read, write, execute, delete
- B. Mutual exclusion, hold and wait, no preemption, circular wait
- C. Paging, segmentation, swapping, caching
- D. Starvation, aging, priority, quantum
Show answerHide answer
Answer: B. Mutual exclusion, hold and wait, no preemption, circular wait
Breaking any one condition prevents deadlock.Q5. Virtual memory allows:
- A. Faster CPUs
- B. More cores
- C. Unlimited disk space
- D. Programs to use more memory than physically available, using disk
Show answerHide answer
Answer: D. Programs to use more memory than physically available, using disk
Pages not in use are swapped out to disk.Q6. A page fault occurs when:
- A. A program accesses a page that isn't in RAM
- B. Two processes share memory
- C. The disk is full
- D. The CPU overheats
Show answerHide answer
Answer: A. A program accesses a page that isn't in RAM
The OS loads the page from disk and resumes the program.Q7. What is thrashing?
- A. The system spends more time swapping pages than doing work
- B. Fast context switching
- C. A hardware failure
- D. A virus
Show answerHide answer
Answer: A. The system spends more time swapping pages than doing work
Too many processes for too little RAM.Q8. A semaphore is used for:
- A. Network routing
- B. Controlling access to shared resources between processes or threads
- C. Compiling code
- D. Storing files
Show answerHide answer
Answer: B. Controlling access to shared resources between processes or threads
Wait (P) and signal (V) operations coordinate access.Q9. A mutex differs from a counting semaphore in that it:
- A. Is only for files
- B. Allows unlimited holders
- C. Is a type of scheduler
- D. Allows only one holder at a time and is owned by the locker
Show answerHide answer
Answer: D. Allows only one holder at a time and is owned by the locker
A counting semaphore can allow N simultaneous holders.Q10. What is a context switch?
- A. Changing the user's language
- B. Restarting the computer
- C. Switching between files
- D. Saving one process's state and loading another's
Show answerHide answer
Answer: D. Saving one process's state and loading another's
It has overhead, so too many switches slow the system.Q11. Which memory is fastest?
- A. Hard disk
- B. SSD
- C. RAM
- D. CPU registers
Show answerHide answer
Answer: D. CPU registers
Registers → cache → RAM → SSD → HDD, from fastest to slowest.Q12. The kernel is:
- A. The core of the OS that manages CPU, memory and devices
- B. The BIOS
- C. A user application
- D. A type of file
Show answerHide answer
Answer: A. The core of the OS that manages CPU, memory and devices
It runs in privileged mode.Q13. A zombie process is:
- A. A finished process whose parent hasn't collected its exit status
- B. A paused process
- C. A virus
- D. A process using 100% CPU
Show answerHide answer
Answer: A. A finished process whose parent hasn't collected its exit status
It holds an entry in the process table until the parent calls wait().Q14. Which page replacement algorithm replaces the page not used for the longest time?
- A. Random
- B. FIFO
- C. Optimal
- D. LRU (Least Recently Used)
Show answerHide answer
Answer: D. LRU (Least Recently Used)
Optimal replaces the page used farthest in the future, which can't be known in practice.Q15. A race condition occurs when:
- A. A loop never ends
- B. The result depends on the timing of threads accessing shared data
- C. The CPU runs too fast
- D. Two programs compete in speed tests
Show answerHide answer
Answer: B. The result depends on the timing of threads accessing shared data
Protect shared data with locks.Q16. Paging divides memory into:
- A. Threads
- B. Files
- C. Variable-size segments
- D. Fixed-size blocks
Show answerHide answer
Answer: D. Fixed-size blocks
Fixed-size pages avoid external fragmentation.Q17. What is a system call?
- A. A phone call
- B. A hardware interrupt only
- C. A function inside the program
- D. A request from a program to the OS kernel for a service
Show answerHide answer
Answer: D. A request from a program to the OS kernel for a service
e.g. read(), write(), fork().Q18. fork() in Unix:
- A. Opens a file
- B. Creates a new child process
- C. Ends a process
- D. Creates a thread
Show answerHide answer
Answer: B. Creates a new child process
The child is a copy of the parent; fork returns 0 in the child.Q19. Internal fragmentation happens when:
- A. Allocated blocks are larger than needed, wasting space inside them
- B. The disk is full
- C. Files are deleted
- D. Free memory is split into small pieces
Show answerHide answer
Answer: A. Allocated blocks are larger than needed, wasting space inside them
External fragmentation is free memory scattered into unusable gaps.Q20. Which of these is NOT an operating system?
- A. Python
- B. Android
- C. Windows
- D. Linux
Show answerHide answer
Answer: A. Python
Python is a programming language; the others are operating systems.Q21. What is an operating system?
- A. A programming language
- B. A type of computer
- C. Software that manages hardware and provides services to programs
- D. A web browser
Show answerHide answer
Answer: C. Software that manages hardware and provides services to programs
Windows, Linux, macOS and Android are operating systems.Q22. What is the kernel?
- A. The core of the OS that manages CPU, memory and devices
- B. The user interface
- C. A text editor
- D. The BIOS
Show answerHide answer
Answer: A. The core of the OS that manages CPU, memory and devices
Programs ask the kernel for services through system calls.Q23. What is a system call?
- A. A function inside main()
- B. A hardware interrupt only
- C. A phone call to support
- D. A request from a program to the kernel, e.g. to open a file
Show answerHide answer
Answer: D. A request from a program to the kernel, e.g. to open a file
Examples: open, read, write, fork.Q24. What is the difference between a process and a thread?
- A. A thread is bigger than a process
- B. Processes share memory; threads don't
- C. Threads of a process share memory; processes have separate memory
- D. They are the same
Show answerHide answer
Answer: C. Threads of a process share memory; processes have separate memory
Threads are lighter to create and switch between.Q25. What is a context switch?
- A. Saving one process's state and loading another's on the CPU
- B. Restarting the computer
- C. Switching between two monitors
- D. Changing the OS
Show answerHide answer
Answer: A. Saving one process's state and loading another's on the CPU
It has overhead, so too many switches slow the system.Q26. Which scheduling algorithm runs the job that arrived first?
- A. SJF
- B. Round Robin
- C. FCFS (First Come First Served)
- D. Priority
Show answerHide answer
Answer: C. FCFS (First Come First Served)
Simple, but short jobs may wait behind long ones (convoy effect).Q27. Which scheduling algorithm gives the minimum average waiting time?
- A. FCFS
- B. Random
- C. Round Robin
- D. Shortest Job First (SJF)
Show answerHide answer
Answer: D. Shortest Job First (SJF)
But it needs to know burst times and can starve long jobs.Q28. What does Round Robin scheduling use?
- A. The shortest job first
- B. A fixed time quantum for each process in turn
- C. Priorities only
- D. No preemption
Show answerHide answer
Answer: B. A fixed time quantum for each process in turn
Fair and good for time-sharing systems.Q29. What is starvation?
- A. A process waiting indefinitely because others always get the CPU first
- B. A crash due to low power
- C. A process using too much memory
- D. A deadlock between two processes
Show answerHide answer
Answer: A. A process waiting indefinitely because others always get the CPU first
Ageing (raising priority over time) prevents it.Q30. Which four conditions must all hold for a deadlock?
- A. Starvation, ageing, paging, swapping
- B. Read, write, execute, delete
- C. Mutual exclusion, hold and wait, no preemption, circular wait
- D. Fork, exec, wait, exit
Show answerHide answer
Answer: C. Mutual exclusion, hold and wait, no preemption, circular wait
The Coffman conditions; break any one to prevent deadlock.Q31. What does the Banker's algorithm do?
- A. Allocates virtual memory pages
- B. Manages bank accounts
- C. Avoids deadlock by granting resources only if the system stays in a safe state
- D. Schedules processes by priority
Show answerHide answer
Answer: C. Avoids deadlock by granting resources only if the system stays in a safe state
Proposed by Dijkstra.Q32. What is a semaphore?
- A. A memory page
- B. A file system
- C. A type of process
- D. A counter used to control access to shared resources
Show answerHide answer
Answer: D. A counter used to control access to shared resources
wait (P) decrements, signal (V) increments.Q33. What is a mutex?
- A. A type of memory
- B. A lock that lets only one thread into a critical section
- C. A file permission
- D. A scheduling algorithm
Show answerHide answer
Answer: B. A lock that lets only one thread into a critical section
A binary semaphore with ownership.Q34. What is a race condition?
- A. Two programs competing for disk space
- B. A CPU overheating
- C. A fast-running loop
- D. When the result depends on the timing of concurrent threads
Show answerHide answer
Answer: D. When the result depends on the timing of concurrent threads
Protect shared data with locks.Q35. What is a critical section?
- A. Code that accesses shared data and must not run in two threads at once
- B. The boot sector
- C. The most important function
- D. A section of RAM reserved for the OS
Show answerHide answer
Answer: A. Code that accesses shared data and must not run in two threads at once
Solutions must give mutual exclusion, progress and bounded waiting.Q36. What is virtual memory?
- A. Memory inside the CPU
- B. Using disk space to extend RAM so programs can use more memory than physically exists
- C. Cloud storage
- D. Memory on a graphics card
Show answerHide answer
Answer: B. Using disk space to extend RAM so programs can use more memory than physically exists
Pages move between RAM and disk as needed.Q37. What is paging?
- A. Scrolling a document
- B. Dividing memory into fixed-size pages and frames
- C. Printing pages
- D. Dividing memory into variable-size segments
Show answerHide answer
Answer: B. Dividing memory into fixed-size pages and frames
Avoids external fragmentation.Q38. What is a page fault?
- A. A full hard disk
- B. Accessing a page that isn't currently in RAM
- C. A syntax error
- D. A broken memory chip
Show answerHide answer
Answer: B. Accessing a page that isn't currently in RAM
The OS loads the page from disk.Q39. What is thrashing?
- A. A process stuck in a loop
- B. The system spends more time swapping pages than running programs
- C. A disk being formatted
- D. Overclocking the CPU
Show answerHide answer
Answer: B. The system spends more time swapping pages than running programs
Caused by too little RAM for the running workload.Q40. Which page replacement algorithm replaces the page used longest ago?
- A. LRU (Least Recently Used)
- B. Optimal
- C. Random
- D. FIFO
Show answerHide answer
Answer: A. LRU (Least Recently Used)
Optimal replaces the page not needed for the longest time in future, but it's not practical.Q41. What is Belady's anomaly?
- A. A virus in memory
- B. A deadlock in paging
- C. Less RAM making programs faster
- D. More frames causing more page faults with FIFO
Show answerHide answer
Answer: D. More frames causing more page faults with FIFO
LRU and Optimal don't suffer from it.Q42. What is internal fragmentation?
- A. Wasted space inside an allocated block
- B. A corrupted file
- C. A broken partition
- D. Free space scattered between blocks
Show answerHide answer
Answer: A. Wasted space inside an allocated block
e.g. a 4 KB page holding 1 KB of data.Q43. What is external fragmentation?
- A. Unused space inside a page
- B. Too many open files
- C. Free memory split into small non-contiguous pieces
- D. A disk with bad sectors
Show answerHide answer
Answer: C. Free memory split into small non-contiguous pieces
Compaction or paging solves it.Q44. What is a TLB?
- A. A process scheduler
- B. A type of hard disk
- C. A network protocol
- D. A cache of recent page-table entries for fast address translation
Show answerHide answer
Answer: D. A cache of recent page-table entries for fast address translation
Translation Lookaside Buffer.Q45. What does fork() do in Unix?
- A. Splits a file
- B. Creates a new child process that is a copy of the parent
- C. Starts a thread
- D. Deletes a process
Show answerHide answer
Answer: B. Creates a new child process that is a copy of the parent
It returns 0 in the child and the child's PID in the parent.Q46. What is a zombie process?
- A. A finished process whose parent hasn't collected its exit status
- B. A virus
- C. A process using 100% CPU
- D. A process waiting for input
Show answerHide answer
Answer: A. A finished process whose parent hasn't collected its exit status
The parent must call wait().Q47. What is an orphan process?
- A. A process with no threads
- B. A process with no memory
- C. A process that never started
- D. A running process whose parent has exited
Show answerHide answer
Answer: D. A running process whose parent has exited
init/systemd adopts it.Q48. What is the difference between preemptive and non-preemptive scheduling?
- A. Preemptive can interrupt a running process; non-preemptive waits for it to finish or block
- B. They are the same
- C. Non-preemptive uses time slices
- D. Preemptive never interrupts
Show answerHide answer
Answer: A. Preemptive can interrupt a running process; non-preemptive waits for it to finish or block
Round Robin is preemptive; FCFS is non-preemptive.Q49. What is an interrupt?
- A. A crashed program
- B. A signal that makes the CPU pause and handle an event
- C. A slow network
- D. A deleted file
Show answerHide answer
Answer: B. A signal that makes the CPU pause and handle an event
e.g. a key press or a timer.Q50. What is DMA (Direct Memory Access)?
- A. A type of RAM
- B. A CPU instruction
- C. Memory protection
- D. Devices transferring data to memory without using the CPU for each byte
Show answerHide answer
Answer: D. Devices transferring data to memory without using the CPU for each byte
Frees the CPU during large transfers.Q51. What is spooling?
- A. Sharing memory
- B. Buffering jobs (like print jobs) on disk so a slow device can process them in turn
- C. Compressing files
- D. Formatting a disk
Show answerHide answer
Answer: B. Buffering jobs (like print jobs) on disk so a slow device can process them in turn
Simultaneous Peripheral Operations On-Line.Q52. What is a file descriptor in Unix?
- A. A file's name
- B. The size of a file
- C. A folder
- D. A small integer that identifies an open file
Show answerHide answer
Answer: D. A small integer that identifies an open file
0, 1 and 2 are stdin, stdout and stderr.Q53. What is the role of a bootloader?
- A. Managing user accounts
- B. Shutting down the computer
- C. Running antivirus scans
- D. Loading the operating system kernel into memory at start-up
Show answerHide answer
Answer: D. Loading the operating system kernel into memory at start-up
GRUB is a common Linux bootloader.Q54. What is a real-time operating system?
- A. Any modern OS
- B. An OS with a clock on screen
- C. An OS that guarantees responses within strict time limits
- D. An OS that updates in real time
Show answerHide answer
Answer: C. An OS that guarantees responses within strict time limits
Used in medical devices, cars and aircraft.Q55. What is the producer-consumer problem about?
- A. Allocating memory to producers
- B. Synchronising threads that add to and remove from a shared buffer
- C. Scheduling the fastest process
- D. Sorting a buffer
Show answerHide answer
Answer: B. Synchronising threads that add to and remove from a shared buffer
Solved with semaphores for empty and full slots plus a mutex.Q56. What is the dining philosophers problem used to illustrate?
- A. Network routing
- B. Deadlock and resource sharing among processes
- C. Memory paging
- D. Disk scheduling
Show answerHide answer
Answer: B. Deadlock and resource sharing among processes
Five philosophers, five forks, each needs two.Q57. Which disk scheduling algorithm moves the head back and forth like an elevator?
- A. SCAN
- B. FCFS
- C. SSTF
- D. LIFO
Show answerHide answer
Answer: A. SCAN
C-SCAN returns to the start without serving requests on the way back.Q58. What is a monolithic kernel?
- A. A kernel without drivers
- B. A kernel written in one file
- C. A kernel with only one process
- D. A kernel where most OS services run in kernel space
Show answerHide answer
Answer: D. A kernel where most OS services run in kernel space
Linux is monolithic; microkernels move services to user space.Q59. What is the purpose of the swap space?
- A. A backup partition
- B. Space for user files
- C. Space for system logs
- D. Disk space used when RAM is full
Show answerHide answer
Answer: D. Disk space used when RAM is full
Swapping lets the OS run more programs than fit in RAM.Q60. What is a daemon in Unix?
- A. A broken process
- B. A virus
- C. The root user
- D. A background process that runs without a user interface
Show answerHide answer
Answer: D. A background process that runs without a user interface
e.g. sshd, cron.Q61. What is multiprogramming?
- A. Keeping several programs in memory so the CPU always has work
- B. Using many CPUs
- C. Writing programs in many languages
- D. Running one program many times
Show answerHide answer
Answer: A. Keeping several programs in memory so the CPU always has work
When one waits for I/O, another runs.Q62. What is the difference between user mode and kernel mode?
- A. User mode is faster for everything
- B. Kernel mode is for games
- C. Kernel mode can execute privileged instructions; user mode can't
- D. There is no difference
Show answerHide answer
Answer: C. Kernel mode can execute privileged instructions; user mode can't
System calls switch from user to kernel mode.Q63. What is a shell?
- A. The kernel
- B. A program that reads and runs user commands
- C. A file system
- D. A hardware component
Show answerHide answer
Answer: B. A program that reads and runs user commands
bash and zsh are shells.Q64. What does the chmod 755 command set on a Linux file?
- A. Owner rw-, others r--
- B. Everyone rwx
- C. Owner rwx, group r-x, others r-x
- D. Owner r--, others none
Show answerHide answer
Answer: C. Owner rwx, group r-x, others r-x
7 = rwx, 5 = r-x.Q65. What is inter-process communication (IPC)?
- A. Ways processes exchange data, like pipes, sockets and shared memory
- B. Communication between CPUs
- C. A network protocol only
- D. Email between users
Show answerHide answer
Answer: A. Ways processes exchange data, like pipes, sockets and shared memory
Message queues and signals are IPC too.
Practised these? Now prove it.
Take a timed mock test with new questions every attempt, earn a verified certificate at 70%+, and get noticed by employers.
Start a mock test