网站建设推销,苏州行业网站建设费用,网站制作免费,接广告推广进程和线程
进程#xff08;process#xff09;#xff1a;计算机已经运行的程序#xff0c;是操作系统管理程序的一种方式#xff0c;我们可以认为#xff0c;启动一个应用程序#xff0c;就会默认启动一个进程#xff08;也可能是多个进程#xff09;。
线程… 进程和线程
进程process计算机已经运行的程序是操作系统管理程序的一种方式我们可以认为启动一个应用程序就会默认启动一个进程也可能是多个进程。
线程thread操作系统能够运行运算调度的最小单位通常情况下它被包含在进程中每一个进程中都至少启动一个线程来执行应用程序的代码这个线程被称为主线程。 宏任务微任务
宏任务队列macrotask queueajax、setTimeout、setInterval、DOM监听、UI Rendering等
微任务队列microtask queuePromise的then回调、 Mutation Observer API、queueMicrotask()等 面试题
setTimeout(function () {console.log(setTimeout1);new Promise(function (resolve) {resolve();}).then(function () {new Promise(function (resolve) {resolve();}).then(function () {console.log(then4);});console.log(then2);});
});new Promise(function (resolve) {console.log(promise1);resolve();
}).then(function () {console.log(then1);
});setTimeout(function () {console.log(setTimeout2);
});console.log(2);queueMicrotask(() {console.log(queueMicrotask1)
});new Promise(function (resolve) {resolve();
}).then(function () {console.log(then3);
});