Paddy Byers gave great insights on the difficuties involved in the "isolates" feature. But there is not a single way to approach multi-threading in node. I'd like to dive a bit into this because I feel that there may have been a bit of a confusion.
What the "isolates" feature tried to do is put a full node runtime into every isolate. Each of these runtimes has its own event loop and can do I/O. What TAGG does is very different. The isolates only contain the basic JS runtime and are just used to host CPU intensive functions; they don't do I/O. The TAGG model is very close to the model that we have in the browser. In the browser there is only one thread that can handle the UI. Web workers don't interact directly with the DOM, they are there to handle CPU intensive operations that would block the UI otherwise. Same thing in the TAGG model: there is only one "node" thread and one event loop, the other threads are just there to support CPU intensive operations that would block the node thread otherwise. Trying to put a complete node runtime into every thread is very complex and does not seem to provide much benefit over spawning node processes. So if you want several agents that all do I/O then child processes is the way to go and the node core team should not waste any time investigating a thread alternative. But this does not mean that the idea of using threads and isolates in node is completely daft. They can be used to host CPU intensive computations so that they don't block node's main looop. If data can be passed safely and efficiently between the main thread that does I/O and such worker threads, we have something that is not outrageously complex to implement (Jorge did it in userland) and that adds value to node (you can still implement these CPU intensive operations without TAGG but you have to do it in C++). And the child process alternative is not attractive: you would get a child process with an event loop that's blocked waiting for the computation to complete :-( -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
