实验6 银行家算法避免死锁.docVIP

  • 19
  • 0
  • 约 17页
  • 2017-02-01 发布于重庆
  • 举报
实验6 银行家算法避免死锁

实验一.实验目的二.实验内容步骤P0 P1 P2 P3 P4 #define m 3 #define n 5 main(){ int test(int av[],int ned[],all[]); int available[m]={0,0,0},need[n][m]; int allocation[n][m]={{0,1,0},{2,0,0},{3,0,3},{2,1,1},{0,0,2}};//已占有资源 int i,j,g=1; int finish[n]={0,0,0,0,0};//已完成的进程 clrscr();//清屏 printf(“please input the need resource data\n”); for(i=0;in;i++) for(j=0;jm;j++) scanf(“%d”,need[i][j]);//输入各个进程需要的资源 j=0; do{ for(i=0;in;i++) if(finish[i]==0 test(need[i],available,allocation[i])) finish[i]=1; j++; }while(jn); for(i=0;in;i

文档评论(0)

1亿VIP精品文档

相关文档