Hi all,
I have been looking the copy_process function (in fork.c file) to
understand how the kernel create new processes.
In line 1004, the function verify if the current user is able to create a
new process, by checking if the value stored in rlim[RLIMIT_PROC] is equal
or smaller than the number of processes owned by the user. This comparison
is performed after creating the new process task_struct using
dup_task_struct (line 993).
I'm wondering why the code does not perform the resource limit comparison
before creating the new process task_struct. In case the user cannot create
more processes, some cpu cycles will be saved. I'm sure there is a good
reason for not doing it as I'm think it should be. Can anyone shed any light
on this ?
Thanks in advance.
Regards.