Look free ID genertion (was: Is there a more efficient threading lock?)

Jon Ribbens jon+usenet at unequivocal.eu
Wed Mar 1 21:05:18 EST 2023


On 2023-03-02, Chris Angelico <rosuav at gmail.com> wrote:
> On Thu, 2 Mar 2023 at 08:01, <2QdxY4RzWzUUiLuE at potatochowder.com> wrote:
>> On 2023-03-01 at 14:35:35 -0500,
>> avi.e.gross at gmail.com wrote:
>> > What would have happened if all processors had been required to have
>> > some low level instruction that effectively did something in an atomic
>> > way that allowed a way for anyone using any language running on that
>> > machine a way to do a simple thing like set a lock or check it?
>>
>> Have happened?  I don't know about "required," but processors have
>> indeed had such instructions for decades; e.g., the MC68000 from the
>> early to mid 1980s (and used in the original Apple Macintosh, but I
>> digress) has/had a Test and Set instruction.
>
> As have all CPUs since; it's the only way to implement locks (push the
> locking all the way down to the CPU level).

Indeed, I remember thinking it was very fancy when they added the SWP
instruction to the ARM processor.


More information about the Python-list mailing list