× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: locks
  • From: "Larry Loen" <lwloen@xxxxxxxxxx>
  • Date: Tue, 19 Jun 2001 13:00:30 -0500
  • Importance: Normal


>Locks are a function of the task dispatching
>element of the machine and do
>not rely on any processor primitives.  Correct?

Not so.  Any SMP-capable machine needs an "atomic" primative to change a
word of storage that is at the core of doing any kind of locking scheme, be
it mutex or MI locks.

For Intel IA32 it is XCHG.
For 370 the classic was  Compare-and-Swap or Test-and-Set.
PowerPC (AIX) has LWARX and STCWX.

These all manage to alter some bit of storage in a way guaranteed (in some
limited sense) that other processors either didn't also do so in a race
condition (ie two CPUs trying for the same lock) or that if they did, the
fact that more than one CPU was trying can be detected and dealt with.

These can be read up on in appropriate manuals.  In the more modern,
storage-aggressive architectures, these sorts of instructions need to be
accompanied by special "synchronization" primatives as well.  And, while
most of the "atomic" issues arise between CPUs in an SMP, some subset of
the situation may arise even in a Uniprocessor (if the lock primative can
be interrupted by, say, a page fault or time slice end), requring the above
instructions to be used in Unis as well.

What is correct is that these end up being tied, sooner or later, to task
dispatching once the decision to "wait" is made based on some other CPU
winning the race, altering the lock first.


Larry W. Loen  -   Senior Java and iSeries Performance Analyst
                          Dept HP4, Rochester MN


+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.