spin_lock

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • InuY4sha

    spin_lock

    Can anybody give me the basics (or a *basic* instructions link)
    regarding spinlocks and their usage? I really can't understand their
    meaning...
    Thanks .
    R
  • Thad Smith

    #2
    Re: spin_lock

    InuY4sha wrote:
    Can anybody give me the basics (or a *basic* instructions link)
    regarding spinlocks and their usage? I really can't understand their
    meaning...


    --
    Thad

    Comment

    • Chris Thomasson

      #3
      Re: spin_lock

      "Antoninus Twink" <nospam@nospam. invalidwrote in message
      news:slrnfvpt4n .50h.nospam@nos pam.invalid...
      On 9 Apr 2008 at 13:12, Thad Smith wrote:
      >InuY4sha wrote:
      >>Can anybody give me the basics (or a *basic* instructions link)
      >>regarding spinlocks and their usage? I really can't understand their
      >>meaning...
      >>
      >http://en.wikipedia.org/wiki/Spin_lock
      >
      That article seems to focus more on implementing spinlocks than on
      using them...
      >
      A spinlock has the same function as a mutex: they're both mutual
      exclusion locks. The only difference is the behavior when a thread tries
      to gain a lock, but the lock is already held by another thread. If a
      mutex is held by another thread, the current thread is suspended and
      doesn't resume until it can gain the lock.
      [...]

      There are so-called adaptive mutexs that act like spinlocks when contention
      arises. The difference is that the spin-count is bounded. When the limit is
      reached, the calling threads becomes a member of the mutexs waitset.

      Comment

      • Rahul

        #4
        Re: spin_lock

        On Apr 9, 5:34 pm, InuY4sha <inuY4...@email .itwrote:
        Can anybody give me the basics (or a *basic* instructions link)
        regarding spinlocks and their usage? I really can't understand their
        meaning...
        Thanks .
        R
        It is also known as busy waiting...

        Comment

        • Kaz Kylheku

          #5
          Re: spin_lock

          On Apr 9, 9:53 am, Antoninus Twink <nos...@nospam. invalidwrote:
          A spinlock has the same function as a mutex:
          ``Spinlock'' is to ``mutex'' what ``linked list'' is to ``abstract
          sequence''.

          Comment

          Working...