I wanted to know if workers in JS are the same as threads? Is there really parallelism or it's just context switching?
Asked
Active
Viewed 96 times
0
-
1Well threads can involve context switching too. – Pointy Oct 17 '16 at 19:54
-
1It depends on the implementation (and the number of used cores) – Bergi Oct 17 '16 at 20:05
-
Why do you ask? It doesn't really matter (cannot cause problems) since webworkers cannot share memory. – Bergi Oct 17 '16 at 20:06
1 Answers
1
Web Workers is basically an HTML5 API that runs a named JavaScript file, which contains the code that will run in the worker thread. Web Workers provide a facility for creating new threads that can execute scripts concurrently, thus creating a multi threaded architecture in which the browser can accomplish multiple tasks asynchronously.

Muhammad Faizan Uddin
- 1,339
- 12
- 29