Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Jan 2008 13:45:29 +0100
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        "Igor Mozolevsky" <igor@hybrid-lab.co.uk>
Cc:        freebsd-current@freebsd.org, Robert Watson <rwatson@freebsd.org>, Jason Evans <jasone@freebsd.org>
Subject:   Re: sbrk(2) broken
Message-ID:  <86myrlahee.fsf@ds4.des.no>
In-Reply-To: <a2b6592c0801040318s9986f10u40cf725bc96304c6@mail.gmail.com> (Igor Mozolevsky's message of "Fri\, 4 Jan 2008 11\:18\:05 %2B0000")
References:  <477C82F0.5060809@freebsd.org> <863ateemw2.fsf@ds4.des.no> <20080104002002.L30578@fledge.watson.org> <a2b6592c0801040241l598ea9b7h57ad6889a1eccd3@mail.gmail.com> <86bq81c12d.fsf@ds4.des.no> <a2b6592c0801040318s9986f10u40cf725bc96304c6@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Igor Mozolevsky" <igor@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
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86myrlahee.fsf>