lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Aug 7, 2015 at 10:33 AM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Fri, Aug 7, 2015 at 12:18 PM, Rena <hyperhacker@gmail.com> wrote:
>>> and it's terribly inefficient: in multicore hardware, most simple
>>> locks are by nature system-wide, having to propagate to _every_ core
>>> in the system.  By experience, even in a high-memory-bandwidth system
>>> like modern Xeon familes, there's a low maximum number of inter-core
>>> messages per second.  Think like a core can do several thousand
>>> operations in the same time as propagating just one lock.
>>
>> Ouch. It's really necessary to allocate a hardware lock every time? Not
>> enough to use an atomic test-and-set instruction on a per-shared-object lock
>> flag?
>
>
> AFAIK, there's no such thing as a "hardware lock" in common x86 chips.
> lately, i've been doing most of my inter-process synchronization via a
> shared small integer.  the special case of single-producer,
> single-consumer fixed-size ring buffer can be safe even without
> explicit locking.

Oh, there quite is:

http://x86.renejeschke.de/html/file_module_x86_id_159.html

Most of the time this is the mechanism used for implementing mutexes.

/s/ Adam