Jump to content

Talk:Reentrant mutex

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

"spin-lock types of structures that allow multi-core programming, where mutexes and condition variables fail". What is this supposed to mean? How do mutexes and condition variables fail at multi-core programming, and how do spin-locks allow it? Spinlocks are just a potentially more efficient mutex in some situations.. — Preceding unsigned comment added by 66.151.103.8 (talk) 16:46, 29 February 2012 (UTC)[reply]

how is busy waiting ever more efficient? Tokenseeker (talk) 22:50, 14 July 2015 (UTC)[reply]

plain english

[edit]

don't remove the plain english example. this article has been tagged as too technical, and the provided pseudocode in Motivation does not offer a breakdown of what the reentrant mutex does. Tokenseeker (talk) 22:48, 14 July 2015 (UTC)[reply]

The English example doesn't explain much either. I found it far too dense. Do we need a more application-oriented example, say, something with bank accounts? E.g., start with
class Account
    savings, current : integer

    method deposit_savings(amount : integer)
        deposit_current(-amount)
        deposit_savings(amount)

    method deposit_current(amount : integer)
        current := current + amount

    method deposit_savings(amount : integer)
        savings := savings + amount
Then add a mutex that is locked by all three methods and observe the immediate deadlock in deposit_savings? QVVERTYVS (hm?) 06:06, 16 July 2015 (UTC)[reply]
This does not explain the logic behind the actual locking mechanism in plain English. This is only an implementation of an existing mechanism. It's black box. Tokenseeker (talk) 22:04, 18 July 2015 (UTC)[reply]
I could see the two sections being merged, with the code having liberal comments roughly assimilated from the plain English example. Tokenseeker (talk) 22:08, 18 July 2015 (UTC)[reply]
I wasn't suggesting just posting that pseudocode and having the reader figure it out. I'll see if I have time to write some text. QVVERTYVS (hm?) 12:26, 20 July 2015 (UTC)[reply]

Citation needed

[edit]

TokenSeeker wants a talk page discussion of the {{citation needed}} tag in the "Software emulation" section. Although it's not a requirement to start one when placing the tag, I'll comply. As I stated in the edit summary, it is by no means obvious that the given implementation is common, or even correct. QVVERTYVS (hm?) 12:54, 15 July 2015 (UTC)[reply]

I would argue that the common practice of using lock files for file access is analogous. Tokenseeker (talk) 22:02, 18 July 2015 (UTC)[reply]