Re: [Chicken-users] Multiple concurrent top levels?
On Thu, 01 Aug 2013 16:39:36 -0700, Dan Leslie dles...@gmail.com wrote: Regarding: http://wiki.call-cc.org/embedding Is it possible to embed chicken in such a way that there exists multiple concurrent top levels that do not directly interact unless objects are specifically passed by the programmer? -Dan I've used the embedding API to some extent, but I'm not sure about multiple toplevels. It's unclear what toplevel environment(s) you're referring to. There's the C_toplevel and I'm pretty sure there's only one of those. The Scheme toplevel runs after CHICKEN_run() is called, and can be stopped and resumed (by return-to-host and CHICKEN_continue), but that doesn't say anything about multiple, simultaneous, independent Scheme instances. Maybe that's not what you're driving at. What kind of interaction do you mean, and what would it achieve? I'm thinking it could be difficult to get there directly, but perhaps there are other ways to accomplish your goals. More info about what you have in mind would probably be helpful. J. Altfas.___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Multiple concurrent top levels?
On 8/2/2013 1:54 AM, J Altfas wrote: I've used the embedding API to some extent, but I'm not sure about multiple toplevels. It's unclear what toplevel environment(s) you're referring to. There's the C_toplevel and I'm pretty sure there's only one of those. The Scheme toplevel runs after CHICKEN_run() is called, and can be stopped and resumed (by return-to-host and CHICKEN_continue), but that doesn't say anything about multiple, simultaneous, independent Scheme instances. Yes, multiple, simultaneous and independent Scheme instances. Maybe that's not what you're driving at. What kind of interaction do you mean, and what would it achieve? I'm thinking it could be difficult to get there directly, but perhaps there are other ways to accomplish your goals. More info about what you have in mind would probably be helpful. Extracting a scheme-object from one Scheme instance and passing it to another, for instance. I've tried doing such things with multiple processes using a mix of shared memory objects and pipes, but it was ludicrously cumbersome, despite a few eggs I wrote to alleviate the process. -Dan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Multiple concurrent top levels?
Dan Leslie scripsit: Yes, multiple, simultaneous and independent Scheme instances. Unless you either (a) are deeply committed to Chicken or (b) need the fastest possible performance on a single core, then you might want to consider shifting to Chibi Scheme for this application. The dialects are reasonably close, and it's not at all hard to port Chicken code to Chibi or vice versa (I routinely develop libraries to run on both). There aren't nearly as many prepackaged libraries for Chibi, but since we have source, it's not hard to port them either if they don't involve FFI. Chibi is a byte-compiled Scheme designed to run embedded in C and in very little space. Its C API allows you to create any number of distinct execution contexts either in separate heaps (as you want here) or with shared heaps. Execution contexts for separate heaps require no locking, so they can be run in distinct OS threads, which may in turn be running on separate cores. (Chicken cannot currently do this.) In order to share an object between heaps, the C code must take responsibility for telling Chibi not to destroy the object when it is no longer referenced in its home heap, and then eventually to destroy it. Finalizers are available to assist in this. Alternatively, you can share pure C objects and use the Chibi FFI to provide Scheme with access to them. -- Barry thirteen gules and argent on a canton azure John Cowan fifty mullets of five points of the second, co...@ccil.org six, five, six, five, six, five, six, five, and six. --blazoning the U.S. flag http://www.ccil.org/~cowan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Multiple concurrent top levels?
On 8/2/2013 9:56 AM, John Cowan wrote: Unless you either (a) are deeply committed to Chicken or (b) need the fastest possible performance on a single core, then you might want to consider shifting to Chibi Scheme for this application. :D I've already been exploring chibi-scheme for the reasons that you went on to mention. It struck me that before I go 'abandoning' Chicken for this particular project that perhaps I should inquire if it were as versatile as Chibi is in this regard. Sounds like that's a no, but thanks for the details about Chibi! Oh, how much control over the GC does Chibi grant you? -Dan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users