LCA Process Management & System Services 2 — Questions and Answers
Question 1: What is the primary purpose of the /proc virtual filesystem in Linux?
- To store temporary files created by running processes
- To provide a kernel interface exposing process and system information (Correct answer)
- To cache compiled process data for faster execution
- To store core dumps generated by crashed processes
Correct answer: To provide a kernel interface exposing process and system information
/proc is a virtual filesystem that provides a dynamic kernel-to-userspace interface where files represent process and system state.
Question 2: Which systemctl command lists all units that are currently loaded in memory, including active and failed units?
- systemctl list-all
- systemctl show-units
- systemctl list-units (Correct answer)
- systemctl running
Correct answer: systemctl list-units
systemctl list-units displays all units that are loaded into memory; by default it filters to active units, but --all shows everything.
Question 3: What happens when a process receives SIGTERM (signal 15)?
- It is immediately killed by the kernel with no cleanup
- It receives a graceful termination request and can perform cleanup before exiting (Correct answer)
- It pauses execution and waits to be resumed with SIGCONT
- It automatically restarts via its init or systemd configuration
Correct answer: It receives a graceful termination request and can perform cleanup before exiting
SIGTERM requests graceful termination, allowing the process to save data, close files, and release resources before exiting.
Question 4: Which journalctl command filters log output to show only entries from the systemd unit named 'nginx'?
- journalctl -s nginx
- journalctl -u nginx (Correct answer)
- journalctl --service nginx
- journalctl /nginx
Correct answer: journalctl -u nginx
journalctl -u <unit> filters the systemd journal to display only log entries associated with the specified unit.
Question 5: Which command changes the scheduling priority of an already-running process with PID 1234 to a nice value of 5?
- nice -n 5 1234
- renice -n 5 -p 1234 (Correct answer)
- chnice 5 1234
- nice --pid 1234 5
Correct answer: renice -n 5 -p 1234
renice adjusts the nice value of running processes specified by PID, user, or group without requiring a restart.
Question 6: In the crontab entry '30 2 * * 1-5 /usr/local/bin/backup.sh', on which days will the script execute?
- Weekends only (Saturday and Sunday)
- All seven days of the week
- Weekdays only (Monday through Friday) (Correct answer)
- The first five days of each calendar month
Correct answer: Weekdays only (Monday through Friday)
The day-of-week field '1-5' corresponds to Monday through Friday in cron notation, where 0 and 7 both represent Sunday.
Question 7: What is a zombie process in Linux?
- A process consuming 100% CPU indefinitely
- A process that has exited but remains in the process table because its parent has not read its exit status (Correct answer)
- A process running as root without proper authorization
- A process that ignores all termination signals including SIGKILL
Correct answer: A process that has exited but remains in the process table because its parent has not read its exit status
A zombie process has completed execution but stays in the process table as a placeholder until its parent calls wait() to collect its exit status.
What is the primary purpose of the /proc virtual filesystem in Linux?