全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Safe state, banker’s algorithm, deadlock detection?

又称: safe state · banker's algorithm · deadlock detection

Definition 13.6 University Computer Science — Year 3 · 第 13 章 — Concurrency: Deadlock, Monitors and Lock-Free Structures

Each thread ii declares a maximum claim; it holds alloci\mathit{alloc}_i and may still ask for needi\mathit{need}_i, the claim minus what it holds; available\mathit{available} is what nobody holds. A state is a safe state if there is an order of the threads in which each can be given its whole need\mathit{need} from what is available plus what the threads before it have returned, then finish and return everything. The banker’s algorithm grants a request only if the state after granting it is safe, and otherwise makes the thread wait. Deadlock detection lets threads request freely, and from time to time searches for a set of threads deadlocked in the current state, to break the deadlock by killing or rolling back one of them.

在原文中阅读 →