Phil Ingrey bio photo

Phil Ingrey

'The dumbest smart person I know' - a friend

Email Twitter LinkedIn Github CV

Web workers are a great part of the html5 specification. They let you run a javascript program in a separate process; so that complex tasks can be done in the background without blocking nice, fluffy, user interactions with the page. Better still, if multiple web workers are run and multiple CPUs are available then they get scheduled across all the processor - multi-core javascript enables whole new avenues of complex (and awesome) code to be written and deliver a great experience.

....you can probably sense the but coming.....but - this means any page you navigate to, any link you click, any random website with funny pictures of cats on, has unfettered access to your CPU. While you browse worldsfunniestcats.com, it could be using your electricity to generate BitCoins for itself, or crack passwords.

To prove a point, below is a page that spawns a few web workers and sets them, continuously, generating prime numbers. Open up the page in a modern browser and check out your task manager (closing the page kill the web workers):