On 7/9/07, TongKe Xue <tongke / gmail.com> wrote: > I can't use Unix processes because we have too many objects. And we don't > wnat to pay the >= 8KB kernel memory for each process. > > This is for simple stuff like: > > dog: > if dist(owner) > 5 > go_in_direction_of(owner) > > but we have crap loads of these objects; and we want them to be user > scriptable (so C/C++ is a NO NO, we need an interpreted language), but we > don't want people to do crap like: > > while(1) { > get some more memory; > } > > or > > calculate_ditits_of_pi(*) > > On 7/8/07, M. Edward (Ed) Borasky <znmeb / cesmail.net> wrote: > > > > Travis D Warlick Jr wrote: > > > TongKe Xue wrote: > > >> I'm working on a massive simulation project (like worldforge). I need > > to > > >> be able to allow users to script objects in the world. I am thinking of > > >> ussing Ruby as my scripting language of choice. However: > > >> > > >> (1) I need to be able to limit the memory usage of the object. > > >> (2) I need to be able to limit the CPU cycle usage of the object. > > > > > > Try using Process#setrlimit. That being said, and aside from the fact > > > that I love Ruby -- I don't recommend it for this type of "massive" > > > endeavor. Always try to choose the best language for your application, > > > not simply "the best language" because there isn't one. > > > > > > As for what I would recommend: Not a scripting language. For massive > > > projects, use a compiled language on the back-end and then you may > > > integrate it with Ruby on the front-end. > > > > > > ************************************* > > > * Travis D Warlick, Jr > > > * Lead Developer > > > * Operis Systems, LLC > > > ************************************* > > > > > > > > Yes, nearly all of the open-source MMORPG frameworks/games are > > implemented in C/C++ and most of them provide some kind of > > controlled/controllable scripting capability. I did find *one* that is > > Ruby-based (MUES/FaerieMUD) but I was unable to find any evidence that > > it is currently active). "daimonin" seemed to be the closest to "baked" > > but it is masked in Gentoo because of some outstanding security issues, > > so I didn't experiment with it at all. > > > > > Erlang, perhaps. It's got the ability to handle lots and lots of lightweight threads, at least. Perhaps there's a way to limit the heap of eachs process, since by design processes don't share data (well, maybe they do under the hood.) I don't know about embedding it into an application, though. -- - Simen