全文预览

2017年冬季 银行家死锁避免算法大作业

上传者:读书之乐 |  格式:doc  |  页数:15 |  大小:136KB

文档介绍
nue;Р }Р?}Р?Р?Р}Рvoid print()Р{Р?int i,j;Р?printf(" 资源 Work Need\tAllocation\tWork+Allocation\t Finish\n\n");Р?printf(" 进程名 A B C A B C \t A B C \t A B C\n");Р?printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");Р?for(i=0; i<N; i++)Р?{Р printf(" %c ",processname[sequence[i]]);Р for(j=0; j<M; j++)Р {Р printf("%d ",Work[sequence[i]][j]);Р }Р printf(" ");Р for(j=0; j<M; j++)Р {Р printf("%d ",Need[sequence[i]][j]);Р }Р printf(" ");Р for(j=0; j<M; j++)Р {Р printf("%d ",Allocation[sequence[i]][j]);Р }Р printf(" ");Р for(j=0; j<M; j++)Р {Р printf("%d ",Work_Allocation[sequence[i]][j]);Р }Р printf(" ");Р printf("%d",Finish[i]);Р printf("\n\n");Р?}Р}Рint check_distribution(int* p,int k)Р{Р?int i=0;Р?int safe1=0,safe2=0;Р?for(i=0; i<M; i++)Р?{Р if(p[i] <= Need[k][i])

收藏

分享

举报
下载此文档