Why doesn’t JavaScript support multithreading?

What is Multithreading?
Multithreading is a sort of execution model that enables different threads to exist inside the setting of a process with the end goal that they execute autonomously yet share their process resources. A thread keeps up a rundown of data important to its execution including the priority schedule, exception handlers, a set of CPU registers, and stack state in the location space of its hosting process.

Why doesn’t JavaScript support?
As you may most likely know, JavaScript is single-threaded. To explain better, this implies one single thread handles the event circle. For more established browsers, the entire browser shared one single thread between every one of the tabs. Present-day browsers enhanced this by utilizing either process-per-site-case or various threads per tab. Albeit devoted threads improved the responsiveness of pages, regardless it left every tab unable to deal with different scripts running at once.
Indeed, even Google Chrome won’t let a solitary website page’s JavaScript run simultaneously on the grounds that this would cause enormous concurrency issues in existing web pages. All Chrome does is split various components (various tabs, modules, etcetera) into discrete processes, yet none can’t envision a solitary page having more than one JavaScript thread.



My Personal Notes arrow_drop_up


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.