- Concurrent, parallel execution
- Non-blocking execution (the worker itself is asynchronous)
- Take full advantage of multi-core machines
- With SharedWorkers, the processing power can be shared across tabs and windows
Some additional information about security, originally published at the Mozilla Developer Center…
The Worker interface spawns real OS-level threads, and concurrency can cause interesting effects in your code if you aren’t careful. However, in the case of web workers, the carefully controlled communication points with other threads means that it’s actually very hard to cause concurrency problems. There’s no access to non-thread safe components or the DOM and you have to pass specific data in and out of a thread through serialized objects. So you have to work really hard to cause problems in your code.
All of that is really meant to serve as a summary or primer for the release of my collection of Web Worker unit tests. These tests are meant to test the browser itself for support of Web Workers: