[Openmcl-devel] Quick HW question...

Daniel Weinreb dlw at itasoftware.com
Wed Nov 17 11:32:17 PST 2010



Derrell Piper wrote:
>> (block got-lock
>>    (loop
>>      (dotimes (i *spin-lock-tries*)
>>        (if (%store-conditional something somewhere)
>>          (return-from got-lock t)))
>>      (give-up-timeslice)))
>>     
>
> Not sure if this was pseudo-code or not, but...
>
> A trick I've seen used is to do a non-interlocked test of the spinlock
> before even trying the %store-conditional. 
You might want to check this out:

http://en.wikipedia.org/wiki/Double-checked_locking

There are hazards here which might possibly be
analogous to what you're doing, but I don't know.
>  The non-interlocked test
> will (mostly) avert the expensive %store-conditional when there's
> spinlock contention.  Depending upon your locking characteristics, this
> can be a huge win.  We used this in the VMS operating system where we
> had a hierarchy of locks that had to be acquired in a particular order,
> though it's applicable in the general case too.  
>
> Might be worth profiling...
>
> Derrell
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20101117/39a95925/attachment.htm>


More information about the Openmcl-devel mailing list