English Chinese (Simplified) (zh_CN)
Locking Notes 内核中的锁
Mutexes Mutex
A mutex is simply a lock used to guarantee mutual exclusion. Specifically, a mutex may only be owned by one entity at a time. If another entity wishes to obtain a mutex that is already owned, it must wait until the mutex is released. In the FreeBSD kernel, mutexes are owned by processes. Mutex就是一种用来解决共享/排它矛盾的锁。 一个mutex在一个时刻只可以被一个实体拥有。如果另一个实体要获得已经被拥有的mutex, 就会进入等待,直到这个mutex被释放。在FreeBSD内核中,mutex被进程所拥有。
Each mutex has several properties of interest: 每个mutex有几个令人感兴趣的属性:
Variable Name 变量名
Logical Name 逻辑名
Type 类型
A sleep mutex 一个睡眠 mutex
A spin mutex 一个循环 mutex
This mutex is allowed to recurse. 这个 mutex 允许递归。
Protectees 保护对象
Dependent Functions 依赖函数
Functions that can only be called if this mutex is held. 仅当mutex被持有时才可以被调用的函数。
Mutex List Mutex列表
Shared Exclusive Locks 共享互斥锁
Shared Exclusive Lock List 共享互斥锁列表
Atomically Protected Variables 原子保护变量