我自己运行了,出现了些错误,但我分析觉得没什么问题啊  请各位高手指教下哦 谢谢先!

处理器调度中负责入队出队工作的功能模块称为队列管理模块,假设采用单向连接:
考虑一个进程的进队
程序如下:
#include<malloc.h>
#include<stdio.h>
#include<sting.h>
#define null 0
#define LEN sizeof(struct table)
struct table
{ char name;
  struct table *next;
};
int n;
struct table *creat(void)            /*定义函数,建立链表*/
{struct table *head;
struct table *p1,*p2;
n=0;
printf("Input the table:\n");
p1=p2=(struct table *)malloc(LEN);    /*新建一个结点*/
scanf("%c",&p1->name);
head=null;
while(p1->name!=' ')  /*本循环完成链表结点的添加过程*/
{n=n+1;
if(n==1)head=p1;   /*头指针指向链表首结点*/
else p2->next=p1;   /*P2指针新建结点P1,即将P1链到尾结点P2后*/
p2=p1;
p1=(struct table *)malloc(LEN);
scanf("\n%c",&p1->name);
}
p2->next=null;
return(head);
}

void print(struct table *head)    /*输出链表*/
{struct table *p;
printf("\nThe table is:\n");
p=head;
if(head!=null)
do{printf("%c\n",p->name);
   p=p->next;}
while(p!=null);
}


void main()
{struct table *p,*s,*h;
int i=1;
p=h=creat();
while(p->name!='x')
    p=p->next;
if(p!=null)
{s=(struct table *)malloc(sizeof(struct table));
   s->name='y';
   s->next=p->next;
   p->next=s;
}
else printf("It is not exist!");
  print(h);
}


再考虑一个进程的出队
程序如下:
#include<malloc.h>
#include<stdio.h>
#include<sting.h>
#define null 0
#define LEN sizeof(struct table)
struct table
{ char name;
  struct table *next;
};
int n;
struct table *creat(void)            /*定义函数,建立链表*/
{struct table *head;
struct table *p1,*p2;
n=0;
printf("Input the table:\n");
p1=p2=(struct table *)malloc(LEN);    /*新建一个结点*/
scanf("%c",&p1->name);
head=null;
while(p1->name!=' ')  /*本循环完成链表结点的添加过程*/
{n=n+1;
if(n==1)head=p1;   /*头指针指向链表首结点*/
else p2->next=p1;   /*P2指针新建结点P1,即将P1链到尾结点P2后*/
p2=p1;
p1=(struct table *)malloc(LEN);
scanf("\n%c",&p1->name);
}
p2->next=null;
return(head);
}

void print(struct table *head)    /*输出链表*/
{struct table *p;
printf("\nThe table is:\n");
p=head;
if(head!=null)
do{printf("%c\n",p->name);
   p=p->next;}
while(p!=null);
}

void main()
{ struct table *p,*q,*h;
  char temp;
  h=p=q=creat();
  printf("Please input the node:");
  temp='c';
  while(p!=null)
  {if(p->name!=temp)
    {q=p;
     p=->next;
     found=0;}
   else {found=1;break;}
  }
  if(found)
  {q->next=p->next;
   print(h);}
  else printf("It is not exist!");
}


处理器调度
1、优先算法。每一个进程给出一个优先数,处理器调度每次选择就绪进程中优先数最大者,让它占用处理器运行。
程序如下:
#include<malloc.h>
#include<stdio.h>
#include<sting.h>
#define null 0
#define LEN sizeof(struct table)
struct table
{int key;
  int priority;
  char condition[10];
  struct table *next;
};
  int n;
  struct table *creat(void)          /*定义函数,建立链表*/
  {struct table *p1,*p2;
   n=0;
   p1=p2=(struct table *)malloc(LEN);
   scanf("%d,%d",&p1->key,&p1->priority);
   gets(p1->condition);
   head=NULL;
   while(p1->key!=0)
   {n=n+1;
     if(n==1)head=p1;
    else p2->next=p1;
    p2=p1;
    p1=(struct table *)malloc(LEN);
    scanf("\n%d,%d",&p1->key,&p1->priority);
    get(p1->condition);
   }
     p2->next=NULL;
     return(head);
   }
void print(struct table *head)             /*输出链表*/
  {struct table *p;
   printf("\n The table is:\n",n);
   p=head;
   if(head!=NULL)
     do{printf("%d,%d,%s\n",p->key,p->priority,p->condition);
       p=p->next;
     }
   while(p!=NULL);
  }

  void main()
{ int j,k;
  struct table *head,*q,*q1,*q2,*q3;
  printf("The table is:\n");
  head=q=q1=q2=creat();
  print(head);
{while(q!=NULL)
  {if(q->comdition=="ready")
    while(q2->next!=NULL)
      {q3=q2->next;
       if(q2->priority>q3->qriority)
        {j=q3->priority;
         k=q3->key;
          q3->priority=q2->priority;
          q3->key=q2->key;
          q2->priority=j;
          q2->key=k;
        }
       q1=q2;
       q2=q2->next;
      }
      q=q->next;
      printf("%d,%d,%s\n",q->key,q->priority,q->condition);
   }
}
}


存储管理
固定分区存储
     主存分配表以单链表的形式存储,将结点设为包含三个域的结构体,三个域分别记录该区域的长度、占用工作名和指向下一个结点的指针。
     分配时,顺序查找主存分配表,找到一个长度大于要分配的作业长度,并且未被占用的空闲区域,将该区域的占用工作名栏填上要分配的工作名。
     去配时,只需将主存分配表中相应分区的占用工作名栏里填上“NIL”即可。
程序如下:
#include<malloc.h>
#include<stdio.h>
#include<sting.h>
#define null 0
#define LEN sizeof(struct table)
struct table
{int length;
  char name[10];
  struct table *next;
};
  int n;
struct table *creat(void)          /*定义函数,建立链表*/
{struct table *head;
   struct table *p1,*p2;
   n=0;
   printf("Input the table:\n");
  p1=p2=(struct table *)malloc(LEN);
  scanf("%d",&p1->length);
  gets(p1->name);
  head=NULL;
  while(p1->length!=0)
  { n=n+1;
    if(n==1)head=p1;
    else p2->next=p1;
    p2=p1;
    p1=(struct table *)malloc(LEN);
    scanf("\n%d",&p1->length);
    gets(p1->name);
  }
    p2->next=NULL;
    return(head);
}


void print(struct table *head)        /*输出链表*/
{struct table *p;
    printf("\n The table is:\n");
    p=head;
    if(head!=NULL)
    do{printf("%d,%s\n",p->length,p->name)
          p=p->next;}
      while(p!=NULL);
}
   
void main()
{ int i,a;
  struct table *q,*p;
  char workn[10];
  char kongn[10]="NIL";
  printf("The new work name is:");
  gets(workn);
  printf("It is length is:");
  scanf("%d",&a);/*输入新的工作的长度,工作名*/
  p=q=creat();
  if(q==NULL)
  printf("\n error\n");
  else{while((q->length<a}&&(q->next!=NULL))
            q=q->next;
     if(q->next==NULL)
  {if((q->length>=a)&&(strcmp(q->name,kongn)==0))
    {for(i=1;i<=10;i++)q->name[i]=workn[i];print(p);}
   else printf("Please wait!\n");}
  else{while(strcmp(q->name,kongn)!=0)
       q=q->next;
       for(i=1;i<=10;i++)
       q->name[i]=workn[i];
       print(p);
  }
}
   

[em10][em10][em10][em10][em10]