Subj : Can I have more than one runtime to facilitate multiple threads? To : netscape.public.mozilla.jseng From : davisc@iivip.com (Chris Davis) Date : Mon Jun 30 2003 02:47 pm Can I achieve "thread safety" by having each thread create its own runtime, & only ever have a particular thread reference its runtime and contexts that only it created? Some background...under Linux, I had well over 200 threads using an extensive amount of javascript using the threadsafe version of Spidermonkey, nspr, etc. It worked, but I located a performance bottleneck in JScalls' use of a single runtime across threads. By "bottleneck" I mean it appears all these threads were continually waiting on locks inside JS and didn't get enough processor time. When I split the application out into 200 single threaded processes, a huge performance boost (CPU idle time went way up from zero) was achieved, but now of course it uses a lot more memory. As I browse the JS library code, it appears all(?) variables and such are stuffed into the runtime and contexts, which makes it appear this concept would work, even if not using the threadsafe JS #defines and npsr. .