Os Lab - 9
Os Lab - 9
Os Lab - 9
Gunda Laxmisai
21MIS7119
Code:
#include <stdio.h> int
main()
int n, m, i, j, k;
n = 5;
m = 3;
int alloc[5][4] = { { 2, 0, 1, 2 },
{ 1, 0, 0, 0 },
{ 1, 3, 5, 4 },
{ 0, 6, 3, 2 },
{ 0, 0, 1, 4 } };
int max[5][4] = { { 2, 0, 5, 2 },
{ 1, 7, 5, 0 },
{ 2, 3, 5, 6 },
{ 0, 6, 5, 2 },
{ 0, 6, 5, 6 } };
int avail[4] = { 4, 5, 2, 2 };
{ f[k] = 0;
int y = 0; for (k = 0;
0; i < n; i++) { if
(f[i] == 0) {
int flag =
0; for (j =
0; j < m; j++) {
if (need[i][j] >
avail[j]){
flag = 1;
break;
if (flag == 0)
{ ans[ind++] = i;
f[i] = 1;
int flag = 1;
for(int i=0;i<n;i++)
{ if(f[i]==
0)
flag=0;
break;
if(flag==1)
return (0);
}