Re: Spinlock backoff algorithm

From: "Trevor Talbot" <quension(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magne Mæhre <Magne(dot)Mahre(at)sun(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Spinlock backoff algorithm
Date: 2007-11-14 22:50:20
Message-ID: 90bce5730711141450i54dff2d8v93bd07597c1843d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/14/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-11-14 23:24:26 Re: LDC - Load Distributed Checkpoints with PG8.3b2 on Solaris
Previous Message Oleg Bartunov 2007-11-14 22:49:19 Re: Simplifying Text Search