Deutsch   English   Français   Italiano  
<20240619152000.2738defeceb1df7203151c64@g{oogle}mail.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Anton Shepelev <anton.txt@g{oogle}mail.com>
Newsgroups: comp.lang.c,sci.stat.math
Subject: Re: realloc() - frequency, conditions, or experiences about
 relocation?
Date: Wed, 19 Jun 2024 15:20:00 +0300
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <20240619152000.2738defeceb1df7203151c64@g{oogle}mail.com>
References: <v4ojs8$gvji$1@dont-email.me>
	<875xu8vsen.fsf@bsb.me.uk>
	<v4ovqf$j5hq$1@dont-email.me>
	<87zfrjvqp6.fsf@bsb.me.uk>
	<v4pb4v$lhgk$1@dont-email.me>
	<20240617180249.96dfaafa89392827aa162434@g{oogle}mail.com>
	<v4tuvf$1qto5$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 19 Jun 2024 14:20:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="026ce8aa09340af2ff7fb15fc26bc16e";
	logging-data="2030938"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+ND7OP8LQtEeJgm0gAIn4VUlpZD7fyRyY="
Cancel-Lock: sha1:nbNA+JHvknkLzu1lhi4p3NOjeQc=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Bytes: 2571

Malcolm McLean writes that, given the log-normal distribution
of file sizes with known parameters,

> we can work out, given that a file is at least N
> characters, what is the prbablity that an allocation of
> any size will contain the whole file, and how many bytes,
> on average will be wasted.

This is why I thought statisticians might help him: Malcolm
wants to find the aposteriori distribution of the size of a
file, after it has been found to exceed N bytes.  Am I right
that if we take the remaining (N>20) part of the density
function and re-normalise it, we shall obtain the desired
distribution?

My proposition was as follows:

  1.  Find quantile q0 corresponding to the buffer size
      currently requested.

  2.  Calculate new quantile q1 = 1-(1-q0)/k, where k>1 is
      an adjustable parameter, and use its corresponding
      value as the new allocation size.

For example, assuming for simplicity a uniform [0,20]
distribution of file sizez and k=2, a sequence of allocation
may look like this:

                requested allocated
                 2        20-(20- 2)/2 = 11
                12        20-(20-12)/2 = 16
                18        20-(20-18)/2 = 19
-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments