Domain 4Running SystemsCORE

Managing Processes

Managing Linux processes, job control, signals, process priorities with nice and renice, process hierarchy, and system performance tuning using tuned.

Domain: Domain 4: Operate running systems•Updated: 2026-08-30
#CLI#Processes#Jobs#Nice#Renice#Tuned#Signals

Managing Processes

This section covers core Linux process management, job control, signal handling (kill, pkill, killall), scheduling priority manipulation (nice, renice), and system performance profile tuning using tuned for RHCSA preparation.


Theory Questions

1. What distinguishes lightweight threads from full processes in Linux?

Linux implements threads as Lightweight Processes (LWP) that share memory and resources within the same process group.

  • Command(s): ps -eLf
  • Why: ps -eLf displays individual threads under the LWP (Lightweight Process ID) column, alongside the parent PID and total thread count (NLWP).
  • Gotchas: Confusing an LWP thread with an independent process. In Linux, threads belonging to the same process share identical memory address spaces and PID/TGIDs.
  • Verify: ps -eLf | head -n 10

2 & 12. How do you stop a foreground job and continue running it in the background?

Suspend the active job with Ctrl + Z, then send it to the background using bg.

  • Command(s): Press Ctrl + Z, then type bg %<job_number> (or simply bg)
  • Why: Ctrl + Z sends SIGTSTP to pause execution, and bg sends SIGCONT to resume process execution in the background.
  • Gotchas: Leaving a job suspended via Ctrl + Z without running bg keeps the process in a Stopped state rather than actively running.
  • Verify: jobs -l (status should display Running).

3. How do you terminate an active interactive foreground shell job using a keyboard shortcut?

Send an interrupt signal to the running process by pressing Ctrl + C.

  • Command(s): Press Ctrl + C
  • Why: Sends SIGINT (Signal Interrupt, signal 2) to the active foreground process, instructing it to terminate immediately.
  • Gotchas: Pressing Ctrl + Z suspends the process in memory instead of stopping or canceling it.
  • Verify: The terminal returns directly to a blank shell prompt, and jobs displays no active background tasks.

4. How are execution threads managed and represented in Linux kernel scheduling?

Threads share virtual memory pointers, file descriptors, and signal handlers while maintaining individual LWP identifiers.

  • Command(s): ps -eLf or top -H
  • Why: The Linux kernel schedules tasks using task_struct objects. Threads are tasks that share execution contexts with parent processes.
  • Gotchas: Assuming threads possess completely isolated memory boundaries like standard fork child processes.
  • Verify: ps -eLf | grep <process_name>

5. How do you retrieve full execution commands and start arguments for a running process?

Query process details using ps -f -p or read /proc/<PID>/cmdline.

  • Command(s): ps -f -p <PID> or cat /proc/<PID>/cmdline | tr '\0' ' '
  • Why: ps -f formats full command arguments, while /proc/<PID>/cmdline reads the raw memory vector passed during process launch.
  • Gotchas: Running basic ps -p <PID> truncates long command-line arguments and option flags.
  • Verify: ps -f -p $$

6. What nice value range controls process scheduling priority, and how do values affect execution?

Nice values range from -20 (highest priority) to 19 (lowest priority), defaulting to 0.

  • Command(s): ps -el
  • Why: Lower numerical nice values instruct the kernel CPU scheduler to allocate larger time slices to the process.
  • Gotchas: Assuming higher positive nice numbers grant higher execution priority; positive numbers make a process nicer to others, yielding CPU cycles.
  • Verify: ps -eo pid,ni,pri,comm

7 & 15. How do you change the scheduling priority of an active process by PID?

Modify runtime process priority using the renice command.

  • Command(s): sudo renice -n -5 -p <PID>
  • Why: renice updates the nice value of active processes without requiring a service restart. -n specifies the new value and -p targets the PID.
  • Gotchas: Regular users can only increase nice values (lower priority). Setting negative nice values (higher priority) requires root privileges via sudo.
  • Verify: ps -p <PID> -o pid,ni,comm

8. Which Linux administrative commands send signals to system processes?

Commands like kill, killall, pkill, and top send signals to processes.

  • Command(s): kill -l
  • Why: kill targets PIDs, killall targets exact process names, and pkill targets regular expression match patterns.
  • Gotchas: Shell job controls (fg, bg, jobs) manage session task states but do not send arbitrary custom IPC signals.
  • Verify: kill -l

9. How do you alter the nice value of a process interactively from inside top?

Press r while viewing the top interactive interface.

  • Command(s): Press r inside top, input the target <PID>, and specify the new <nice_value>.
  • Why: Launches the built-in top renice prompt to modify scheduler settings dynamically.
  • Gotchas: Supplying a nice value outside the valid -20 to 19 boundary causes top to reject the change or cap it at threshold limits.
  • Verify: Observe the updated value under the NI column in top.

