1. Operating systemsEasy
Browsers run each tab as a separate process, not a thread, so one crashing tab can't take down the others. What's the key difference that makes that work?
- Threads share their process's memory; processes are isolated
- Processes are always faster to start than threads
- Threads can't run in parallel
- Processes can't communicate with each other
Show answer
Answer: A. Threads share their process's memory; processes are isolated
Threads share the heap and globals of their process, so communication is cheap but needs synchronization. Processes are isolated, so a crash in one doesn't corrupt another, but communicating needs IPC (pipes, sockets, shared memory).
10. Operating systemsMedium
Under load, your service starts failing with "Too many open files", even though it opens very few files. What's the likely cause?
- The disk is full, so new files can't be created
- Each socket uses a file descriptor, and connections aren't closed
- The service has too many threads, and each one holds its own open files
- A log file is locked by another process
Show answer
Answer: B. Each socket uses a file descriptor, and connections aren't closed
On Unix every socket is a file descriptor. Leaked HTTP or database connections, or a low ulimit -n, exhaust the per-process limit. Close or pool connections, and raise the limit for servers that genuinely need many sockets.
13. Operating systemsMedium
What is a key benefit of virtual memory?
- Each process gets an isolated address space, pageable to disk
- It makes the CPU faster at reading memory
- It removes the need for physical RAM
- It lets processes freely read and write each other's memory
Show answer
Answer: A. Each process gets an isolated address space, pageable to disk
The OS and hardware (MMU) map each process's virtual addresses to physical pages. That gives isolation (a bug in one process can't corrupt another) and flexibility, at the cost of page-table lookups that the TLB caches.
14. Operating systemsMedium
What does it mean when a process is in the "blocked" (waiting) state?
- It's waiting for an event like I/O, so it gets no CPU time
- It has crashed and is waiting to be cleaned up
- It's using 100% CPU in a tight loop
- It has been paused by the user with Ctrl+Z
Show answer
Answer: A. It's waiting for an event like I/O, so it gets no CPU time
The main states are running, ready (could run, waiting for a CPU) and blocked (waiting for something else). Blocked processes don't consume CPU, which is how one core juggles many I/O-heavy programs.