console
最开始的大型机、小型机,机器上有自有的控制台 a flat board that contains the controls for a machine, piece of electrical equipment, computer etc 机器、电器设备、电脑的控制台、操作台
图片来源
tty
+----------+ Physical Line +----------+
| teletype |<--------------------->| teletype |
+----------+ +----------+
tty本身就是一种终端,teletypewriter。 一种特定的设备文件(一切皆是文件),基本和terminal相同的意思。tty是计算机系统操作的文件,terminal是文件另一端的设备。 内核提供一些针对键盘、显示器这样的tty。另一些是伪tty,有仿真终端程序提供。
tty 子系统
+-----------------------------------------------+
| Kernel |
| +--------+ |
| +--------+ +------------+ | | | +----------------+
| | UART | | Line | | TTY |<---------->| User process A |
<------>| |<->| |<->| | | +----------------+
| | driver | | discipline | | driver |<---------->| User process B |
| +--------+ +------------+ | | | +----------------+
| +--------+ |
| |
+-----------------------------------------------+
TTY设备
+----------------+
| TTY Driver |
| |
| +-------+ | +----------------+
+------------+ | | |<---------->| User process A |
| Terminal A |<--------->| ttyS0 | | +----------------+
+------------+ | | |<---------->| User process B |
| +-------+ | +----------------+
| |
| +-------+ | +----------------+
+------------+ | | |<---------->| User process C |
| Terminal B |<--------->| ttyS1 | | +----------------+
+------------+ | | |<---------->| User process D |
| +-------+ | +----------------+
| |
+----------------+
键盘显示器连接
使用 Terminal Emulator
+-----------------------------------------+
| Kernel |
| +--------+ | +----------------+
+----------+ | +-------------------+ | tty1 |<---------->| User processes |
| Keyboard |--------->| | +--------+ | +----------------+
+----------+ | | Terminal Emulator |<->| tty2 |<---------->| User processes |
| Monitor |<---------| | +--------+ | +----------------+
+----------+ | +-------------------+ | tty3 |<---------->| User processes |
| +--------+ | +----------------+
| |
+-----------------------------------------+
SSH连接方式
+----------+ +------------+
| Keyboard |------>| |
+----------+ | Terminal |
| Monitor |<------| |
+----------+ +------------+
|
| ssh protocol
|
↓
+------------+
| |
| ssh server |--------------------------+
| | fork |
+------------+ |
| ↑ |
| | |
write | | read |
| | |
+-----|---|-------------------+ |
| | | | ↓
| ↓ | +-------+ | +-------+
| +--------+ | pts/0 |<---------->| shell |
| | | +-------+ | +-------+
| | ptmx |<->| pts/1 |<---------->| shell |
| | | +-------+ | +-------+
| +--------+ | pts/2 |<---------->| shell |
| +-------+ | +-------+
| Kernel |
+-----------------------------+
键盘显示器连接(图形界面)
通过图形界面的Terminal软件 (注意和 键盘显示连接 的区别)
- 使用pseudo terminal (ptmx & pts)
+----------+ +------------+
| Keyboard |------>| |
+----------+ | Terminal |--------------------------+
| Monitor |<------| | fork |
+----------+ +------------+ |
| ↑ |
| | |
write | | read |
| | |
+-----|---|-------------------+ |
| | | | ↓
| ↓ | +-------+ | +-------+
| +--------+ | pts/0 |<---------->| shell |
| | | +-------+ | +-------+
| | ptmx |<->| pts/1 |<---------->| shell |
| | | +-------+ | +-------+
| +--------+ | pts/2 |<---------->| shell |
| +-------+ | +-------+
| Kernel |
+-----------------------------+
pty
pseudo terminal
- PTY slave (shell(bash/zsh…))
- PTY master (terminal emulator (XTerm)) 监听键盘等输入、输出显示内容到XTerm等模拟终端
- tty driver 是master和slave的桥梁
- shell 是一个用户态的程序,可以启动子进程(如:cat)来和内核交互。
- vector similarity search engine, 向量相似度搜索引擎
- vector index libraries
- Faiss
- NMSLIB
- Annoy
如何找到相关的doc(召回,把所有的doc都召回,也是一种方法)
- BF 暴力 Brute Force。这个就是把所有召回,适合小数据量
- KD-Tree 适合维度比较小的场景
- HC 分层聚类 Hierarchical Clustering
- HNSW 分层的可导航小世界 Hierarchical Navigable Small World
- PQ 乘积量化 Product Quantization
- KNN 近邻图 Graph
- QGraph 量化图 Quantization Graph
- LSH 局部敏感哈希 Locality sensitive hashing
3.4 字符集 3.5 Content Codings 3.6 Transfer Codings
generic-message = start-line //start-line肯定有
*(message-header CRLF) //0到多个 header
CRLF // 空行
[ message-body ] //这是消息体(message-body),注意和entity-body 区分
start-line = Request-Line | Status-Line // 请求行 | 状态行
message-body = entity-body
| <entity-body encoded as per Transfer-Encoding>
general-header = Cache-Control ; Section 14.9
| Connection ; Section 14.10
| Date ; Section 14.18
| Pragma ; Section 14.32
| Trailer ; Section 14.40
| Transfer-Encoding ; Section 14.41
| Upgrade ; Section 14.42
| Via ; Section 14.45
| Warning ; Section 14.46
Request = Request-Line ; Section 5.1
*(( general-header ; Section 4.5
| request-header ; Section 5.3
| entity-header ) CRLF) ; Section 7.1
CRLF
[ message-body ] ; Section 4.3
request-header = Accept ; Section 14.1
| Accept-Charset ; Section 14.2
| Accept-Encoding ; Section 14.3
| Accept-Language ; Section 14.4
| Authorization ; Section 14.8
| Expect ; Section 14.20
| From ; Section 14.22
| Host ; Section 14.23
| If-Match ; Section 14.24
| If-Modified-Since ; Section 14.25
| If-None-Match ; Section 14.26
| If-Range ; Section 14.27
| If-Unmodified-Since ; Section 14.28
| Max-Forwards ; Section 14.31
| Proxy-Authorization ; Section 14.34
| Range ; Section 14.35
| Referer ; Section 14.36
| TE ; Section 14.39
| User-Agent ; Section 14.43
Response = Status-Line ; Section 6.1
*(( general-header ; Section 4.5
| response-header ; Section 6.2
| entity-header ) CRLF) ; Section 7.1
CRLF
[ message-body ] ; Section 7.2
- 1xx: Informational - Request received, continuing process
- 2xx: Success - The action was successfully received,
understood, and accepted
- 3xx: Redirection - Further action must be taken in order to
complete the request
- 4xx: Client Error - The request contains bad syntax or cannot
be fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently
valid request
entity-header = Allow ; Section 14.7
| Content-Encoding ; Section 14.11
| Content-Language ; Section 14.12
| Content-Length ; Section 14.13
| Content-Location ; Section 14.14
| Content-MD5 ; Section 14.15
| Content-Range ; Section 14.16
| Content-Type ; Section 14.17
| Expires ; Section 14.21
| Last-Modified ; Section 14.29
| extension-header
extension-header = message-header
优点
###
work over HTTP ports 80 and 443
The |Sec-WebSocket-Accept| header field indicates whether the server is willing to accept the connection.
The WebSocket Protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request.
By default, the WebSocket Protocol uses port 80 for regular WebSocket connections and port 443 for WebSocket connections tunneled over Transport Layer Security (TLS)
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
同时拥有
虚拟机的安全隔离