Re: Maximum number of processes in Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 16 Aug 2006, Helge Hafting wrote:

> linux-os (Dick Johnson) wrote:
>> Yep....
>>
>> #include <stdio.h>
>> #include <signal.h>
>> int main()
>> {
>>      unsigned long i;
>>      for(i = 0; ; i++)
>>      {
>>          switch(fork())
>>          {
>>          case 0:		// kid
>>  	pause();
>>          break;
>>          case -1:	// Failed
>>          printf("%lu\n", i);
>>              kill(0, SIGTERM);
>>              exit(0);
>>          default:
>>              break;
>>          }
>>      }
>>      return 0;
>> }
>>
>> Shows a consistent 6140.
>>
> Doesn't work here.  Without ulimit, I wasn't surprised
> about the resulting OOM mess.
>
> Problem was, it never stopped.  I expected OOM to kill
> this program, and quite possibly lots of other running programs
> as well.  What I got, was ever-rolling OOM messages
> with stack traces inbetween.
> 2.6.18-rc4-mm1 never recovered and had to be killed by sysrq.
>
> Helge Hafting

Script started on Wed 16 Aug 2006 07:18:48 AM EDT
LINUX> gcc -o xxx xxx.c
LINUX> ./xxx
6138
Terminated
LINUX> ./xxx
6138
Terminated
LINUX> ./xxx
6138
Terminated
LINUX> ulimit
unlimited
LINUX> uname -r
2.6.16.24
LINUX> cat /proc/meminfo
MemTotal:       774572 kB
MemFree:        381984 kB
Buffers:        154120 kB
Cached:          31000 kB
SwapCached:          0 kB
Active:          74908 kB
Inactive:       130816 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       774572 kB
LowFree:        381984 kB
SwapTotal:      907664 kB
SwapFree:       907660 kB
Dirty:              28 kB
Writeback:           0 kB
Mapped:          34100 kB
Slab:           177948 kB
CommitLimit:   1294948 kB
Committed_AS:    31080 kB
PageTables:        804 kB
VmallocTotal:   515796 kB
VmallocUsed:      3524 kB
VmallocChunk:   511568 kB
HugePages_Total:     0
HugePages_Free:      0
Hugepagesize:     4096 kB
LINUX> exit
Script done on Wed 16 Aug 2006 07:19:48 AM EDT

Runs fine here. I'm using 2.6.14.24. Maybe your kernel version still
has an OEM bug???

Since the forked process never touches any of its memory, it
shouldn't use anything except space in the kernel for a new task-
structure and space in user-space for stack. COW wouldn't have
happened yet. I don't see how you get out of memory before you
run out of PIDs!

The first instance of the fork failing should cause a signal
to be sent to all the children, killing them:

         case -1:	// Failed
         printf("%lu\n", i);
             kill(0, SIGTERM);
             exit(0);


I can set /proc/sys/vm/overcommit_memory to either 1 or 0 with
the same effect, no out-of-memory errors. Maybe your kernel
version has a bug?



Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.62 BogoMips).
New book: http://www.AbominableFirebug.com/
_


****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux