0

I am trying to learn the nuances between pid_max and setting user limits through ulimit. My understanding is that, no matter how high you set the user limits (for example setting user max processes to 120,000) in theory won't do anything if your pid_max is set to 32,000. In that case the pid_max limit would reached before ever reaching the user limit.. is that correct?

Is there a bash script I can run that spin up some fake processes so that I can do some testing on a VM?

4
  • Yes so if there are two limits: e.g. it can not be above 100 and it can not be above 200, then it must be 100 or less. Commented Sep 16, 2019 at 20:04
  • @ctrl-alt-delor so it is true that the pid_max limit, is a system wide kernel limit and that value needs to be higher than what you set as the user limits multiplied by the number of users? Commented Sep 16, 2019 at 20:11
  • No. For example my ulimit for processes is infinite. And infinite multiplied by a finite number of users is higher than pid_max.I process can not be started if that will result in to many (for what ever reason). Commented Sep 17, 2019 at 20:43
  • A process that does nothing is still a process (not a fake). Commented Sep 17, 2019 at 20:44

1 Answer 1

1

Is there a bash script I can run that spin up some fake processes so that I can do some testing on a VM?

I would go with starting a bunch of sleep processes. They don't use a lot of resources, other than the PID, and they die off eventually by themselves.

For example this:

for i in {1..100}; do
    sleep 300 &
    disown
done

should start a hundred processes. Normally, the shell would track background processes and that might cause some limitations. The disown prevents that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .