What is a process?
Why Interviewers Ask This
Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid Operating Systems basics — a prerequisite for any developer role.
Answer
A process is a program in execution — an active entity with its own memory space, system resources, and execution context. A program is a passive, stored set of instructions (binary on disk); a process is that program being actively run. Process components: (1) Code segment (text): the executable instructions; (2) Data segment: global and static variables; (3) Heap: dynamically allocated memory (malloc/new); (4) Stack: local variables, function call frames, return addresses; (5) Process Control Block (PCB): OS data structure storing process state — PID, program counter, CPU registers, memory maps, open files, process state. Process states: New (being created) → Ready (in queue, waiting for CPU) → Running (executing on CPU) → Waiting/Blocked (waiting for I/O, event) → Terminated (finished or killed). Process vs program: one program can spawn multiple processes (browser tabs). Multiple processes can run the same program simultaneously (multiple users running ls). Multiprogramming vs multitasking: multiprogramming = multiple programs loaded in memory at once; multitasking = rapid CPU switching among them giving illusion of simultaneous execution. Process creation: fork() (Unix) creates a child process as a copy of parent; exec() replaces process image with a new program; CreateProcess() (Windows). Process overhead: processes have high overhead — separate memory space, creation is expensive. Threads within a process share memory, are cheaper to create.
Common Mistake
Don't just define the term — demonstrate that you understand when to use it and when not to. Showing awareness of trade-offs is what separates average from strong Operating Systems candidates.