Home > Web Front-end > JS Tutorial > body text

Node.JS related knowledge

一个新手
Release: 2017-09-21 09:49:20
Original
1974 people have browsed it

When entering a URL, the browser——

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. 浏览器收到响应之后进行渲染
Copy after login

and the operator server——————

1. 查看本身缓存

2. 发起一个迭代DNS解析请求

3. 把结果返回操作系统内核并缓存起来
Copy after login

the operating system kernel returns the result to the browser

Some basic concepts in JS

1. What is a callback function?

The callback is a function that encapsulates the subsequent logic into the parameters of the starting function and nests it layer by layer.

2. What is synchronization/asynchronous?

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

3. What is I/O?

In the file system:

            磁盘的写入(in)
            磁盘的读取(out)
Copy after login

4.What is single thread/multi-thread?

One timecan only executeOneprogram is calledsingle-threaded

One timecan Executing multiple programs is called multithreading

5. What is blocking/non-blocking?

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

6. What is an event?

A triggered action (such as clicking a button)

7. What is event-driven?

An operation caused by a trigger action (for example, a dialog box pops up after clicking a button)

8. What is an event-driven callback?

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

9. What is an event loop?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template