Linux Process Management Concepts: Difference between revisions
No edit summary |
|||
(12 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
* [[Linux#Concepts|Linux]] | * [[Linux#Concepts|Linux]] | ||
=Process= | |||
The process with ID 0 is the swapper (or sched), the process responsible with paging. It is part of the kernel, rather than user-space. | |||
<span id="The_init_Process"></span>The process with ID 1 is the init process, and it is responsible with starting and shutting down the system. | |||
=Threads= | |||
The number of threads for process can be read from the process' corresponding /proc/<pid>/status, as described here: [[Linux_Process_Information#Threads|"Threads:"]]. | |||
=Maximum Number of Processes Allowed on the System= | =Maximum Number of Processes Allowed on the System= | ||
Line 8: | Line 19: | ||
cat /proc/sys/kernel/pid_max | cat /proc/sys/kernel/pid_max | ||
</pre> | </pre> | ||
or | |||
<pre> | |||
sysctl kernel.pid_max | |||
</pre> | |||
For more details, see [[sysctl]] and [[Kernel_Runtime_Configuration#kernel.pid_max|kernel.pid_max]]. | |||
To get the actual number of processes present in the system, see <tt>[[Linux_Process_Information#.2Fproc.2Fstat|/proc/stat]]</tt>. | |||
=Maximum Number of Processes Available to a Single User= | =Maximum Number of Processes Available to a Single User= | ||
The current value can be read and set with [[Ulimit#Options|ulimit -u]]. | The current value can be read and set with [[Ulimit#Options|ulimit -u]]. | ||
For Java applications, this setting limits the number of threads a JVM can create, and it can cause the JVM to throw "java.lang.OutOfMemoryError: unable to create new native thread" exceptions when that limit is reached. For more details see {{Internal|Java_Threads#Java_Threads_and_Linux_Processes|Java Threads and Linux Processes}} | |||
The O/S level symptom of reaching the per-user process limit is: | |||
<pre> | |||
-bash: fork: retry: Resource temporarily unavailable | |||
</pre> | |||
while trying to execute an arbitrary process. |
Latest revision as of 01:26, 16 July 2017
Internal
Process
The process with ID 0 is the swapper (or sched), the process responsible with paging. It is part of the kernel, rather than user-space.
The process with ID 1 is the init process, and it is responsible with starting and shutting down the system.
Threads
The number of threads for process can be read from the process' corresponding /proc/<pid>/status, as described here: "Threads:".
Maximum Number of Processes Allowed on the System
cat /proc/sys/kernel/pid_max
or
sysctl kernel.pid_max
For more details, see sysctl and kernel.pid_max.
To get the actual number of processes present in the system, see /proc/stat.
Maximum Number of Processes Available to a Single User
The current value can be read and set with ulimit -u.
For Java applications, this setting limits the number of threads a JVM can create, and it can cause the JVM to throw "java.lang.OutOfMemoryError: unable to create new native thread" exceptions when that limit is reached. For more details see
The O/S level symptom of reaching the per-user process limit is:
-bash: fork: retry: Resource temporarily unavailable
while trying to execute an arbitrary process.