I'm using kubuntu 18.04
While testing a script which spawns a lot of parallel processes, I started getting fork: retry: resource temporarily unavailable
error messages. Assuming that this was a per-user process limit, I started looking through the usual process limit configurations; eventually, I convinced myself that Ubuntu is now using systemd to configure per user limits, and that the limit I need to change is TasksMax.
In particular, by recursive grepping I eventually found this file:
$ cat /run/systemd/transient/user-1000.slice
# This is a transient unit file, created programmatically via the systemd API. Do not edit.
[Unit]
Description=User Slice of rici
After=systemd-logind.service
After=systemd-user-sessions.service
[Slice]
TasksMax=10813
I understand all that, but it doesn't tell me how I do change this value. All it does is tell me how not to do it (by editing the file). It also doesn't provide the least hint of how the number 10813 was computed; on the fact of it, it seems like an odd (albeit not quite prime) value to come up with as a default.
Is there some simple command in the vein of
ulimit
which I can use to change this setting on-the-fly? Or even a complicated one? (And could I have used this hypothetical command to ascertain the current limit?)If I really have to restart my login session to change the task limit -- something I'd really prefer to avoid -- what do I have to poke to change the default value?