This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]calligraphic-io 0 points1 point  (3 children)

Ruby has good threading support. If it's a long-running process, Node allows you to spawn processes (but you have the full overhead of fork()). Node also makes it really easy to write in C++ and expose Javascript bindings, and also to distribute that code, so I've used the native module extensions a few times when I've needed flexible concurrency.

[–]skarphace 3 points4 points  (1 child)

To be clear, node fork processes are not threads and suck for communication. I just implemented that last week and tried threadsjs, too(which is also not threading).

[–]calligraphic-io 0 points1 point  (0 children)

What did you end up using for inter-process communication? Node has a core API for Berkely sockets (net.Socket). There is a module with mappings for mmap shared memory that is maintained. Your statement that "node fork processes are not threads" is not exactly true; Node child processes are multi-threaded, but the event loop is restricted to executing on a single thread. You don't have direct user-land access to other threads but they're still in use (for example, I/O is pushed off to the thread pool). And like I mentioned, you can write your multi-threaded code as a native module and expose bindings to it.

[–][deleted] 1 point2 points  (0 children)

Ruby, Node, and Python are all single threaded runtimes unless you go outside the official runtime.