Register Login

Top 40 OS Interview Questions and Answers 2025

Updated Apr 16, 2025

1. Explain what is an operating system and its types.

An Operating System (OS) is system software that acts as an intermediary between computer hardware and the user. It manages hardware resources and provides services for computer programs.

Types of Operating Systems:

  • Batch Operating System
  • Time-Sharing (Multitasking) Operating System
  • Distributed Operating System
  • Network Operating System
  • Real-Time Operating System (RTOS)
  • Mobile Operating System

2. What are the different operating systems?

  • Microsoft Windows
  • macOS (Apple)
  • Linux/UNIX
  • Android (Google)
  • iOS (Apple)

3. What is the function of the kernel of an operating system?

The kernel is the core component of an OS, responsible for managing system resources and communication between hardware and software components.

Functions include:

  • Memory management
  • Process scheduling
  • Device management
  • System calls and security

4. What is the difference between microkernel and monolithic kernel?

Microkernel:

  • Minimal functionalities; services run in user space
  • More modular and secure
  • Examples: QNX, Minix

Monolithic Kernel:

  • All services run in a single address space
  • Better performance
  • Examples: Linux, UNIX

5. What is an RTOS (Real-Time Operating System)?

A Real-Time Operating System (RTOS) is designed to process data in real time with minimal delay. It is used in systems requiring immediate responses, such as:

  • Air traffic control
  • Medical devices
  • Industrial automation

Examples: FreeRTOS, VxWorks

6. What is deadlock?

A deadlock occurs when two or more processes cannot proceed because each is waiting for the other to release a resource.

Conditions for deadlock:

  • Mutual exclusion
  • Hold and wait
  • No preemption
  • Circular wait

7. What is a process in OS?

A process is a program in execution, consisting of:

  • Program code
  • Program counter
  • Stack
  • Heap
  • Data section

8. What are the different states of a process in an OS?

  • New: Process is being created.
  • Ready: Waiting to be assigned to CPU.
  • Running: Instructions are being executed.
  • Waiting: Waiting for an event.
  • Terminated: Execution is complete.

9. What is a thread in an Operating System?

A thread is the smallest unit of execution within a process. Multiple threads can run concurrently within a single process, sharing resources but running independently.

10. Explain the Inverted Page Table.

An Inverted Page Table uses a single table indexed by frame number instead of maintaining separate page tables for each process, thus saving memory at the cost of slower lookup.

11. What is virtual memory in an operating system?

Virtual memory is a memory management technique that gives an application the impression of having contiguous and ample memory while using disk space as an extension of RAM.

12. What is a command interpreter?

A command interpreter (or shell) executes user commands and acts as a bridge between the user and the OS.

Examples: Bash, Terminal, Command Prompt

13. What is a zombie process in Linux OS?

A zombie process is a process that has finished execution but still has an entry in the process table because its parent hasn't read its exit status.

14. How to kill a zombie process?

  1. Find the parent process using ps or pstree.
  2. Kill the parent process using kill or kill -9.
  3. The zombie will be removed by the init process.

15. Explain pre-emptive and non pre-emptive scheduling.

Pre-emptive Scheduling: The OS can interrupt a running process to switch to another. Ensures responsiveness. (e.g., Round Robin)

Non Pre-emptive Scheduling: A process runs until it finishes. Simpler but less responsive. (e.g., FCFS)

16. What is compaction in an OS?

Compaction reduces fragmentation by moving processes in memory to combine free spaces, creating large blocks of usable memory.

17. What is a single-tasking operating system?

A single-tasking OS runs only one process at a time. Example: MS-DOS.

18. What is cache memory?

Cache memory is a high-speed memory between RAM and CPU that stores frequently accessed data to speed up processes.

19. What is primary storage and secondary storage?

  • Primary Storage: Fast, volatile memory (RAM, cache).
  • Secondary Storage: Non-volatile, long-term storage (HDD, SSD).

20. What is Throughput, Turnaround Time, Waiting Time, and Response Time in Operating Systems?

  • Throughput: Number of processes completed per unit time.
  • Turnaround Time: Total time from submission to completion.
  • Waiting Time: Time spent in the ready queue.
  • Response Time: Time from request submission to first response.

