https://raw.githubusercontent.com/dillonzq/LoveIt/master/exampleSite/assets/images/avatar.png

closure

what: 函数与外部变量关闭起来,使得外部变量在作用域结束后继续存活。 1 2 3 4 5 6 7 func outer() func() int { var counter = 0 return func() int { counter++ return counter } } pros: a function can remember some satate between calls vs anonymous function: anonymous func: have no name closure: 在go, closure 都是以anonymous的形式存在, how: create a closure struct 1 2 3 4 type Closure struct { F *fun X *int } why varaible keep when function return: 和 closure 一起逃逸到heap 上

function

first class first class citizen: passed as an argument; be returned as result of funtions;; assigned to a variable anonymous function; have no name; scope what? 一块区域,在这个区域声明的变量只在这个区域(以及下级区域)可见 types: block scope: in block; function scope: in funciton gloabl scope: global lexical scope/ static scope vs dymanic scop 编译时决定了变量可见范围 运行时再决定变量可见范围

memory

【原创】(十四)Linux内存管理之page fault处理 lec16_OS_virtual_memory What Is Swappiness on Linux? (and How to Change It) 0. memory section 分区; text(code): 代码区 data: rodata: 只读区;主要存储字符串常量; const 变量; initialized data: 全局变量和static变量; uninitialized data: 未初始化; stack heap text and data 大小在加载程序后就确定了; 非连续空间: 只有堆是非连续空间;一开始是连续的, 在分配过程破碎。 回收; 不需回收: code,data; 存在整个程序声明周期; 自动回收: stack;基于栈这种数据结构, 在方法return后这段栈上分配的空间就都释放了; 需要垃圾回收器: 堆; 静态存储区: 代码区,数据区 存在整个生命周期,不需回收; 除了bbs, 其他数据在程序启动的时候就创建好; 动态存储区: 堆,栈 存在一段时间, 需要回收; ram overview page table entries (PTE); ram被分成 n份 PAGE_SIZE; 程序不能直接读写ram,而是读写中间层virtual memory; pageTable是virtual memory 到 physical memory的映射;

io model

unp https://www.geeksforgeeks.org/udp-server-client-implementation-c/ Networking with C 【操作系统】I/O 多路复用,select / poll / epoll 详解 彻底理解 IO 多路复用实现机制 Understanding Reactor Pattern Thread-Based and Event-Driven Redis 多线程网络模型全面揭秘 彻底搞懂Reactor模型和Proactor模型 五分钟快速理解 Reactor 模型 Redis与Reactor模式 高性能网络框架:Reactor 和 Proactor Redis 多线程网络模型全面揭秘 Go netpoller 原生网络模型之源码全面揭秘 IO多路复用到底是不是异步的? - 闪客sun的回答 - 知乎 The reactor pattern Node js Event loop : Behind the scenes (Reactor pattern) Redis 多线程网络模型全面揭秘 overview readData copy from internet to kernel: cost time copy from kernal to userspace core problem: 如何检测内核是否有数据了

https://www.ruanyifeng.com/blog/2013/07/rsa_algorithm_part_two.html 一文彻底搞懂加密、数字签名和数字证书! encrypt methods asymmetric encryption RSA: the main(standard) symmetric encryption asymetric 1 2 publicKey = data * dataE privateKey = 10(data * dataE) limit: high overhead; both public key and prvate key can use to encrypt; but we usually use public key to send message: for: send symetic key; if we use private key to send message, everyone have public key can decrypt it generate sign: check the content is complete;

prometheus

know the basic knowledage of promethueus create a basic server to monitor redis 1. what is ? prometheus: prom: 主要是存储采集的数据 exporter: 采集数据 grafana: 前端,展示数据 exporter: 采集和转换数据 不存储数据,只有 metrics 调用时候才采集 和转换 Time Series Data what: 相比mysql, 只有 2-3 列, key, value, timestamp 数据是基于timestamp 产生的 适用于监控 Prometheus time series data: meteria, label: 相当于 key value timestamp 1 2 - `http_requests_total{method="GET", status="200"} 1023 @ 1670000000` - `http_requests_total{method="POST", status="200"} 978 @ 1670000000` promql 语法: