ПО, ЭВМ и АСУ из Таможенного Союза

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » ПО, ЭВМ и АСУ из Таможенного Союза » многопоточность » Interlocked операции и выравнивание в памяти


Interlocked операции и выравнивание в памяти

Сообщений 1 страница 3 из 3

1

микрософт говорит, выравнивать обязательно:
"Once upon a time, Microsoft supported WindowsNT on processors other than x86, such as MIPS, PowerPC, and Alpha. These processors all require alignment for their interlocked instructions, so Microsoft put the requirement in their spec"

http://stackoverflow.com/questions/8818 … -alignment

If you pass an unaligned pointer to one of the Interlocked functions, the operation will still succeed, but the result won't be atomic.
Another processor may see a partially-completed update.

Вот тут имеется в виду Socket или Core ?

it happens only on multiprocessor machines

Всё равно непонятно.

lock# signal on the bus
IA-32 System programming guide, section 7.1.2.2

"The integrity of a bus lock is not affected by the alignment of the memory field. The LOCK semantics are followed for as many bus cycles as necessary to update the entire operand."

the LOCK# signal insures that the processor has exclusive use of any shared memory while the signal is asserted.
Locked instructions have a total order.

это же получается он все другие процессоры заставляет ждать при любом доступе к любой памяти по любому адресу, не?
Тогда получается, что все эти модные lock-free алгоритмы, на самом деле не такие выгодные?

0

2

Лис написал(а):

Вот тут имеется в виду Socket или Core ?

Мне кажется, что с точки зрения шины не имеет значения. Даже виртуальные процессоры HT -- отдельные устройства с точки зрения шины.

0

3

Freeman написал(а):

Мне кажется, что с точки зрения шины не имеет значения.

не все локи одинаково полезны:

xchg (optimized instruction with implicit LOCK prefix, optimized due to ability to cache lock and avoid a full bus lock to main memory).

Если она, допустим, прооптимизировала и залочила только кеш. То в многопроцессорной системе на другом процессоре будет dirty read или как?

problem of lock contention
https://www.infoq.com/news/2008/05/click_non_blocking

1) A large, fast array to hold all the data which allows rapid parallel reads of the data and also allows a parallel, incremental, concurrent copy.
2) Atomic-update on those array words (using java.util.concurrent.Atomic.*). The Atomic update will use either Compare and Swap (CAS) if the processor is Azul/Sparc/x86, or Load Linked/Store-conditional (LL/SC) on the IBM platform.
3) A Finite State Machine (FSM) built from the atomic update and logically replicated per array word. The FSM supports array resize and is used to control writes.

With these basic elements in place, Click then constructs an algorithm from many FSM steps that is lock free, ie each CAS makes progress. A CAS success is a local success, whilst a CAS failure means another CAS succeeded. If the CAS is successful the state machine advances, whilst a failed CAS retries.

Отредактировано Лис (2017-03-26 21:51:59)

0


Вы здесь » ПО, ЭВМ и АСУ из Таможенного Союза » многопоточность » Interlocked операции и выравнивание в памяти