Linux Process Management 3 — Questions and Answers
Question 1: In the output of 'ps aux', what does the 'S' state code indicate?
- Stopped by a signal
- Sleeping (interruptible wait) (Correct answer)
- Swapped out to disk
- System process
Correct answer: Sleeping (interruptible wait)
The 'S' state means the process is sleeping in an interruptible wait, ready to wake when its event or signal arrives.
Question 2: What does 'ulimit -n' control for a process?
- Maximum number of child processes
- Maximum number of open file descriptors (Correct answer)
- Maximum network connections
- Maximum nice value adjustment
Correct answer: Maximum number of open file descriptors
ulimit -n sets the maximum number of open file descriptors a process can hold simultaneously.
Question 3: Which system call does a process use to create a child process in Linux?
- exec()
- spawn()
- fork() (Correct answer)
- clone() only
Correct answer: fork()
fork() creates a new child process as a copy of the parent; the child then often calls exec() to load a new program.
Question 4: What does 'nohup command &' accomplish?
- Runs command at higher priority in background
- Runs command immune to SIGHUP and detached from terminal (Correct answer)
- Pauses command until terminal reconnects
- Runs command with no output buffering
Correct answer: Runs command immune to SIGHUP and detached from terminal
nohup ignores the SIGHUP signal (sent when a terminal closes) and & puts the process in the background, so it survives terminal logout.
Question 5: Which file in /proc shows a process's current memory map including shared libraries?
- /proc/PID/mem
- /proc/PID/maps (Correct answer)
- /proc/PID/smaps
- /proc/PID/pagemap
Correct answer: /proc/PID/maps
/proc/PID/maps lists all memory regions mapped by the process, including address ranges, permissions, and file mappings.
Question 6: When using 'top', which key sorts processes by memory usage?
- M (Correct answer)
- P
- N
- T
Correct answer: M
Pressing 'M' in top sorts the process list by memory (RES) usage in descending order.
Question 7: What is the purpose of cgroups (control groups) in Linux process management?
- To group related processes into a single PID
- To limit and account for resource usage by groups of processes (Correct answer)
- To synchronize signals across process families
- To provide shared memory between processes
Correct answer: To limit and account for resource usage by groups of processes
cgroups allow administrators to allocate, limit, and monitor resources (CPU, memory, I/O) for groups of processes, used heavily by containers.
In the output of 'ps aux', what does the 'S' state code indicate?