Re: locked reads for atomics

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: locked reads for atomics
Дата
Msg-id 20231110225522.GE1315705@nathanxps13
обсуждение исходный текст
Ответ на Re: locked reads for atomics  (John Morris <john.morris@crunchydata.com>)
Список pgsql-hackers
On Fri, Nov 10, 2023 at 09:49:06PM +0000, John Morris wrote:
> Most out-of-order machines include “read acquire” and “write release”
> which are pretty close to what you’re suggesting. With the current
> routines, we only have “read relaxed” and  “write relaxed”. I think
> implementing acquire/release semantics is a very good idea,

We do have both pg_atomic_write_u32() and pg_atomic_unlocked_write_u32()
(see commit b0779ab), but AFAICT those only differ in the fallback/spinlock
implementations.  I suppose there could be an unlocked 64-bit write on
platforms that have 8-byte single-copy atomicity but still need to use the
fallback/spinlock implementation for some reason, but that might be a bit
of a stretch, and the use-cases might be few and far between...

> I would also like to clarify the properties of atomics. One very
> important question: Are atomics also volatile?

The PostgreSQL atomics support appears to ensure they are volatile.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Failure during Building Postgres in Windows with Meson
Следующее
От: Andres Freund
Дата:
Сообщение: Re: locked reads for atomics