假设我不编辑文件:/proc/sys/kernel/pid_max。因此,我假设最大 PID 为 32768。
如果我创建 32769 个同时进程会发生什么情况?
答案1
从man fork
OS X(以及一般基于 BSD 的系统)开始:
ERRORS
Fork() will fail and no child process will be created if:
[EAGAIN] The system-imposed limit on the total number of processes under
execution would be exceeded.
This limit is configuration-dependent.
[EAGAIN] The system-imposed limit MAXUPRC (<sys/param.h>) on the total number
of processes under execution by a single user would be exceeded.
[ENOMEM] There is insufficient swap space for the new process.