10. How do you apply the powersave performance profile using tuned?

Activate power-saving settings using tuned-adm profile.

  • Command(s): tuned-adm profile powersave
  • Why: tuned-adm applies system-wide tuning profiles adjusting CPU governor limits, disk spin times, and bus power management.
  • Gotchas: Modifying profiles via systemctl is unsupported; always use the tuned-adm CLI utility.
  • Verify: tuned-adm active

11. How do you list active shell jobs along with their corresponding PIDs?

Run jobs -l within the current shell session.

  • Command(s): jobs -l
  • Why: -l displays job IDs, execution states (Running, Stopped), and assigned process IDs (PIDs).
  • Gotchas: ps shows system-wide processes, whereas jobs tracks background tasks tied exclusively to the active shell session.
  • Verify: jobs -l

13. How do you terminate all processes belonging to another user account?

Use pkill -u or elevated kill signals.

  • Command(s): sudo pkill -u <username> or sudo kill -9 <PID>
  • Why: pkill -u matches and sends SIGTERM signals to all processes owned by the designated target UID.
  • Gotchas: Standard user accounts cannot signal processes owned by other users; root permissions are required.
  • Verify: pgrep -u <username>

14. How do you view parent-child process relationships in a visual tree layout?

Execute pstree or format ps output using tree options.

  • Command(s): pstree -p or ps -ef --forest
  • Why: Renders hierarchical tree structures showing parent process IDs (PPID) and spawned child process branches.
  • Gotchas: Standard flat process lists (ps aux) mask process lineage relationships.
  • Verify: pstree -p | head -n 20

16 & 17. How do you stop all running process instances matching a specific command name?

Use killall or pkill targeting the process name string.

  • Command(s): killall dd or pkill dd
  • Why: killall sends termination signals to all processes matching an exact name, while pkill matches substring patterns.
  • Gotchas: killall requires an exact name match. Using pkill with overly broad patterns may accidentally terminate unintended system services.
  • Verify: pgrep dd (returns no output if all instances are terminated).

18. How do you terminate a process interactively from inside top?

Press k within the top interactive interface.

  • Command(s): Press k inside top, enter the target <PID>, and specify the signal number (default is 15 for SIGTERM).
  • Why: Allows administrative termination of offending processes directly from the interactive monitor.
  • Gotchas: Pressing Enter without specifying a signal sends default 15 (SIGTERM). Use signal 9 (SIGKILL) if the process refuses to stop.
  • Verify: Confirm the target process entry vanishes from the active top display table.

19. How do you view system tuning recommendations and apply the suggested profile using tuned?

Query system recommendations using tuned-adm recommend and apply the result.

  • Command(s): tuned-adm recommend followed by tuned-adm profile <profile_name>
  • Why: recommend evaluates hardware architecture, virtualization layers, and workload characteristics to determine optimal settings.
  • Gotchas: Selecting profiles without evaluating system role recommendations may result in suboptimal performance or excessive power draw.
  • Verify: tuned-adm active

Lab Tasks

Process Management Practice

Manage background jobs, modify runtime nice values, perform bulk process termination, and enable dynamic performance profiles.

Configuration Steps

# 1. Launch three background dd processes
dd if=/dev/zero of=/dev/null &
dd if=/dev/zero of=/dev/null &
dd if=/dev/zero of=/dev/null &

# 2. Extract the PID of the first background job
TARGET_PID=$(jobs -p | head -n 1)

# 3. Increase process priority by setting nice value to -5
sudo renice -n -5 -p $TARGET_PID

# 4. Further increase process priority by setting nice value to -15
sudo renice -n -15 -p $TARGET_PID

# 5. Terminate all active dd process instances
killall dd

# 6. Install, enable, start, and configure the tuned performance service
sudo dnf install tuned -y
sudo systemctl enable --now tuned
sudo tuned-adm profile throughput-performance
  • Why:

  • Trailing & places commands directly into the background, returning control to the terminal.

  • renice dynamically updates process priority without stopping running jobs.

  • killall sends default SIGTERM signals to all matching binary names simultaneously.

  • systemctl enable --now starts the tuned daemon immediately and configures automatic boot startup.

  • tuned-adm profile throughput-performance applies optimizations for high-throughput server workloads.

  • Gotchas:

  • Setting negative nice values without sudo privileges returns a Permission denied error.

  • Forgetting to run systemctl enable leaves the tuned service inactive after system reboot.

Verification Procedures

Validate background job states, priority modifications, process terminations, and active tuning profiles.

# Verify active tuned profile selection and daemon status
tuned-adm active
systemctl is-active tuned

# Verify all dd background processes have terminated
pgrep dd