On Sun, 30 Dec 2007 14:14:22 -0300 "Martin Candurra" <martincad@xxxxxxxxx> wrote: > 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 ? Failure to create a new process due to the system running out of memory is much more common than the user running into the maximum process limit. At least - that's the one reason I can think of :) -- All rights reversed. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