LFCS Certification Process and Job Scheduling 5 — Questions and Answers
Question 1: Which systemd command would you use to view the full journal logs for a specific service unit?
- journalctl -u servicename.service (Correct answer)
- systemctl logs servicename
- journalctl --service=servicename
- systemctl journal servicename.service
Correct answer: journalctl -u servicename.service
`journalctl -u unitname` filters the journal to show only log entries from the specified systemd unit.
Question 2: What is a process group in Linux?
- A collection of related processes sharing a common PGID, used for signal delivery (Correct answer)
- A set of processes sharing the same UID and GID
- A cgroup that limits resource usage for multiple processes
- A named group of processes defined in /etc/group
Correct answer: A collection of related processes sharing a common PGID, used for signal delivery
A process group is a set of processes with the same PGID (process group ID), allowing signals to be sent to all members at once.
Question 3: When using `fg` in bash, what does it do?
- Brings a background or stopped job into the foreground (Correct answer)
- Creates a new foreground process group
- Lists all foreground running processes
- Forks a process into the foreground shell
Correct answer: Brings a background or stopped job into the foreground
`fg [%jobnumber]` resumes a background or suspended job and runs it in the foreground of the current shell.
Question 4: What does the `ulimit -n` command configure for a shell session?
- The maximum number of open file descriptors (Correct answer)
- The maximum number of running processes
- The maximum size of core dump files
- The maximum stack size in kilobytes
Correct answer: The maximum number of open file descriptors
`ulimit -n` sets or displays the maximum number of open file descriptors allowed for the current shell and its child processes.
Question 5: Which file in /etc controls the default system-wide nice value limit for users?
- /etc/security/limits.conf (Correct answer)
- /etc/sysctl.conf
- /etc/profile.d/nice.sh
- /proc/sys/kernel/sched_default_nice
Correct answer: /etc/security/limits.conf
`/etc/security/limits.conf` defines resource limits including `priority` (nice value) for users and groups system-wide.
Question 6: What is the purpose of cgroups (control groups) in relation to process scheduling?
- They limit, account for, and isolate resource usage (CPU, memory, I/O) of process groups (Correct answer)
- They define which users can schedule processes with elevated priority
- They group processes by nice value for batch scheduling
- They manage systemd unit dependencies during scheduling
Correct answer: They limit, account for, and isolate resource usage (CPU, memory, I/O) of process groups
cgroups allow the kernel to allocate and limit resources like CPU time, memory, and I/O bandwidth to groups of processes.
Question 7: You want a cron job to run at 2:30 AM on the first Monday of every month. Which entry is correct?
- 30 2 1-7 * 1 (Correct answer)
- 30 2 1 * 1
- 30 2 * * 1 && day<=7
- 0 2 1-7 * MON
Correct answer: 30 2 1-7 * 1
`30 2 1-7 * 1` runs at 2:30 AM on Mondays (day 1) when the date falls between 1-7, approximating the first Monday of the month.
Which systemd command would you use to view the full journal logs for a specific service unit?