操作系统进程调度 第4页

              else continue;

       }

}

void huanchue()

{

       int i,p;

       printf("\n请输入想要调入就绪的进程的PID:\n(在以下中选:");

       for(i=0;i<NUM2;i++)

       {

              printf("%d ",guaqi[i].pid);

       }

       printf(")\n");

       scanf("%d",&p);

       for(i=0;i<NUM2;i++)

       {

              if(p==guaqi[i].pid)

              {

                     jiuxu[NUM1].daxiao=guaqi[i].daxiao;

                     jiuxu[NUM1].pid=guaqi[i].pid;

                     jiuxu[NUM1].youxian=guaqi[i].youxian;

                     break;

              }

              else continue;

       }

       NUM1++;

       for(i;i<NUM2;i++)

       {

              guaqi[i].daxiao=guaqi[i+1].daxiao;

              guaqi[i].pid=guaqi[i+1].pid;

              guaqi[i].youxian=guaqi[i+1].youxian;

       }

       NUM2--;

}

 

//交换进程的原码。

 

 

void huanchu()

{

       int a;

       printf("请你选择需要的交换方式:\n");

       printf("1.将优先级高的进程调入CPU执行.\n");

       printf("2.手动将进程挂起.\n");

       printf("3.将挂起的进程按先如先出的方式调入就绪队列.\n");

       printf("4.手动将就绪进程调入CPU执行.\n");

       printf("5.手动将挂起的进程调入就绪队列.\n");

       scanf("%d",&a);

       switch(a)

       {

       case 1: huanchua();break;

       case 2: huanchub();break;

       case 3: huanchuc();break;

       case 4: huanchud();break;

       case 5: huanchue();break;

       default:break;

       }

}

 

//换入换出实现函数。

 

void del()

{

       int i,p;

       printf("\n请输入想要删除的进程的PID:\n(在以下中选:");

       for(i=0;i<NUM2;i++)

       {

              printf("%d ",guaqi[i].pid);

       }

       printf(")\n");

       scanf("%d",&p);

       for(i=0;i<NUM2;i++)

       {

              if(p==guaqi[i].pid)

              {

                     for(i;i<NUM2;i++)

                     {

                            guaqi[i].daxiao=guaqi[i+1].daxiao;

                            guaqi[i].pid=guaqi[i+1].pid;

                            guaqi[i].youxian=guaqi[i+1].youxian;

                     }                  

                     NUM1--;

上一页  [1] [2] [3] [4] [5] [6] 下一页

  • 上一篇文章:
  • 下一篇文章:
  • Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有