Are Browsers Still Single-thread?
Solution 1:
Technically yes they are still all running single threads in the treatment of generating your page and actions on the front end. There are ways to make it seem like it isn't and run a javascript process independently like a pseudo multi thread using web workers introduced in html5. By pseudo I mean it works like most multi threaded processes it switches so fast between the clock interrupts it seems as if it's multi threaded. More information on web workers can be found at http://www.w3schools.com/html/html5_webworkers.asp as well as google of course.
Solution 2:
In terms of the JavaScript you get to run, yes. This is normally not an issue because anything you intend to execute in JavaScript that might take more than a millisecond can be expressed as an "asynchronous" operation (for instance, AJAX requests, animation transitions, etc). That means all your code does is start the operation, and register possible callbacks for it to finish.
There are very infrequent exceptions to that where it makes sense to have a "Web Worker", but I have never actually seen those put to use.
Post a Comment for "Are Browsers Still Single-thread?"