L
L
lssssssssssl2021-06-16 13:11:20
JavaScript
lssssssssssl, 2021-06-16 13:11:20

Why is there only one call stack in JS engines?

Because of this, as I understand it, JS is called a single-threaded language (Because the call stack of the engines is one, and it goes in order). Why didn't they do 2,3,4? What is the rationale for this?

On the Internet, I completely met such a sentence: "JavaScript has only one call stack, since it is a single-threaded language."
From which we can conclude that the number of stacks depends on the number of threads in the language - some kind of nonsense, I don’t I see. A language is a set of letters, what streams it can have.

ps Well, perhaps you will find some useful materials on this topic (On the deeper work of js engines), I will be glad to accept your links!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-06-16
@lsssssssssl

JavaScript has only one call stack, as it is a single-threaded language.

A bit of a crooked wording, of course) It's just that before JS was only in browsers, and it was single-threaded, as it was used mainly for any kind of interactive - it was necessary to actively work with the DOM.
1. The DOM cannot be accessed simultaneously from several threads
2. There were no tasks for multithreading on the front-end
Now there is a Web worker for multithreading , and the same node, for example, is multithreaded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question