Deutsch   English   Français   Italiano  
<vbvdar$c99f$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: comp.arch
Subject: Re: arm ldxr/stxr vs cas
Date: Thu, 12 Sep 2024 11:53:15 -0700
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <vbvdar$c99f$1@dont-email.me>
References: <vb4sit$2u7e2$1@dont-email.me>
 <07d60bd0a63b903820013ae60792fb7a@www.novabbs.org>
 <vbc4u3$aj5s$1@dont-email.me>
 <898cf44224e9790b74a0269eddff095a@www.novabbs.org>
 <vbd4k1$fpn6$1@dont-email.me> <vbd91c$g5j0$1@dont-email.me>
 <vbm790$2atfb$2@dont-email.me> <vbr81o$3ekr7$1@dont-email.me>
 <jwv1q1ql0sg.fsf-monnier+comp.arch@gnu.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 12 Sep 2024 20:53:16 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="26dfebf598c361779a3e3249a41dbd07";
	logging-data="402735"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/FGF3KDtL6uKgAvu4NPIjcxLmCHCs9PpM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:e/XW5Ty3KtxjtiKjCwYCC4LA0gY=
Content-Language: en-US
In-Reply-To: <jwv1q1ql0sg.fsf-monnier+comp.arch@gnu.org>
Bytes: 2429

On 9/11/2024 7:33 AM, Stefan Monnier wrote:
>> I suspect at least theoretically conditions could exist where
>> having more than one lock within a cache line would be beneficial.
>> If lock B is always acquired after lock A, then sharing a cache
>> line might (I think) improve performance. One would lose
> 
> I suspect in practice this almost never happens because if it did, it
> would mean that the program would benefit from merging those two locks
> into a single one.

Side note... Address based hash locking schemes can be used to emulate 
atomics in standard C++ when is_lock_free would be false. Here is one I 
did for fun:

https://en.cppreference.com/w/cpp/atomic/atomic/is_lock_free

It can merge locks into one wrt hash collisions, think of the hash 
algorithm. Sorting the locks and removing duplicates, taking the locks 
in order makes it deadlock free. Here is an example of such a locking 
scheme. I called it the multex:

https://groups.google.com/g/comp.lang.c++/c/sV4WC_cBb9Q/m/SkSqpSxGCAAJ
(read all when you get some time...)