操作系统进程调度 第2页

              {

                     printf("\n请输入新进程的pid\n");

                     scanf("%d",&jiuxu[NUM1].pid);

                     printf("请输入新进程的优先级\n");

                     scanf("%d",&jiuxu[NUM1].youxian);

                     printf("请输入新进程的大小\n");

                     scanf("%d",&jiuxu[NUM1].daxiao);

                     NUM1++;

              }

       }

}

 

//新建进程。

 

void run()

{

       printf("\n现在正在运行的进程的资料如下:\n");

       printf("PID码为:%d;\n优先级为:%d;\n大小为:%d.",cpu.pid,cpu.youxian,cpu.daxiao);

}

 

//查看运行进程。

 

 

void huanchua()

{

       int i,p,m,n,t;

       p=jiuxu[0].youxian;

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

       {

              if(p>jiuxu[i].youxian)

              {

                     p=jiuxu[i].youxian;

              }

       }

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

       {

              if(p==jiuxu[i].youxian)

              {

                     m=cpu.daxiao;

                     cpu.daxiao=jiuxu[i].daxiao;

                     n=cpu.pid;

                     cpu.pid=jiuxu[i].pid;

                     t=cpu.youxian;

                     cpu.youxian=jiuxu[i].youxian;

                     break;

              }

              else continue;

       }

       for(i;i<NUM1-1;i++)

       {

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

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

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

       }

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

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