Messages in this thread | | | Date | Thu, 13 Jul 2000 09:10:09 -0400 (EDT) | From | "Mike A. Harris" <> | Subject | Re: OOM in 2.2.14 (random question) |
| |
On Thu, 13 Jul 2000, Michael Borrelli wrote:
Patient: Doctor, when I twist my foot behind my head sharply like this and then bend my knee backwards, extremely excruciating pain shoots through my leg and my spine.
Doctor: I see. Well, don't do that.
>Date: Thu, 13 Jul 2000 08:20:09 -0400 (EDT) >From: Michael Borrelli <mike@cc237069-b.brick1.nj.home.com> >To: linux-kernel@vger.rutgers.edu >Subject: Re: OOM in 2.2.14 (random question) > >>> If your solution involves killing the "guilty" program, that's awfully >>> hard to define in a generic way. A human admin can figure it out, but >>> it's a much harder task to teach the computer to make that same >>> judgment. Since we want the computer to never make mistakes, (i.e. >>> killing something important) our job is doubly hard. > >When is a program supposed to get killed? I ask because, out of >curiosity, I wrote a program to fork() and malloc() and ask for all the >memory that I have in small hunks. After a short time I began getting >"try_to_free_pages..." printk's about most programs that were open. I >(stupidly) tried to switch to another virtual console and couldn't bring >it up. I tried to switch back, but that didn't work either. No programs >could run because nothing had memory, but the kernel didn't kill >anything. (after malloc got an error it sat in a tight loop and didn't >request any more memory, so I don't think that its because the memory the >kernel would have been freeing was being allocated.) Eventually I had to >reset to get control again. Is this right? > >-mike > >Program: > >#include <stdlib.h> >#include <unistd.h> >int main() { > char gm; > > while (1) { > fork(); > errno = 0; /* clear error from fork */ > > gm = malloc(4096); > if (errno) > while(1) > nice(20); > } >} > >- >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.tux.org/lkml/ >
-- Mike A. Harris Linux advocate Computer Consultant GNU advocate Capslock Consulting Open Source advocate
... Our continuing mission: To seek out knowledge of C, to explore strange UNIX commands, and to boldly code where no one has man page 4.
- 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.tux.org/lkml/
| |