第一范文网 - 专业文章范例文档资料分享平台

计算机操作系统实验讲义

来源:用户分享 时间:2025/5/30 21:38:33 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

} }

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]+\ \ }

\

搜索更多关于: 计算机操作系统实验讲义 的文档
计算机操作系统实验讲义.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c4aery6k2lp8uhsn07rq1_5.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top