OS Interview Notes SWE2
OS Interview Notes SWE2
An operating system (OS) is software that acts as an intermediary between users and computer hardware. The OS
provides abstractions and manages resources. Key responsibilities include:
- Process Management
- Memory Management
- File System Management
- I/O Device Management
- Security and Protection
Key Concepts:
1. Kernel Mode vs User Mode
2. System Calls (e.g., fork(), exec(), read(), write())
3. Abstractions: process, virtual memory, file system
Example:
Q: Explain fork() and exec() system calls.
A: fork() creates a new process (child), which is a copy of the parent. exec() replaces the current process memory with a
new program.
Fork-Exec Pattern:
```
pid_t pid = fork();
if (pid == 0) {
execvp(...);
} else {
wait(...);
}
```
Design Question:
- If you had to write an OS for a mobile device, what components would you prioritize?
Important Topics:
1. Time Sharing and Timer Interrupts
2. Scheduling Algorithms:
- FCFS (First Come First Serve)
Operating Systems Interview Notes (SWE-2 Level)
3. Process States: NEW -> READY -> RUNNING -> WAITING -> TERMINATED
Context Switch:
Switching the CPU from one process to another. Involves saving and restoring states (PC, registers).
MLFQ Highlights:
- Multiple queues with different priorities.
- Aging to avoid starvation.
- Boosting to improve fairness.