5 ms·
Weird digression: Where is he getting the term "interlocked"? That's not the industry term ("atomic"), nor is it something from Intel (who talk about the LOCK
by ajross 4y ago
Weird digression: Where is he getting the term "interlocked"? That's not the industry term ("atomic"), nor is it something from Intel (who talk about the LOCK prefix, and a "bus lock" in older hardware manuals, the word "interlock" appears in the SDM in just a few places where it's talking about pipeline stall behavior).
Chen seems to be using it confidently, and it's clearly there in the names of the API entry points. Is this just something Microsoft made up? It's the first I've noticed it.
- deleted 4y ago[deleted]
- twoodfin 4y agoI think it’s as simple as the industry not having reached consensus on “atomic” at the time Microsoft was naming these things. The terminology around concurrent programming was absolutely in flux in the late ‘80s & early ‘90: Windows programmers were more familiar with “critical sections” as an abstraction than mutexes.
- dblohm7 4y ago> Windows programmers were more familiar with “critical sections” as an abstraction than mutexes. I disagree on that front. Mutex kernel objects have existed just as long as critical sections. Critical section objects are cheaper because they don’t switch into the kernel when not contended.
- asveikau 4y agoA Win32 critical section enters the kernel when blocked. (Edit: nevermind, you're not disputing this) A pthread mutex on Linux won't enter the kernel when uncontended (thanks to futex -- this wasn't true ~20 years ago). I would say the terms are pretty synonymous, and implementation choices differ; sometimes implementation choices are implied by the name but I don't think everybody agrees on how those choices map to names.
- codeflo 4y agoThat’s only an implementation/optimization difference, I think it’s also relevant to understand why that’s the case. At the API level, the important distinction is that a Mutex an be shared between processes. This is great when you need it, but having the capability makes Mutexes have a somewhat expensive implementation. CriticalSections stay inside the process, so can be optimized for that (more common) use case.
- dblohm7 4y agoPrecisely.
- Semaphor 4y ago> A safety device that prevents activation in unsafe conditions. -- https://en.wiktionary.org/wiki/interlock#Noun https://en.wiktionary.org/wiki/interlock#Noun Which seems weirdly fitting considering the Win98 behavior on 80386 CPUs ;) Further googling leads me to believe that MS indeed made the term up for referring to atomic operations back then, but they kept it ever since.
- userbinator 4y agoI suspect it's just a Microsoft-ism that came from the LOCK prefix.
- pjtr 4y agoI don't think Microsoft invented it: > On the CDC CYBER, an interlock register is available ... Operation of this interlock register is similar to TEST AND SET Concurrency in Operating Systems, October 1976 https://www.computer.org/csdl/magazine/co/1976/10/01647182/13rRUwwslyQ https://www.computer.org/csdl/magazine/co/1976/10/01647182/1...
- zinekeller 4y agoTo add to this, an interlock (which unfortunately is a dated term) is the part of the hardware checking for atomicity when required.