Re: [PATCH] Patch to Memory Subsystem ... (Needed?)

Riley Williams (rhw@bigfoot.com)
Sun, 8 Nov 1998 18:08:02 +0000 (GMT)


Hi Brian.

>>> Oh! The cobol-applications are usually run during night when nobody
>>> uses the servers - so no 'bash', 'ps' or the like are in the cache.
>>> The next morning when somebody tries to login (s)he will be denied
>>> access ....

>> What about limiting memory using ulimit()?

> With clever usage it could be used - but I am not sure how ;o)
> Point is, the program in question isn't started from a shell. I could
> do a work-around.

If it's not started from a shell, how is it started then?

The obvious fix here, assuming the current program is called PROG and
is in the current directory, would be something along the lines of:

Q> mv PROG PROG.1
Q> cat > PROG <<.EOF
Q> #!/bin/bash
Q> FM="\`free | grep '^[MS]' | tr -s ' ' | cut -d ' ' -f 4\`"
Q> FM=\$[\`echo -n \$FM | tr ' ' '+'\`]
Q> ulimit -l \`echo \$FM '3*4096/p' | dc\`
Q> PROG.1 \$\*
Q> .EOF
Q> chmod 700 PROG

Of course, change the mode in the last line to suit...the above should
limit that process to 75% of the [combined real and swap] memory free
when the program was first run...

> Still, I hate the idea that user-processes can eat all memory,
> leaving nothing to root in case of problems .........

It's certainly something to consider...

Best wishes from Riley.

-
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/