摘要: 如果把线程安全定义为允许多个goroutine同时去读写,那么golang 的channel 是线程安全的。不需要在并发读写同一个channe时加锁。 阅读全文
posted @ 2021-03-02 16:53 Mr.peter 阅读(3070) 评论(0) 推荐(0)
摘要: 不是线程安全的。在同一时间段内,让不同 goroutine 中的代码,对同一个字典进行读写操作是不安全的。字典值本身可能会因这些操作而产生混乱,相关的程序也可能会因此发生不可预知的问题。 1.什么是map? map是一个可以存储key/value对的一种数据结构,map像slice一样是引用类型,m 阅读全文
posted @ 2021-03-02 16:39 Mr.peter 阅读(4977) 评论(0) 推荐(0)
摘要: 1、准备好一个包含应用程序的Deployment的yml文件,然后通过kubectl客户端工具发送给ApiServer。2、ApiServer接收到客户端的请求并将资源内容存储到数据库(etcd)中。3、Controller组件(包括scheduler、replication、endpoint)监控 阅读全文
posted @ 2021-03-02 14:23 Mr.peter 阅读(2178) 评论(0) 推荐(0)
摘要: 使用debug.Stack() package main import ( "fmt" "runtime/debug" ) func test1() { test2() } func test2() { test3() } func test3() { // 可以通过 debug.PrintStac 阅读全文
posted @ 2021-03-02 09:11 Mr.peter 阅读(2827) 评论(0) 推荐(0)