Re: A true story of a crash.

david parsons (linker@z.ml.org)
Sun, 16 Aug 1998 12:12:08 -0400 (EDT)


On Sun, 16 Aug 1998, Stephen M. Benoit wrote:

> Am I missing the point? I was under the impression that there is a
> well-defined behavior when a Un*x reaches memory resource limits.
> Additional requests for resources are simply denied: currently
> executing processes don't get axed until they segfault, get signalled
> or exit().

In linux when a process allocates say a meg of memory, the kernel gives it
256k pages of Copy on write zero page mappings.

When the process actually writes to these pages, the kernel actually
allcates the memory. This gives increadble performance and memory saving
benifits.. The problem is that you can have 50 apps open and be WAY over
commited.. Then you run out of memory and process (who are not trying any
more allocations are are simply using the ram they allocated at start)
start dieing as they use those COW pages.

> How does the population in user space grow? Only a handful of ways
> I can think of:
> - malloc(3), realloc, etc.
> - fork(2)
> - execve(2)
> - ...
- touching memory allocted by a malloc

> Each one will fail if there is insufficient virtual memory, so each
> application is responsible for detecting NULL from malloc(), -1 from
> fork(), and so on, giving it a chance to do other work or exit().

Nope.

> Is this First-Come, First-Served mechanism failing in the case of the
> original poster? I suspect that once a few apps exit() from this kind
> of starvation, there would still be enough room to run bash and do
> sysadmin tasks.
>
> BTW, when you really must have your server under a lighter load to
> work properly, there are some obvious adjustments we could make,
> including more RAM. Having an emergency swap file/partition would
> be nice. On my production (2.0.xx) servers, I have hardware watchdogs
> that reset the machine if a certain userland process stops responding
> after a few minutes.
>

You are just unaware of a fundimentle behavior of Linux. This is why Linux
dies so bad when it runs out of ram, this is why Linux is so much less
memory hungry then other unixes..

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html