2008/7/24 Owen Anderson <resistor at mac.com>:>> * They are isolated and the only way to exchange information is >> message passing >> > This one is hard to guarantee in a compiled context, unless you > implement a lot of stuff to track pointer values. Remember, all of > these threads will be sharing an address space. If you want true > protection, you'll want something more like fork(), but that defeats > your other two goals.Couldn't this also be semi-guaranteed by the design of the language? For instance, if you completely disallow pointer arithmetics and always pass by value when passing messages. Could probably be quite a bit of copying, but if the guarantee is important, I'm guessing this is cheaper than tracking all pointers. I could easily be completely wrong. - Simon
2008/7/25 Simon Ask Ulsnes <vinterbleg at gmail.com>:> 2008/7/24 Owen Anderson <resistor at mac.com>: >>> * They are isolated and the only way to exchange information is >>> message passing >>> >> This one is hard to guarantee in a compiled context, unless you >> implement a lot of stuff to track pointer values. Remember, all of >> these threads will be sharing an address space. If you want true >> protection, you'll want something more like fork(), but that defeats >> your other two goals. > > Couldn't this also be semi-guaranteed by the design of the language? > For instance, if you completely disallow pointer arithmetics and > always pass by value when passing messages. Could probably be quite a > bit of copying, but if the guarantee is important, I'm guessing this > is cheaper than tracking all pointers. I could easily be completely > wrong. >I'll investigate on how that is achieved in Erlang, so I can ask more precise questions. I knew protothreads, but I still have to figure out the limitations resulting from the fact that local variables are not preserved when the protothread blocks. Is protothreads library able to keep a bunch of living threads during program's life that exchange data through message passing? Thanks for your suggestions, .alvaro.castro.> - Simon > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||> http://www.alvarocastro.es
> I knew protothreads, but I still have to figure out the limitations > resulting from the fact that local variables are not preserved when > the protothread blocks. Is protothreads library able to keep a bunch > of living threads during program's life that exchange data through > message passing?I would recommend against stackless threads. If you really can't afford a few KB per stack, go with an event-driven execution model where events run to completion. John
On Fri, 2008-07-25 at 09:19 +0200, Simon Ask Ulsnes wrote:> 2008/7/24 Owen Anderson <resistor at mac.com>: > >> * They are isolated and the only way to exchange information is > >> message passing > >> > > This one is hard to guarantee in a compiled context, unless you > > implement a lot of stuff to track pointer values. Remember, all of > > these threads will be sharing an address space. If you want true > > protection, you'll want something more like fork(), but that defeats > > your other two goals. > > Couldn't this also be semi-guaranteed by the design of the language? > For instance, if you completely disallow pointer arithmetics and > always pass by value when passing messages....This is excessively conservative. Any state that is deeply "pure" (therefore constant) *can* be shared, and at least some type systems are strong enough to tell you this. This potentially includes a lot of internal representation data, which significantly alters the performance trade-offs here. It is also possible to bring linear typing into messaging, as Singularity did. Where that works, no copy is required. That said, the singularity design is open to resource denial of service on the heap because they didn't get the pragmatic details of linear-typed messaging quite right. shap
On Friday 25 July 2008, Jonathan S. Shapiro wrote:> It is also possible to bring linear typing into messaging, as > Singularity did. Where that works, no copy is required. That said, the > singularity design is open to resource denial of service on the heap > because they didn't get the pragmatic details of linear-typed messaging > quite right.Hi, do you have pointers to more informations about this, or could you elaborate? Thanks. Torvald