网络工作者是绿色还是红色?

时间:2021-11-03 19:36:46

We can create a new instance of a web worker as such:

我们可以创建一个web worker的新实例:

var worker = new Worker('task.js');

Are each web worker backed by its own native thread, or is there a pool of native threads allocated per window which all web workers of that window will then share?

每个Web工作者是否都有自己的本机线程支持,或者是否每个窗口都分配了一个本机线程池,然后该窗口的所有Web工作者将共享这些线程?

Are there standard implementation guidelines that browsers are supposed to follow?

是否存在浏览器应遵循的标准实施指南?

What about the state of popular browsers like Chrome, FireFox, etc?

Chrome,FireFox等流行浏览器的状态如何?

1 个解决方案

#1


5  

The W3C standard says this about Web Workers execution context:

W3C标准说明了Web Workers的执行环境:

Create a separate parallel execution environment (i.e. a separate thread or process or equivalent construct), and run the rest of these steps asynchronously in that context.

创建单独的并行执行环境(即单独的线程或进程或等效构造),并在该上下文中异步运行其余步骤。

Essentially, a browser can implement this however it pleases. Any, or all, or none of your suggestions may apply.

从本质上讲,浏览器可以实现这一点,但它很高兴。您的建议中的任何一项,全部或全部都不适用。

Here's the reference: http://www.w3.org/TR/workers/

以下是参考资料:http://www.w3.org/TR/workers/

#1


5  

The W3C standard says this about Web Workers execution context:

W3C标准说明了Web Workers的执行环境:

Create a separate parallel execution environment (i.e. a separate thread or process or equivalent construct), and run the rest of these steps asynchronously in that context.

创建单独的并行执行环境(即单独的线程或进程或等效构造),并在该上下文中异步运行其余步骤。

Essentially, a browser can implement this however it pleases. Any, or all, or none of your suggestions may apply.

从本质上讲,浏览器可以实现这一点,但它很高兴。您的建议中的任何一项,全部或全部都不适用。

Here's the reference: http://www.w3.org/TR/workers/

以下是参考资料:http://www.w3.org/TR/workers/