LFCS Certification Process and Job Scheduling 4 — Questions and Answers
Question 1: What does the `ionice` command control?
- The I/O scheduling class and priority of a process (Correct answer)
- The network I/O bandwidth for a process
- The CPU affinity for I/O-intensive processes
- The number of file descriptors a process can open
Correct answer: The I/O scheduling class and priority of a process
`ionice` sets or gets the I/O scheduling class (idle, best-effort, real-time) and priority for a process.
Question 2: A systemd service file has `Restart=on-failure`. When will systemd NOT restart the service?
- When the service exits with a zero exit code (success) (Correct answer)
- When the service is killed by SIGKILL
- When the service exits with exit code 1
- When a dependent service fails
Correct answer: When the service exits with a zero exit code (success)
`Restart=on-failure` only restarts the service on non-zero exit codes, signals, or timeouts — not on clean exit (code 0).
Question 3: Which command shows which CPU core each process is currently running on?
- ps -eo pid,psr,comm (Correct answer)
- top -H
- taskset -p
- mpstat -P ALL
Correct answer: ps -eo pid,psr,comm
`ps -eo pid,psr,comm` outputs each process's PID, processor (CPU core), and command name.
Question 4: What is the effect of running `taskset -c 0,2 ./myapp`?
- Restricts myapp to run only on CPU cores 0 and 2 (Correct answer)
- Sets myapp's nice value to 0 with 2 threads
- Pins myapp to NUMA node 0 with 2 memory regions
- Starts myapp with CPU quota of 20%
Correct answer: Restricts myapp to run only on CPU cores 0 and 2
`taskset -c 0,2` sets the CPU affinity mask, restricting the process to only run on the specified cores.
Question 5: What happens to background jobs when you close a terminal without using `nohup` or `disown`?
- They receive SIGHUP and typically terminate (Correct answer)
- They continue running as daemon processes
- They are automatically moved to the init process
- They are paused until the next login session
Correct answer: They receive SIGHUP and typically terminate
When a terminal closes, it sends SIGHUP to all processes in its session; most processes terminate upon receiving it.
Question 6: Which cron time field position controls the day of the week?
- The 5th field (0=Sunday through 6=Saturday) (Correct answer)
- The 4th field (1=Monday through 7=Sunday)
- The 3rd field (day of week 1-7)
- The 5th field (1=Monday through 7=Sunday)
Correct answer: The 5th field (0=Sunday through 6=Saturday)
In a crontab entry, the 5th field specifies day of week with 0 and 7 both representing Sunday.
Question 7: What does `kill -l` display?
- A list of all available signal names and their numbers (Correct answer)
- The PID of the last killed process
- All processes eligible to be killed by the current user
- The log of previously sent kill signals
Correct answer: A list of all available signal names and their numbers
`kill -l` (lowercase L) lists all signal names supported by the system along with their corresponding numbers.
What does the `ionice` command control?