操作系统
文章平均质量分 82
非洲野生猿
这个作者很懒,什么都没留下…
展开
-
银行家问题
#include "iostream.h" #include "windows.h" const int N=5,M=3; //int Max[N][M]={0};//各进程所需各类资源的最大需求 //int Available[M]={0};//系统可用资源 //int Allocation[N][M]={0};//系统已分配资源 int Max[N][M]={{7,5,3}转载 2016-10-23 18:37:00 · 344 阅读 · 0 评论 -
利用Swap指令进程互斥实现
这里用线程来模拟 硬件方法同步机制的Swap方法指令 利用下面的代码 能有效的实现进程互斥 但当临界资源忙碌时其他访问进程 必须不断测试 处于一种忙等状态 不符合让权等待 造成处理机时间的浪费 同时很难用于解决复杂的进程问题 #include "iostream.h" #include "windows.h" const int N=5,M=3; //int Max[N][M]={0原创 2016-10-24 22:47:50 · 5307 阅读 · 0 评论 -
进程通信——pipe_server
#include "stdafx.h" #include char Input[50]={0}; char Output[50]={0}; DWORD ReadByte,WriteByte; BOOL rc; int err; int _tmain(int argc, _TCHAR* argv[]) { HANDLE hPipe; hPipe = CreateNamedPi原创 2016-11-13 21:45:06 · 510 阅读 · 0 评论