aboutsummaryrefslogtreecommitdiff
path: root/works/life
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-06-16 20:18:19 +0800
committercrupest <crupest@outlook.com>2021-06-16 20:18:19 +0800
commit213363383b5864d236cfce711920f76a2450de07 (patch)
tree38d3a6c33cb3519a86ac548bf070894a34cd9e26 /works/life
parent60fb578a0202d354b2fdc5cdf86c04fb9d62c729 (diff)
downloadcrupest-213363383b5864d236cfce711920f76a2450de07.tar.gz
crupest-213363383b5864d236cfce711920f76a2450de07.tar.bz2
crupest-213363383b5864d236cfce711920f76a2450de07.zip
import(life): ...
Diffstat (limited to 'works/life')
-rw-r--r--works/life/operating-system-experiment/DeadLockDetectionDemo.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/works/life/operating-system-experiment/DeadLockDetectionDemo.cpp b/works/life/operating-system-experiment/DeadLockDetectionDemo.cpp
index e043161..bea2b43 100644
--- a/works/life/operating-system-experiment/DeadLockDetectionDemo.cpp
+++ b/works/life/operating-system-experiment/DeadLockDetectionDemo.cpp
@@ -1,3 +1,13 @@
+// Demo使用方法:
+// 本程序采用标准C++11代码写成,请使用支持C++11的编译器编译。
+//
+// 程序接受的输入为n个整数对,其中1-10000表示进程,10001及以上表示锁,顺序很重要:
+// 1 10001 -> process 1 is acquiring or waiting for lock 1
+// 10001 1 -> lock 1 is owned by process 1
+//
+// 建议采用重定向输入至文件的方式输入,提供4个典型情况的测试数据。
+//
+
#include <iostream>
#include <unordered_map>
#include <unordered_set>
@@ -50,9 +60,6 @@ bool dfs(
return false;
}
-// 1 10001 -> process 1 is waiting for lock 10001
-// 10001 1 -> lock 10001 is owned by process 1
-
int main() {
std::vector<int> ns;