1. Chrome搜索自身的DNS缓存(仅有一分钟生命力) 查看:chrome://net-internals/#dns 2. 如果Chrome找不到,或者DNS失效,便会------>>>> 搜索操作系统自身的DNS缓存 3. 前两步都没有找到,就会--------->>>>>>>>>读取本地的HOST文件 4. 浏览器发起一个DNS的系统调用(一般是宽带运营商提供的) 5. 浏览器获得域名对应的IP地址后,发起HTTP“三次握手” 6. TCP/IP连接建立后,浏览器向服务器发送HTTP请求。(比如,使用GET方式,请求一个根域里的一个域名) 7. 服务器向浏览器返回响应结果,包括响应头和响应体 8. 浏览器收到响应之后进行渲染
1. 查看本身缓存 2. 发起一个迭代DNS解析请求 3. 把结果返回操作系统内核并缓存起来
Some basic concepts in JS
The callback is a function that encapsulates the subsequent logic into the parameters of the starting function and nests it layer by layer.
Synchronous: After sending data, wait for a response before sending the next data packet.
Asynchronous: after sending data, waitResponse, then send the next data packet communication method
In the file system:
磁盘的写入(in) 磁盘的读取(out)
One timecan only executeOneprogram is calledsingle-threaded
One timecan Executing multiple programs is called multithreading
Blocking: You have to wait until the previous program has been executed
Non-blocking:When the previous program has not been executed You can suspend, continue to execute other programs, and then execute it when it is used
A triggered action (such as clicking a button)
An operation caused by a trigger action (for example, a dialog box pops up after clicking a button)
A callback function is registered for a certain event, but this callback function is not executed immediately ,
will only be called when the event occurs Function, the way this function is executed is called Event-driven.
This kind of registered callback is based on event-driven callback.
If these callbacks are related to asynchronous I/O (data writing, reading) operations, they can be regarded as asynchronous I/O based on callbacks.
It’s just that this kind of callback is driven by events in nodejs
Event loop Eventloop, if there are a large number of asynchronous operations, such as some I/O time-consuming operations, or even some timer-controlled delayed operations,
they are completed The corresponding callback function must be called at all times to complete some intensive tasks without blocking the entire program execution process. At this time, a mechanism is needed to manage, which is called an event loop
In summary, the mechanism for managing a large number of asynchronous operations is called an event loop.
The above is the detailed content of Node.JS related knowledge. For more information, please follow other related articles on the PHP Chinese website!