Doppio:多线程是如何工作的,有什么限制吗?
Doppio: how does multi-threading work and are there any limitations?
我正在研究使用 DoppioJVM 将(图形)Java 应用程序移植到 Java 脚本。为此,最好知道它如何处理 Java 脚本环境中的 Java 线程。具体来说:
- 线程可以共享内存吗?
- 线程可以 运行 在不同的 CPU 核上吗?
- 与通常的 JVM
相比,Doppio 中可能有任何其他 limitations/issues 线程
浏览 their paper on Doppio, it seems like it the JVM runs in the main Javascript thread. Or, according to this github issue on running Doppio in a worker, it runs fine in a web worker. However, it seems like the Doppio thread pool is a pool of simulated threads all in the same "real" thread, and so these don't map to web workers. This seems to be confirmed by the about page on Doppio 表示
Since JavaScript is essentially single threaded, only one thread runs at a time
所以回答我自己的问题...
Can the threads share memory?
是的,因为它们都在主 Javascript 线程/一个 worker
Can the threads run on different CPU cores?
没有,同上原因
Any other limitations/issues threads might have in Doppio compared to a usual JVM
他们论文中的一个主要观点(诚然不是特定于多线程的)是速度降低了 24 到 42 倍
感谢 Mike C 和 James Large 在评论中发布的评论 + 链接。
我正在研究使用 DoppioJVM 将(图形)Java 应用程序移植到 Java 脚本。为此,最好知道它如何处理 Java 脚本环境中的 Java 线程。具体来说:
- 线程可以共享内存吗?
- 线程可以 运行 在不同的 CPU 核上吗?
- 与通常的 JVM 相比,Doppio 中可能有任何其他 limitations/issues 线程
浏览 their paper on Doppio, it seems like it the JVM runs in the main Javascript thread. Or, according to this github issue on running Doppio in a worker, it runs fine in a web worker. However, it seems like the Doppio thread pool is a pool of simulated threads all in the same "real" thread, and so these don't map to web workers. This seems to be confirmed by the about page on Doppio 表示
Since JavaScript is essentially single threaded, only one thread runs at a time
所以回答我自己的问题...
Can the threads share memory?
是的,因为它们都在主 Javascript 线程/一个 worker
Can the threads run on different CPU cores?
没有,同上原因
Any other limitations/issues threads might have in Doppio compared to a usual JVM
他们论文中的一个主要观点(诚然不是特定于多线程的)是速度降低了 24 到 42 倍
感谢 Mike C 和 James Large 在评论中发布的评论 + 链接。