Documentation ¶
Index ¶
Constants ¶
View Source
const OTHERS = -1
OTHERS 表示信息接收方为其他所有 process
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface { // Update 根据输入参数更新自身的值 Update(int) // Tick 时钟跳动一次,并返回最新的时间值 Tick() int // Now 返回当前的时间值 Now() int }
Clock 是系统的逻辑时钟接口
type Process ¶
type Process interface { // Request 会申请占用资源 // 如果上次 Request 后,还没有占用并释放资源,会发生阻塞 // 非线程安全 Request() }
Process 是进程的接口
type ReceivedTime ¶
type ReceivedTime interface { // Update 更新从 process 接收到的最新时间 Update(process, time int) // Min 返回从各个 process 接收时间的最小值 Min() int }
ReceivedTime 是最新接受时间的操作接口 因为 Rule5(ii) 需要用到最小的接受时间
type RequestQueue ¶
type RequestQueue interface { // Min 返回最小的 Timestamp 值 Min() Less // Push 把元素加入 RequestQueue 中 Push(Less) // Remove 在 RequestQueue 中删除 Less Remove(Less) // String 输出 RequestQueue 的细节 String() string }
RequestQueue 提供了操作 request queue 的接口
Click to show internal directories.
Click to hide internal directories.