Requirements:
JavaScript is single-threaded and has a task queue. For example, use Settimeou (func,secs) to add Func to the task queue after secs milliseconds. However, after the settimeout is followed by a dead loop, the dead loop causes the task to be blocked, which means that Func cannot run. I would like to ask: When the dead loop is running, secs milliseconds in the past, is the Func added to the task queue? Suppose to join, but JS is single-threaded, not joined in this thread, where is it added? The answer to the great God, a lot of things to find music, and JavaScript high-level programming in the same way.
For:
The reason is that JS is single thread. But the browser is multi-threaded. Even the multi-process. So. The same tab, there is only one interpreter. There may be more than one iframe ...The addition of maintenance is a matter of other thread Cheng Gan, and running is a single-threaded interpreter doing things. Just like Java, there is a reflection mechanism, window is a host host object. That is, he uses C language to achieve. Not within JS's interpreter thread control, just to interact. So... You are clear, logically JS is a single thread, but there are actually very many other threads in the auxiliary interpreter. The implementation details only ensure that the logical integrity of the single thread can be
Some understandings about the handle handler:
Handle.Handler, in fact, the word translation is quite graphic, although not very well understood. You can understand the remote control of the TV, the remote control in the hand. It's the equivalent of getting a TV object and trying to get the TV to do it. Then operate the "TV object". Persistence, which is generally referred to as a database, is not called persistent in memory.
The reboot is also coming. That's persistence.
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
Questions and answers to JavaScript threads