21. What is a system call in an operating system?

A system call is a way for programs to interact with the operating system. It provides an interface between user applications and OS services like file management, process control, and device handling.

Examples: fork(), exec(), read(), write(), open(), close()

22. What is the difference between multitasking, multithreading, and multiprocessing?

  • Multitasking: Running multiple tasks (processes) at the same time on a single CPU.
  • Multithreading: Multiple threads within the same process run concurrently.
  • Multiprocessing: Using multiple CPUs to run processes in parallel.

23. What is context switching in an OS?

Context switching is the process of storing the state of a currently running process and loading the state of the next process to be executed by the CPU. It enables multitasking and process scheduling.

24. What is paging in operating systems?

Paging is a memory management technique that eliminates the need for contiguous allocation by dividing memory into fixed-size blocks called pages (in logical memory) and frames (in physical memory).

25. What is segmentation in OS?

Segmentation divides the memory into variable-sized segments based on logical divisions like functions, arrays, or data. Each segment has a base and a limit.

26. What is the difference between internal and external fragmentation?

  • Internal Fragmentation: Unused memory within allocated space (e.g., a process allocated 4 KB but uses only 3.2 KB).
  • External Fragmentation: Small memory blocks scattered throughout free space, preventing allocation of large contiguous blocks.

27. What are the different types of schedulers in OS?

Schedulers determine which process runs at what time. Types include:

  • Long-Term Scheduler: Controls admission of processes into the system.
  • Short-Term Scheduler (CPU Scheduler): Decides which ready process runs next on the CPU.
  • Medium-Term Scheduler: Swaps processes in and out of memory to manage multitasking.

28. What is the difference between user mode and kernel mode?

  • User Mode: Restricted mode for applications; cannot access hardware directly.
  • Kernel Mode: Privileged mode with full system access, used by the OS kernel.

29. What is swapping in OS?

Swapping is the process of moving a process from main memory to disk (and back) to free up memory for other processes. It's a memory management technique used to support multitasking.

30. What are the differences between FAT and NTFS file systems?

  • FAT (File Allocation Table): Simple, used in older systems, limited security and file size.
  • NTFS (New Technology File System): Modern, supports large files, file permissions, encryption, and journaling.

31. What is a semaphore?

A semaphore is a synchronization tool used to control access to shared resources by multiple processes to prevent race conditions.

Types include:

  • Binary Semaphore: Only two values (0 and 1).
  • Counting Semaphore: Can have a range of values.

32. What is the difference between a hard real-time and a soft real-time operating system?

  • Hard Real-Time OS: Strict timing constraints; missing a deadline can be catastrophic (e.g., pacemakers).
  • Soft Real-Time OS: Deadlines are important but not critical (e.g., video streaming).

33. What is the difference between a process and a program?

  • Program: A passive collection of instructions stored on disk.
  • Process: A program in execution with its own state, memory, and system resources.

34. What is the difference between logical and physical address?

  • Logical Address: Address generated by the CPU during execution.
  • Physical Address: Actual location in the physical memory (RAM).

35. What is the Banker’s algorithm in OS?

Banker’s Algorithm is a deadlock avoidance algorithm that checks whether resource allocation will keep the system in a safe state before allowing the allocation.

36. What are device drivers in OS?

Device drivers are programs that enable the operating system to communicate with hardware devices such as printers, keyboards, and storage drives.

37. What are system programs?

System programs support OS functionality and user convenience. They include:

  • File management tools
  • System utilities
  • Compilers and assemblers

38. What is IPC (Inter-process Communication)?

IPC is a mechanism for processes to communicate and synchronize their actions.

Common IPC methods:

  • Shared Memory
  • Message Passing
  • Sockets
  • Pipes

39. What is the difference between paging and segmentation?

  • Paging: Divides memory into fixed-size pages and frames.
  • Segmentation: Divides memory into variable-sized logical segments.
  • Paging is for memory management; segmentation reflects program structure.

40. What is thrashing in OS?

Thrashing happens when the CPU spends more time swapping pages in and out of memory than executing processes, leading to poor performance. It occurs when there is insufficient memory.


×