Operating Systems and Processes
The OS as resource manager
What an operating system does
An operating system manages the CPU, memory, storage, input/output devices, and security boundaries. It provides abstractions such as processes, threads, files, and virtual memory so applications can run without dealing with raw hardware directly.
Core OS abstractions
Why virtualization helps
Virtual memory and process isolation make programs safer and easier to run alongside one another.
What is a process?
A process is a program in execution.
Correct answer: A running instance of a program
What problem does virtual memory help solve?
Virtual memory simplifies programming and improves protection.
Correct answer: It provides each process the illusion of its own large, contiguous address space and helps with isolation.
Scheduling and concurrency
Because many programs want CPU time, the OS schedules processes and threads. Concurrency allows multiple tasks to make progress, while synchronization mechanisms prevent corruption when tasks share data.
Which OS mechanism helps prevent simultaneous access problems when multiple threads share data?
Locks, semaphores, and related mechanisms coordinate access.
Correct answer: Synchronization
Why are system calls important?
They separate user programs from direct hardware control.
Correct answer: They provide a controlled way for programs to request privileged OS services.
How to think about a bug in a concurrent program
-
1
Step 1: Identify shared state.
-
2
Step 2: Determine which operations can overlap.
-
3
Step 3: Look for race conditions or deadlocks.
-
4
Step 4: Add logging, timing, or locks carefully.
-
5
Step 5: Retest under load and repeated execution.