Linux Process Management 2 — Questions and Answers
Question 1: Which signal is sent to a process when you press Ctrl+C in the terminal?
- SIGTERM (15)
- SIGKILL (9)
- SIGINT (2) (Correct answer)
- SIGHUP (1)
Correct answer: SIGINT (2)
Ctrl+C sends SIGINT (signal 2), which requests the process to interrupt and terminate gracefully.
Question 2: What does the 'nice' value range from in Linux?
- -20 to 19 (Correct answer)
- 0 to 39
- -19 to 20
- 1 to 40
Correct answer: -20 to 19
Linux nice values range from -20 (highest priority) to 19 (lowest priority), with 0 as the default.
Question 3: Which command changes the nice value of a currently running process?
- nice
- renice (Correct answer)
- chnice
- priority
Correct answer: renice
renice adjusts the scheduling priority of an already-running process by its PID.
Question 4: What is a zombie process?
- A process consuming 100% CPU
- A process that ignores all signals
- A terminated process whose exit status hasn't been collected by its parent (Correct answer)
- A process running without a controlling terminal
Correct answer: A terminated process whose exit status hasn't been collected by its parent
A zombie (defunct) process has exited but remains in the process table because its parent hasn't called wait() to collect its exit status.
Question 5: Which /proc entry shows the command-line arguments used to launch a process with PID 1234?
- /proc/1234/status
- /proc/1234/cmdline (Correct answer)
- /proc/1234/comm
- /proc/1234/exe
Correct answer: /proc/1234/cmdline
/proc/PID/cmdline contains the full command line used to start the process, with arguments separated by null bytes.
Question 6: What happens to orphan processes (whose parent has died) in Linux?
- They are immediately killed
- They become zombie processes
- They are adopted by init/systemd (PID 1) (Correct answer)
- They run with elevated privileges
Correct answer: They are adopted by init/systemd (PID 1)
When a parent process dies before its children, the orphaned children are re-parented to PID 1 (init or systemd).
Question 7: Which command sends a signal to all processes matching a given name?
- kill
- pkill (Correct answer)
- killall -9
- signal
Correct answer: pkill
pkill sends a signal to processes matching a name pattern, while kill requires an explicit PID.
Which signal is sent to a process when you press Ctrl+C in the terminal?