{"id":1962,"date":"2023-08-23T06:14:40","date_gmt":"2023-08-23T06:14:40","guid":{"rendered":"http:\/\/www.msinterdev.org\/wp\/2023\/08\/23\/process-properties\/"},"modified":"2023-08-23T06:14:40","modified_gmt":"2023-08-23T06:14:40","slug":"process-properties","status":"publish","type":"post","link":"http:\/\/www.msinterdev.org\/wp\/2023\/08\/23\/process-properties\/","title":{"rendered":"PROCESS PROPERTIES"},"content":{"rendered":"<h1 id=\"PROCESS_PROPERTIES\" class=\"Sh\">PROCESS PROPERTIES<\/h1>\n<p class=\"Pp\"><em>LimitCPU=<\/em>, <em>LimitFSIZE=<\/em>, <em>LimitDATA=<\/em>, <em>LimitSTACK=<\/em>, <em>LimitCORE=<\/em>, <em>LimitRSS=<\/em>, <em>LimitNOFILE=<\/em>, <em>LimitAS=<\/em>, <em>LimitNPROC=<\/em>, <em>LimitMEMLOCK=<\/em>, <em>LimitLOCKS=<\/em>, <em>LimitSIGPENDING=<\/em>, <em>LimitMSGQUEUE=<\/em>, <em>LimitNICE=<\/em>, <em>LimitRTPRIO=<\/em>, <em>LimitRTTIME=<\/em><\/p>\n<div class=\"Bd-indent\">Set soft and hard limits on various resources for executed processes. See <a href=\"https:\/\/manpages.debian.org\/bookworm\/manpages-dev\/setrlimit.2.en.html\">setrlimit(2)<\/a> for details on the process resource limit concept. Process resource limits may be specified in two formats: either as single value to set a specific soft and hard limit to the same value, or as colon-separated pair <strong>soft:hard<\/strong> to set both limits individually (e.g. &#8220;LimitAS=4G:16G&#8221;). Use the string <strong>infinity<\/strong> to configure no limit on a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for resource limits measured in bytes (e.g. &#8220;LimitAS=16G&#8221;). For the limits referring to time values, the usual time units ms, s, min, h and so on may be used (see <a href=\"https:\/\/manpages.debian.org\/bookworm\/systemd\/systemd.time.7.en.html\">systemd.time(7)<\/a> for details). Note that if no time unit is specified for <em>LimitCPU=<\/em> the default unit of seconds is implied, while for <em>LimitRTTIME=<\/em> the default unit of microseconds is implied. Also, note that the effective granularity of the limits might influence their enforcement. For example, time limits specified for <em>LimitCPU=<\/em> will be rounded up implicitly to multiples of 1s. For <em>LimitNICE=<\/em> the value may be specified in two syntaxes: if prefixed with &#8220;+&#8221; or &#8220;-&#8220;, the value is understood as regular Linux nice value in the range -20&#8230;19. If not prefixed like this the value is understood as raw resource limit parameter in the range 0&#8230;40 (with 0 being equivalent to 1).<\/p>\n<p class=\"Pp\">Note that most process resource limits configured with these options are per-process, and processes may fork in order to acquire a new set of resources that are accounted independently of the original process, and may thus escape limits set. Also note that <em>LimitRSS=<\/em> is not implemented on Linux, and setting it has no effect. Often it is advisable to prefer the resource controls listed in <a href=\"https:\/\/manpages.debian.org\/bookworm\/systemd\/systemd.resource-control.5.en.html\">systemd.resource-control(5)<\/a> over these per-process limits, as they apply to services as a whole, may be altered dynamically at runtime, and are generally more expressive. For example, <em>MemoryMax=<\/em> is a more powerful (and working) replacement for <em>LimitRSS=<\/em>.<\/p>\n<p class=\"Pp\">Note that <em>LimitNPROC=<\/em> will limit the number of processes from one (real) UID and not the number of processes started (forked) by the service. Therefore the limit is cumulative for all processes running under the same UID. Please also note that the <em>LimitNPROC=<\/em> will not be enforced if the service is running as root (and not dropping privileges). Due to these limitations, <em>TasksMax=<\/em> (see <a href=\"https:\/\/manpages.debian.org\/bookworm\/systemd\/systemd.resource-control.5.en.html\">systemd.resource-control(5)<\/a>) is typically a better choice than <em>LimitNPROC=<\/em>.<\/p>\n<p class=\"Pp\">Resource limits not configured explicitly for a unit default to the value configured in the various <em>DefaultLimitCPU=<\/em>, <em>DefaultLimitFSIZE=<\/em>, &#8230; options available in <a href=\"https:\/\/manpages.debian.org\/bookworm\/systemd\/systemd-system.conf.5.en.html\">systemd-system.conf(5)<\/a>, and &ndash; if not configured there &ndash; the kernel or per-user defaults, as defined by the OS (the latter only for user services, see below).<\/p>\n<p class=\"Pp\">For system units these resource limits may be chosen freely. When these settings are configured in a user service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise the limits above those set for the user manager itself when it was first invoked, as the user&#8217;s service manager generally lacks the privileges to do so. In user context these configuration options are hence only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as configured for the user. To raise the user&#8217;s limits further, the available configuration mechanisms differ between operating systems, but typically require privileges. In most cases it is possible to configure higher per-user resource limits via PAM or by setting limits on the system service encapsulating the user&#8217;s service manager, i.e. the user&#8217;s instance of user@.service. After making such changes, make sure to restart the user&#8217;s service manager.<\/p>\n<p class=\"Pp\"><strong>Table&nbsp;1.&nbsp;Resource limit directives, their equivalent ulimit shell commands and the unit used<\/strong><\/p>\n<table class=\"tbl\" style=\"border-style: solid;\" border=\"1\">\n<tbody>\n<tr>\n<td><strong>Directive<\/strong><\/td>\n<td><strong>ulimit<\/strong> equivalent<\/td>\n<td><strong>Unit<\/strong><\/td>\n<td><strong>Notes<\/strong><\/td>\n<\/tr>\n<tr>\n<td>LimitCPU=<\/td>\n<td>ulimit -t<\/td>\n<td>Seconds<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitFSIZE=<\/td>\n<td>ulimit -f<\/td>\n<td>Bytes<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitDATA=<\/td>\n<td>ulimit -d<\/td>\n<td>Bytes<\/td>\n<td>Don&#8217;t use. This limits the allowed address range, not memory use! Defaults to unlimited and should not be lowered. To limit memory use, see <em>MemoryMax=<\/em> in <a href=\"https:\/\/manpages.debian.org\/bookworm\/systemd\/systemd.resource-control.5.en.html\">systemd.resource-control(5)<\/a>.<\/td>\n<\/tr>\n<tr>\n<td>LimitSTACK=<\/td>\n<td>ulimit -s<\/td>\n<td>Bytes<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitCORE=<\/td>\n<td>ulimit -c<\/td>\n<td>Bytes<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitRSS=<\/td>\n<td>ulimit -m<\/td>\n<td>Bytes<\/td>\n<td>Don&#8217;t use. No effect on Linux.<\/td>\n<\/tr>\n<tr>\n<td>LimitNOFILE=<\/td>\n<td>ulimit -n<\/td>\n<td>Number of File Descriptors<\/td>\n<td>Don&#8217;t use. Be careful when raising the soft limit above 1024, since <strong>select()<\/strong> cannot function with file descriptors above 1023 on Linux. Nowadays, the hard limit defaults to 524288, a very high value compared to historical defaults. Typically applications should increase their soft limit to the hard limit on their own, if they are OK with working with file descriptors above 1023, i.e. do not use <strong>select()<\/strong>. Note that file descriptors are nowadays accounted like any other form of memory, thus there should not be any need to lower the hard limit. Use <em>MemoryMax=<\/em> to control overall service memory use, including file descriptor memory.<\/td>\n<\/tr>\n<tr>\n<td>LimitAS=<\/td>\n<td>ulimit -v<\/td>\n<td>Bytes<\/td>\n<td>Don&#8217;t use. This limits the allowed address range, not memory use! Defaults to unlimited and should not be lowered. To limit memory use, see <em>MemoryMax=<\/em> in <a href=\"https:\/\/manpages.debian.org\/bookworm\/systemd\/systemd.resource-control.5.en.html\">systemd.resource-control(5)<\/a>.<\/td>\n<\/tr>\n<tr>\n<td>LimitNPROC=<\/td>\n<td>ulimit -u<\/td>\n<td>Number of Processes<\/td>\n<td>This limit is enforced based on the number of processes belonging to the user. Typically it&#8217;s better to track processes per service, i.e. use <em>TasksMax=<\/em>, see <a href=\"https:\/\/manpages.debian.org\/bookworm\/systemd\/systemd.resource-control.5.en.html\">systemd.resource-control(5)<\/a>.<\/td>\n<\/tr>\n<tr>\n<td>LimitMEMLOCK=<\/td>\n<td>ulimit -l<\/td>\n<td>Bytes<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitLOCKS=<\/td>\n<td>ulimit -x<\/td>\n<td>Number of Locks<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitSIGPENDING=<\/td>\n<td>ulimit -i<\/td>\n<td>Number of Queued Signals<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitMSGQUEUE=<\/td>\n<td>ulimit -q<\/td>\n<td>Bytes<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitNICE=<\/td>\n<td>ulimit -e<\/td>\n<td>Nice Level<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitRTPRIO=<\/td>\n<td>ulimit -r<\/td>\n<td>Realtime Priority<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>LimitRTTIME=<\/td>\n<td>ulimit -R<\/td>\n<td>Microseconds<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"Pp\">&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>PROCESS PROPERTIES LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=, LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=, LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=, LimitRTPRIO=, LimitRTTIME= Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the process resource limit concept. Process resource limits may be specified in two formats: either as single value to set a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3633,3634,3635,3636,3637,3638],"class_list":["post-1962","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-file-descriptor","tag-limitnofile","tag-umit","tag-3636","tag-3637","tag-3638"],"_links":{"self":[{"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/posts\/1962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/comments?post=1962"}],"version-history":[{"count":0,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/posts\/1962\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/media?parent=1962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/categories?post=1962"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/tags?post=1962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}