Re: Spinlock backoff algorithm - Mailing list pgsql-hackers

From Trevor Talbot
Subject Re: Spinlock backoff algorithm
Date
Msg-id 90bce5730711141450i54dff2d8v93bd07597c1843d@mail.gmail.com
Whole thread Raw
In response to Re: Spinlock backoff algorithm  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 11/14/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> The other problem with using modulo is that it makes the result depend
> mostly on the low-order bits of the random() result, rather than mostly
> on the high-order bits; with lower-grade implementations of random(),
> the lower bits are materially less random than the higher.  Now
> admittedly high-grade randomness is probably not too important for this
> specific context, but I dislike putting in poor coding practices that
> someone might see and copy without thinking...

If there's a dependency on a particular quality of random()
implementation, why not just include one?  Mersenne Twister is easy,
while not being cryptographic strength.
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html


pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: Simplifying Text Search
Next
From: Tom Lane
Date:
Subject: Re: LDC - Load Distributed Checkpoints with PG8.3b2 on Solaris