Messages in this thread | | | Subject | Re: OOM in 2.2.14 (random question) | Date | Thu, 13 Jul 2000 08:20:09 -0400 (EDT) | From | (Michael Borrelli) |
| |
>> 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/
| |