Lab 5
Lab 5
#include<stdio.h>
int main() {
/* array will store at most 5 process with 3 resoures if your process or
resources is greater than 5 and 3 then increase the size of array */
if (terminate == (p - 1)) {
printf("safe sequence does not exist");
break;
}
}
if (terminate != (p - 1)) {
printf("\n available resource after completion\n");
for (i = 0; i < c; i++) {
printf("%d\t", available[i]);
}
printf("\n safe sequence are\n");
for (i = 0; i < p; i++) {
printf("p%d\t", safe[i]);
}
}
return 0;
}
OUTPUT:
Enter the number of process and resources5 3
enter allocation of resource of all process 5x3 matrix
010
200
302
211
002
enter the max resource process required 5x3 matrix
753
322
902
322
222
enter the available resource3 3 2