随笔分类 - golang
golang相关:面试题、源码解读、库使用
摘要:国密sm4-golang使用 sm4 国密SM4算法是一种分组加密算法。SM4分组密码(block cipher)算法是一种迭代分组密码算法,由加解密算法和密钥扩展算法组成。 SM4是一种Feistel结构的分组密码算法,其分组长度和密钥长度均为128bits。加密算法和密钥扩展算法迭代轮数均为32
阅读全文
摘要:gmp调度 线程、协程、进程 进程: 是资源分配的最小单位,是程序的一次执行过程,是一个动态概念,是系统进行资源分配和调度的一个独立单位. 线程: 是程序执行的最小单位,是进程中的一个实体,是被系统独立调度和分派的基本单位,线程自己不拥有系统资源,只拥有一点在运行中必不可少的资源(如程序计数器,一组
阅读全文
摘要:组合式继承 code package main import ( "fmt" ) type People struct{} func (p *People) ShowA() { fmt.Println("showA") p.ShowB() } func (p *People) ShowB() { f
阅读全文
摘要:map 简介 golang的map主要是基于hash-bucket实现 demoMap:=make(int,len) type hmap struct { // Note: the format of the hmap is also encoded in cmd/compile/internal/
阅读全文
摘要:golang-epoll模型源码解析 epoll epoll is an io multipexing model in linux env. epoll generate epoll table. A new socket will be put into epoll table after bi
阅读全文
摘要:mutex 排队规则 正常模式 一个g尝试获取锁失败后,会自旋一定次数,失败后加入队列(fifo) g1出队后要和自旋的g竞争,但大概率获取不到,因为自旋g处于运行状态,不需要上下文切换 g1竞争mutexh失败后会重新加入队列头 饥饿模式 进入条件:当一个g获取mutex 等待时间 > 1ms,m
阅读全文

浙公网安备 33010602011771号