digitalmars.D - Thin Locks in D
- Walter Bright (3/3) Jul 24 2008 http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/
- Craig Black (5/8) Jul 24 2008 Very cool stuff. So is a future version of D going to use thin locks wh...
- Jarrett Billingsley (5/15) Jul 24 2008 It's something that's part of the runtime lib. I think they can be
- superdan (2/20) Jul 24 2008 but i thot (hoped) that bartosh works on phobos already?
- Walter Bright (3/6) Jul 24 2008 The way the locks work is independent of the compiler, it's a pure
- Sean Kelly (3/20) Jul 24 2008 From what I understand, it's being redesigned to work a lot like Tango.
- bearophile (5/6) Jul 25 2008 Ah, I see, the start of a convergence :-)
- Graham St Jack (3/8) Jul 24 2008 Very nice. I particularly like the part about not needing thread-safe an...
- superdan (2/7) Jul 24 2008 very cool stuff that's gonna cross the t in threads for d. i'm so very g...
- Walter Bright (5/16) Jul 24 2008 We are very lucky to have Bartosz working with us. He's an expert on
- JAnderson (5/22) Jul 25 2008 That's really cool. How long has Bartosz been working with you? You've...
- superdan (2/26) Jul 25 2008 judging by his articles andrei also knows his shit. walter seems to have...
- Walter Bright (2/6) Jul 25 2008 We hope to have something concrete by September.
- Robert Fraser (3/20) Jul 25 2008 So, the STM stuff Bartoz was talking about at the conference... is that ...
- Sean Kelly (3/23) Jul 25 2008 From what I hear, yes.
- Lionello Lunesu (18/21) Jul 24 2008 I remember reading somewhere that critical-sections on Windows do just t...
- Sean Kelly (3/14) Jul 24 2008 They pretty much do. And futexes are largely the same thing in Linux.
- Leandro Lucarella (13/24) Jul 25 2008 So, why D must reinvent the wheel, duplicating a well known technique do...
- superdan (2/20) Jul 25 2008 there is no reinvention. the man quotes his sources. at most there is re...
- Leandro Lucarella (9/31) Jul 25 2008 Then please don't add this at all! It's a little lame add overhead to al...
- Jesse Phillips (5/36) Jul 26 2008 I'm pretty sure that just because your OS handles multi-threading this
- Leandro Lucarella (11/49) Jul 27 2008 Parse error =)
- Sean Kelly (7/27) Jul 25 2008 reimplementation. and that's unavoidable as far as i understand. thin lo...
- JAnderson (3/8) Jul 24 2008 Thanks a very interesting read!
- Alberto Bertogli (16/39) Jul 25 2008 No, it's not unavoidable.
- lurker1024 (3/8) Jul 25 2008 That's really nice. Have you run some benchmarks on this? Also, are ther...
- Sean Kelly (4/11) Jul 25 2008 plans to implement this on Tango too?
http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/
Jul 24 2008
"Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/Very cool stuff. So is a future version of D going to use thin locks when the synchronize keyword is used? -Craig
Jul 24 2008
"Craig Black" <craigblack2 cox.net> wrote in message news:g6ba04$1pfb$1 digitalmars.com..."Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...It's something that's part of the runtime lib. I think they can be implemented in Tango already. I'm not sure how robust Phobos is in terms of monitor flexibility.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/Very cool stuff. So is a future version of D going to use thin locks when the synchronize keyword is used? -Craig
Jul 24 2008
Jarrett Billingsley Wrote:"Craig Black" <craigblack2 cox.net> wrote in message news:g6ba04$1pfb$1 digitalmars.com...but i thot (hoped) that bartosh works on phobos already?"Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...It's something that's part of the runtime lib. I think they can be implemented in Tango already. I'm not sure how robust Phobos is in terms of monitor flexibility.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/Very cool stuff. So is a future version of D going to use thin locks when the synchronize keyword is used? -Craig
Jul 24 2008
Jarrett Billingsley wrote:It's something that's part of the runtime lib. I think they can be implemented in Tango already. I'm not sure how robust Phobos is in terms of monitor flexibility.The way the locks work is independent of the compiler, it's a pure runtime library thing.
Jul 24 2008
Jarrett Billingsley wrote:"Craig Black" <craigblack2 cox.net> wrote in message news:g6ba04$1pfb$1 digitalmars.com...From what I understand, it's being redesigned to work a lot like Tango. Sean"Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...It's something that's part of the runtime lib. I think they can be implemented in Tango already. I'm not sure how robust Phobos is in terms of monitor flexibility.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/Very cool stuff. So is a future version of D going to use thin locks when the synchronize keyword is used? -Craig
Jul 24 2008
Sean Kelly:From what I understand, it's being redesigned to work a lot like Tango.Ah, I see, the start of a convergence :-) Is Phobos going to gain an actor-based concurrency module, beside the current threading module? Bye, bearophile
Jul 25 2008
On Thu, 24 Jul 2008 15:56:14 -0700, Walter Bright wrote:http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/Very nice. I particularly like the part about not needing thread-safe and non-thread-safe versions of library code.
Jul 24 2008
Walter Bright Wrote:http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/very cool stuff that's gonna cross the t in threads for d. i'm so very glad bartosz is on team. would he join the newsgroup, or is he a mimosa as well?
Jul 24 2008
superdan wrote:Walter Bright Wrote:We are very lucky to have Bartosz working with us. He's an expert on multithreaded programming, and even better, he spends a lot of time researching the latest in what others are doing so that D will build on best practices rather than reinvent mistakes.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/very cool stuff that's gonna cross the t in threads for d. i'm so very glad bartosz is on team. would he join the newsgroup, or is he a mimosa as well?
Jul 24 2008
Walter Bright wrote:superdan wrote:That's really cool. How long has Bartosz been working with you? You've always said that multithreading is not your strongest point. Its great to have someone on your team with that sort of experience. -JoelWalter Bright Wrote:We are very lucky to have Bartosz working with us. He's an expert on multithreaded programming, and even better, he spends a lot of time researching the latest in what others are doing so that D will build on best practices rather than reinvent mistakes.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/very cool stuff that's gonna cross the t in threads for d. i'm so very glad bartosz is on team. would he join the newsgroup, or is he a mimosa as well?
Jul 25 2008
JAnderson Wrote:Walter Bright wrote:judging by his articles andrei also knows his shit. walter seems to have his ass covered. so walter - any word on a true multiprocessing model for d coming soon? u understand it's expected to be better than java's or c++'s.superdan wrote:That's really cool. How long has Bartosz been working with you? You've always said that multithreading is not your strongest point. Its great to have someone on your team with that sort of experience. -JoelWalter Bright Wrote:We are very lucky to have Bartosz working with us. He's an expert on multithreaded programming, and even better, he spends a lot of time researching the latest in what others are doing so that D will build on best practices rather than reinvent mistakes.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/very cool stuff that's gonna cross the t in threads for d. i'm so very glad bartosz is on team. would he join the newsgroup, or is he a mimosa as well?
Jul 25 2008
superdan wrote:judging by his articles andrei also knows his shit. walter seems to have his ass covered. so walter - any word on a true multiprocessing model for d coming soon? u understand it's expected to be better than java's or c++'s.We hope to have something concrete by September.
Jul 25 2008
Walter Bright Wrote:superdan wrote:So, the STM stuff Bartoz was talking about at the conference... is that still slated for inclusion?Walter Bright Wrote:We are very lucky to have Bartosz working with us. He's an expert on multithreaded programming, and even better, he spends a lot of time researching the latest in what others are doing so that D will build on best practices rather than reinvent mistakes.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/very cool stuff that's gonna cross the t in threads for d. i'm so very glad bartosz is on team. would he join the newsgroup, or is he a mimosa as well?
Jul 25 2008
== Quote from Robert Fraser (fraserofthenight gmail.com)'s articleWalter Bright Wrote:From what I hear, yes. Seansuperdan wrote:So, the STM stuff Bartoz was talking about at the conference... is that still slated for inclusion?Walter Bright Wrote:We are very lucky to have Bartosz working with us. He's an expert on multithreaded programming, and even better, he spends a lot of time researching the latest in what others are doing so that D will build on best practices rather than reinvent mistakes.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/very cool stuff that's gonna cross the t in threads for d. i'm so very glad bartosz is on team. would he join the newsgroup, or is he a mimosa as well?
Jul 25 2008
"Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that. It sure appears that it does from WinNT.h : typedef struct _RTL_CRITICAL_SECTION { PRTL_CRITICAL_SECTION_DEBUG DebugInfo; // // The following three fields control entering and exiting the critical // section for the resource // LONG LockCount; LONG RecursionCount; HANDLE OwningThread; // from the thread's ClientId->UniqueThread HANDLE LockSemaphore; ULONG_PTR SpinCount; // force size on 64-bit systems when packed } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION; (from WinBase.h: typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;) L.
Jul 24 2008
Lionello Lunesu wrote:"Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...They pretty much do. And futexes are largely the same thing in Linux. Seanhttp://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that.
Jul 24 2008
Sean Kelly, el 24 de julio a las 23:09 me escribiste:Lionello Lunesu wrote:So, why D must reinvent the wheel, duplicating a well known technique done in most modern OS? This will only add overhead to D. Please, at least make it conditional only to OSs that don't provide this optimization by themselves. -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- "Lidiar" no es lo mismo que "holguear"; ya que "lidiar" es relativo a "lidia" y "holguear" es relativo a "olga". -- Ricardo Vaporeso"Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...They pretty much do. And futexes are largely the same thing in Linux.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that.
Jul 25 2008
Leandro Lucarella Wrote:Sean Kelly, el 24 de julio a las 23:09 me escribiste:there is no reinvention. the man quotes his sources. at most there is reimplementation. and that's unavoidable as far as i understand. thin locks must be integrated with the object model so they place that word right there and do shit with it.Lionello Lunesu wrote:So, why D must reinvent the wheel, duplicating a well known technique done in most modern OS? This will only add overhead to D. Please, at least make it conditional only to OSs that don't provide this optimization by themselves."Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...They pretty much do. And futexes are largely the same thing in Linux.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that.
Jul 25 2008
superdan, el 25 de julio a las 13:17 me escribiste:Leandro Lucarella Wrote:Then please don't add this at all! It's a little lame add overhead to all modern OS just to be a babysitter of poor ones. -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- 41% of all people take people with curly hair less seriouslySean Kelly, el 24 de julio a las 23:09 me escribiste:there is no reinvention. the man quotes his sources. at most there is reimplementation. and that's unavoidable as far as i understand. thin locks must be integrated with the object model so they place that word right there and do shit with it.Lionello Lunesu wrote:So, why D must reinvent the wheel, duplicating a well known technique done in most modern OS? This will only add overhead to D. Please, at least make it conditional only to OSs that don't provide this optimization by themselves."Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...They pretty much do. And futexes are largely the same thing in Linux.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that.
Jul 25 2008
On Fri, 25 Jul 2008 15:06:22 -0300, Leandro Lucarella wrote:superdan, el 25 de julio a las 13:17 me escribiste:I'm pretty sure that just because your OS handles multi-threading this way that your program won't just automatically inherit it. When you right your program, you have to handle all the synchronous issues yourself, otherwise all this multi-threading business would be a snap.Leandro Lucarella Wrote:Then please don't add this at all! It's a little lame add overhead to all modern OS just to be a babysitter of poor ones.Sean Kelly, el 24 de julio a las 23:09 me escribiste:there is no reinvention. the man quotes his sources. at most there is reimplementation. and that's unavoidable as far as i understand. thin locks must be integrated with the object model so they place that word right there and do shit with it.Lionello Lunesu wrote:So, why D must reinvent the wheel, duplicating a well known technique done in most modern OS? This will only add overhead to D. Please, at least make it conditional only to OSs that don't provide this optimization by themselves."Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...They pretty much do. And futexes are largely the same thing in Linux.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that.
Jul 26 2008
Jesse Phillips, el 26 de julio a las 17:27 me escribiste:On Fri, 25 Jul 2008 15:06:22 -0300, Leandro Lucarella wrote:Parse error =) -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- El discman vuelve locos a los controles, te lleva a cualquier lugar. Ajústense pronto los cinturones, nos vamos a estrellar. Evidentemente, no escuchaste el speech, que dio la azafata, antes de despegar.superdan, el 25 de julio a las 13:17 me escribiste:I'm pretty sure that just because your OS handles multi-threading this way that your program won't just automatically inherit it. When you right your program, you have to handle all the synchronous issues yourself, otherwise all this multi-threading business would be a snap.Leandro Lucarella Wrote:Then please don't add this at all! It's a little lame add overhead to all modern OS just to be a babysitter of poor ones.Sean Kelly, el 24 de julio a las 23:09 me escribiste:there is no reinvention. the man quotes his sources. at most there is reimplementation. and that's unavoidable as far as i understand. thin locks must be integrated with the object model so they place that word right there and do shit with it.Lionello Lunesu wrote:So, why D must reinvent the wheel, duplicating a well known technique done in most modern OS? This will only add overhead to D. Please, at least make it conditional only to OSs that don't provide this optimization by themselves."Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...They pretty much do. And futexes are largely the same thing in Linux.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that.
Jul 27 2008
== Quote from superdan (super dan.org)'s articleLeandro Lucarella Wrote:reimplementation. and that's unavoidable as far as i understand. thin locks must be integrated with the object model so they place that word right there and do shit with it. Yup. I think the point is trying to avoid a cache miss from having the monitor in a separate memory block. SeanSean Kelly, el 24 de julio a las 23:09 me escribiste:there is no reinvention. the man quotes his sources. at most there isLionello Lunesu wrote:So, why D must reinvent the wheel, duplicating a well known technique done in most modern OS? This will only add overhead to D. Please, at least make it conditional only to OSs that don't provide this optimization by themselves."Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...They pretty much do. And futexes are largely the same thing in Linux.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that.
Jul 25 2008
Walter Bright wrote:http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/Thanks a very interesting read! -Joel
Jul 24 2008
On Fri, Jul 25, 2008 at 01:17:58PM -0400, superdan wrote:Leandro Lucarella Wrote:No, it's not unavoidable. If you just use Linux' futexes (or, from what I read on this threads, Windows' too), you get those "thin locks" *for free*. You don't have to implement the whole CAS-based mechanism with fallback to the OS' locks, just use the locks directly: they implement the same trick. Obviously I think the trick is quite nice (and there are several articles on lwn.net describing Linux' implementation in detail, besides "man 7 futex", if you are interested), and if the underlying OS doesn't support it, it's obviously worth it. But at least Linux has been using it for years, and you gain nothing by using it on that platform. So the only thing you are going to gain on the platforms that already do it is a nice layer of overhead. Thanks, AlbertoSean Kelly, el 24 de julio a las 23:09 me escribiste:there is no reinvention. the man quotes his sources. at most there is reimplementation. and that's unavoidable as far as i understand. thin locks must be integrated with the object model so they place that word right there and do shit with it.Lionello Lunesu wrote:So, why D must reinvent the wheel, duplicating a well known technique done in most modern OS? This will only add overhead to D. Please, at least make it conditional only to OSs that don't provide this optimization by themselves."Walter Bright" <newshound1 digitalmars.com> wrote in message news:g6b1ae$up4$1 digitalmars.com...They pretty much do. And futexes are largely the same thing in Linux.http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/I remember reading somewhere that critical-sections on Windows do just that.
Jul 25 2008
Walter Bright Wrote:http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/That's really nice. Have you run some benchmarks on this? Also, are there any plans to implement this on Tango too? Thanks.
Jul 25 2008
== Quote from lurker1024 (lurker1024 mailinator.com)'s articleWalter Bright Wrote:plans to implement this on Tango too? Not sure yet. Seanhttp://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/ and of course on reddit: http://www.reddit.com/comments/6tbzc/thin_locks_in_d/That's really nice. Have you run some benchmarks on this? Also, are there any
Jul 25 2008