#include "malloc.h"
#include "stdio.h"
#include "stdlib.h"
#define alloclen sizeof(struct allocation)
#define maxlen sizeof(struct max)
#define avalen sizeof(struct available)
#define needlen sizeof(struct need)
#define finilen sizeof(struct finish)
#define pathlen sizeof(struct path)
struct allocation
{
int value;
struct allocation *next;
};
struct max
{
int value;
struct max *next;
};
struct available /* */������Դ��
{
int value;
struct available *next;
};
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("please input the kinds of resourse:");
scanf("%d",&colum);
printf("please input the total number of the progress in the memory:");
scanf("%d",&row);
printf("please input the matrix of resourses that has allocated :");
for(i=0;i<row;i++)
{
for (j=0;j<colum;j++)
{
printf("Please input the number of system resources %c that has been
allocated to process p%d:",'A'+j,i);
if(status==0)
{
allochead=alloc1=alloc2=(struct allocation*)malloc(alloclen);
评论11