- Mr.XXX
概要
Javascriptはシングルスレッドである、らしい。
実行時、関数は順番待ち列に登録されていき、順番に処理されていく(処理マシーンが1つ/シングル)らしい。
誰が決めた、関数が順番待ちするとは、順番待ち列って何よ?
先に結論
Nothing in ECMAScript explicitely forbids multithreading but you can't do multithreading without...
ref.
Job Queue は先入れ先出し(FIFO)形式で、PendingJob (内部)レコードのキューである。
A PendingJob is an internal Record whose fields are specified in Table 25.
Table 25 — PendingJob Record Fields
Job The name of a Job abstract operation This is the abstract operation that is performed when execution of this PendingJob is initiated. Jobs are abstract operations that use NextJob rather than Return to indicate that they have completed.
Arguments A List The List of argument values that are to be passed to Job when it is activated.
Realm A Realm Record The Realm for the initial execution context when this Pending Job is initiated.
HostDefined Any, default value is undefined. Field reserved for use by host environments that need to associate additional information with a pending Job.
ref.
整理すると
JobQueue == [ { // PendingJob Job: Arguments: Realm: HostDefined: }, {... }, .... ]
Job Queueの種類
最低2つ
- ScriptJobs
- PromiseJobs
というかJobとは.
関係する関数・メソッド・オブジェクト
ES2015 Promise Generator Async