熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> 操作系統 >> 正文

十大題型算法全實現——(八)作業調度[6]

2022-06-13   來源: 操作系統 

  jobs[p]wait_time=(current_hourjobs[p]reach_hour)*+(current_minutejobs[p]reach_minite)+jobs[p

  ]need_time;

  cout<

  time<

  current_hour=current_hour+(jobs[p].need_time+current_minute)/60;

  current_minute=(jobs[p].need_time+current_minute)%60;

  jobs[p].visited=1;

  total_time+=jobs[p].wait_time;

  }

  cout<

  }

  //優先數調度算法

  void privilege()

  {

  int i,j,p;

  int current_hour;

  int current_minute;

  int current_privilege;

  int total_time=0;

  //輸出作業流

  cout<

  cout<

  cout<<"------------------------------------------------------------------------"<

  cout.setf(2);

  cout<1)"<

  current_hour=jobs[quantity-1].reach_hour;

  current_minute=jobs[quantity-1].reach_minite;

  for(i=0;i

  current_privilege=30000;

  for(j=0;j

  if((jobs[j].visited==0)&&(jobs[j].privilege

  p=j;

  current_privilege=jobs[j].privilege;

[1]  [2]  [3]  [4]  [5]  [6]  [7]  [8]  [9]  


From:http://tw.wingwit.com/Article/program/czxt/201311/24014.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.