内容摘自 <<Rust Atomics and Locks>>.
1 release-acquire 和 fence
1.1 拆分
The store of a release-acquire relationship,
a.store(1, Release);
can be substituted by a release fence followed by a relaxed store:
fence(Release);
a.store(1, Relaxed);
类似的, The load of a release-acquire relationship,
a.load(Acquire);
nicolaka/netshoot
$ kubectl run -ti --rm awakening-fong -n cattle-system --image nicolaka/netshoot:v0.8 -- /bin/bash
执行 ip route add 会出错, 如何 privileged?
处理:
securityContext:
privileged: true
无效的: --overrides='{"securityContext": {"privileged": true}}'
nsenter 容器 中执行
使用 netstat -s 检查下是否有丢包统计:
$ netstat -s | grep -E 'overflow|drop'
123 times the listen queue of a socket overflowed
456 SYNs to LISTEN sockets dropped
perfbook 指的是
Is Parallel Programming Hard, And, If So, What Can You Do About It?
pdf 版本可以从如下网址获取:
https://www.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html
5.4.6 Applying Exact Limit Counters
Quick Quiz 5.58: This is ridiculous! We are read-acquiring a reader-writer lock to update the counter? What are you playing at?
答:
这里要强调的是 读锁 允许 多人同时持有,写锁只允许单人持有。 跟 是否进行 读写操作没有必然关系。
Chapter 6 Partitioning and Synchronization Design
一种强制锁范围不重叠的办法。两个单独的双端队列串联在一起,每个队列用自己的锁保护。这意味着数据偶尔会从一个双端队列跑到另一个双端队列。此时必须同时持有两把锁。
awakening-fong: 妙
perfbook 指的是
Is Parallel Programming Hard, And, If So, What Can You Do About It?
pdf 版本可以从如下网址获取:
https://www.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html
5.3.3 的内容如何理解
可以结合如下问题来理解
Quick Quiz 5.33: p.129
Given that globalreserve counted against us in add_count()
, why doesn’t it count for us in sub_count()
in Listing 5.7?
答: awakening-fong: add_count()返回0是失败, 认为是 against. 而不是说 访问锁是 against.
add_count 的局部代码:
9 if (globalcountmax -
10 globalcount - globalreserve < delta) {
11 spin_unlock(&gblcnt_mutex);
12 return 0;
13 }