Re: [HACKERS] Query cancel and OOB data (fwd)

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: dg(at)illustra(dot)com (David Gould)
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Query cancel and OOB data (fwd)
Date: 1998-06-01 04:53:21
Message-ID: 199806010453.AAA27766@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Just do time and pid. But get the time from gettimeofday so it will be
> down to the millisecond or so. Anything more is overkill for this application.

You have given me exactly what I needed. If I run gettimeofday() on
postmaster startup, and run it when the first backend is started, I can
use the microseconds from both calls to generate a truely random seed.
Even if the clock is only accurate to 10 ms, I still get a 10,000 random
keyspace. I can mix the values by taking/swapping the low and high
16-bit parts so even with poor resolution, both get used.

The micro-second times are not visible via ps, or probably even kept in
the kernel, so these values will work fine.

Once random is seeded, for each backend we call random twice and return
a merge of the two random values. I wonder if we just call random once,
and XOR it with our randeom seed, if that would be just as good or
better? Cryptologists?

Comments? Sounds like a plan. The thought of giving the users yet
another option to disable cancel just made me squirm.

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hal Snyder 1998-06-01 05:33:35 Re: [HACKERS] Query cancel and OOB data (fwd)
Previous Message Bruce Momjian 1998-06-01 04:27:45 Re: [HACKERS] Lots 'o patches