云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 计算机操作系统实验讲义

计算机操作系统实验讲义

  • 62 次阅读
  • 3 次下载
  • 2025/5/2 6:58:17

} }

void main(void){ Read_Initiate();

cout<

for(int i=0;i

cout<

DWORD m_delay=3000; Sleep(m_delay);

cout<<\读入成功\

Allocated_list();

for(i=0;i

Sleep(m_delay);

cout<<\读入成功\

Set_Need();

for(i=0;i

Sleep(m_delay);

cout<<\设置成功\

Read_Request();

cout<<'\\n'<<\第\个进程请求第\类资源\个\cout<<'\\n'<<\读入成功\RUN(); }

注:数组Array[I]表示第I+1个实际意义量需要创建三个txt文本。 1.Initiate.txt文本

3 3 3 2 //共有3类资源,Available[0]=3; Available[1]=3; Available[2]=2 5 //当前系统中有个进程 7 5 3 // Max[0][0]=7 3 2 2 //Max[1][1]=3 9 0 2 2 2 2 4 3 3

2.Allocated_list.txt文本

0 1 0 //Allocation[0][1]=1 2 0 0 3 0 2 2 1 1 0 0 2

3.Request_list.txt文本

Java程序2 import java.util.*; public class Bank {

public static void main(String[] args) {

int process;//定义进程数量 int resource=3;//定义资源种类是3 int[] available;//可利用的资源

int[][] max,allocation,need;//分别是最大的需求数、已分配的资源、需求资源

Scanner scanner=new Scanner(System.in); System.out.print(\请输入进程数>>\process=scanner.nextInt();

System.out.print(\请输入可利用资源向量(已定义3个资源种类)>>\

available=new int[resource]; for (int i = 0; i < resource; i++) { }

System.out.println(\请输入分配矩阵\allocation=new int[process][resource];

available[i]=scanner.nextInt();

for (int i = 0; i

System.out.print(\请输入进程\已分配的资源数>>\

}

System.out.println(\请输入最大需求矩阵\max=new int[process][resource]; for (int i = 0; i

for (int j = 0; j < resource; j++) { }

allocation[i][j]=scanner.nextInt();

System.out.print(\请输入进程\最大需求的资源数>>\

}

need=new int[process][resource]; for (int i = 0; i < process; i++) { }

System.out.println(); /*

* 打印资源分配表 * */

System.out.println(\时刻的资源分配表\

for (int j = 0; j < resource; j++) { }

need[i][j]=max[i][j]-allocation[i][j]; for (int j = 0; j < resource; j++) { }

max[i][j]=scanner.nextInt();

System.out.println(\进程 max\\t\\tallocation\\t need\\t\\tavailable\

System.out.print(\ \

for (int i = 0; i

System.out.print(\ \

for (int i = 0; i

}

System.out.print(\ \

for (int i = 0; i

System.out.print(\ \

for (int i = 0; i

System.out.println();

for (int i = 1; i < process; i++) { System.out.print(\ \ for (int j = 0; j < resource; j++) { System.out.print(max[i][j]+\ \ }

System.out.print(\ \

for (int j = 0; j < resource; j++) { System.out.print(allocation[i][j]+\ }

System.out.print(\ \

for (int j = 0; j < resource; j++) { System.out.print(need[i][j]+\ \ }

\

搜索更多关于: 计算机操作系统实验讲义 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

} } void main(void){ Read_Initiate(); cout<

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com