Linux · Systems fluency
What is a process in Linux?
Short answer
A process is a running program instance with its own address space, credentials, file descriptors, and PID. Processes are created with fork or clone and usually replaced with exec to run a new program.
The kernel tracks each process with a task structure. A process has a parent, a state, a current working directory, environment variables, open file descriptors, and resource limits. Threads share an address space but have separate execution state.
ps -eo pid,ppid,stat,comm | head
pgrep -a nginx
pstree -p 1Common process states
- R: runnable, either running or waiting for CPU
- S: interruptible sleep, usually waiting for an event
- D: uninterruptible sleep, often waiting on I/O
- Z: zombie, exited but not yet reaped by its parent
- T: stopped, for example after Ctrl-Z or a debugger attach
Orphaned processes are reparented to PID 1 or a subreaper. Zombies are not running and consume little memory, but they still occupy a PID until the parent calls wait. A large zombie count usually points to a buggy parent.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the difference between a process and a thread?
- 2What causes a zombie process?
- 3How does fork differ from exec?
- 4What happens to a process when its parent exits?
Say it in the interview
A process is a running instance of a program with its own address space, credentials, file descriptors, and PID. It is created by fork or clone and often replaced by exec. Each process has a parent and a state such as running, sleeping, or zombie. Zombies have exited but still need to be reaped by the parent.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Linux mock interview and get scored feedback on depth, clarity and confidence.