Re: DSM segment handle generation in background workers

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: DSM segment handle generation in background workers
Дата
Msg-id 20181112083358.GA1073796@rfd.leadboat.com
обсуждение исходный текст
Ответ на Re: DSM segment handle generation in background workers  (Thomas Munro <thomas.munro@enterprisedb.com>)
Ответы Re: DSM segment handle generation in background workers  (Thomas Munro <thomas.munro@enterprisedb.com>)
Список pgsql-hackers
On Sat, Oct 13, 2018 at 11:45:17PM +1300, Thomas Munro wrote:
> +    /* Set a different seed for random() in every backend. */
> +    srandom((unsigned int) MyProcPid ^ (unsigned int) MyStartTimestamp);

> -    TimestampDifference(0, port->SessionStartTime, &secs, &usecs);
> -    srandom((unsigned int) (MyProcPid ^ (usecs << 12) ^ secs));

Compared to the old code, the new code requires more wall time to visit every
possible seed value.  New code xor's the PID bits into the fastest-changing
timestamp bits, so only about twenty bits can vary within any given one-second
period.  (That assumes a PID space of twenty or fewer bits; fifteen bits is
the Linux default.)  Is that aspect of the change justified?


В списке pgsql-hackers по дате отправления:

Предыдущее
От: John Naylor
Дата:
Сообщение: doc fix for pg_stat_activity.backend_type
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: PostgreSQL vs SQL/XML Standards