Re: sbrk(2) broken

From: Dag-Erling Smørgrav <des_at_des.no>
Date: Fri, 04 Jan 2008 13:45:29 +0100
"Igor Mozolevsky" <igor_at_hybrid-lab.co.uk> writes:
> Broadcasting SIGDANGER would be a much better option; followed by
> SIGTERM to the memory hogger (to allow for graceful termination) and
> only then SIGKILL. I can imagine a few (legitimate) scenarios when a
> user process would want to hog as much RAM as possible...

We don't currently have SIGDANGER, but the signal code was rewritten
years ago to allow more than 32 signals precisely for the purpose of
implementing an AIX-like SIGDANGER.  This wasn't done, however, and
eventually SIGTHR was the first new signal to take advantage of the
rewritten code.

> [about pre-zeroing a backing file]
> Surely you can just fseek() on the file at the correct lenght?

No.  First of all, you're thinking of lseek(), not fseek() Second, an
lseek() beyond the end of a file will not actually extend the file.
Third, ftruncate() (which *will* extend a file if it is shorter than the
requested length) or lseek() followed by write() will not allocate
physical disk space except for the data actually written; it will create
a sparse file, which when later written to will become fragmented,
resulting in horrible performance.

DES
-- 
Dag-Erling Smørgrav - des_at_des.no
Received on Fri Jan 04 2008 - 11:45:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:24 UTC