c实现银行家算法(3)

2025-09-11

操作系统课程里 用C语言实现银行家算法。

struct need /*需求资源数*/

{

int value;

struct need *next;

};

struct path

{

int value;

struct path *next;

};

struct finish

{

int stat;

struct finish *next;

};

int main()

{

int row,colum,status=0,i,j,t,temp,processtest;

struct allocation *allochead,*alloc1,*alloc2,*alloctemp;

struct max *maxhead,*maxium1,*maxium2,*maxtemp;

struct available

*avahead,*available1,*available2,*workhead,*work1,*work2,*worktemp,*worktemp1; struct need *needhead,*need1,*need2,*needtemp;

struct finish *finihead,*finish1,*finish2,*finishtemp;

struct path *pathhead,*path1,*path2;

printf("\n请输入系统资源的种类数:");

scanf("%d",&colum);

printf("请输入现时内存中的进程数:");

scanf("%d",&row);

printf("请输入已分配资源矩阵:\n");

for(i=0;i<row;i++)

{

for (j=0;j<colum;j++)

{

printf("请输入已分配给进程 p%d 的 %c 种系统资源:",i,'A'+j);

if(status==0)

{

allochead=alloc1=alloc2=(struct allocation*)malloc(alloclen);

alloc1->next=alloc2->next=NULL;

scanf("%d",&allochead->value);

status++;

}


c实现银行家算法(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:清单革命

相关阅读
本类排行
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 7

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219