Following is the pictorial representation of the above code:
As shown in the above example, Parent thread passes a message to web-worker and the web-worker in turn does some lengthy process and replies with a processed message to the parent thread. So Due to web-workers the lengthy process is run in a different thread handled by the OS and the Main/Parent thread is left free and still active accepting inputs from user with no freezing of the browser.
1. Even Faster Web Sites by Steve Souders [http://stevesouders.com/efws/] — second chaper explains everything gears, web workers.
2. Web Workers By Ido Green [http://shop.oreilly.com/product/0636920024446.do] — explains in-depth about Web Workers, types of web workers, techniques of message passing… etc. nice book!.