⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checkdiskqueue_rr.m

📁 3个CPU调度算法的simulation. 分别是Short Job First,High Return Ration Next, Round Robin. 模拟得到R,U,S等重要指标。
💻 M
字号:
function [QDisk,QReady]=CheckDiskQueue_RR(QDisk,QReady,Qlen,GlobalCycle,TB,EndTime)
%disp('=========CheckDiskQueue_RR================');

%very important,since the order in the QReady is important....(FiFo)
%remember, the empty p will have default value Endtime+100, that move them
%to the end of the Queue and not satisfied <=GlobalCycle.
QDisk=sortrows(QDisk,2); 

i=1;
flag=0;

% fprintf('before checking(Time is %d)',GlobalCycle);
%    QDisk 
%    QReady
while i<=Qlen
    if QDisk(i,2)<=GlobalCycle
      newStartFlag=QDisk(i,4);  %remember to save state if you want it to put in the QReady after Out!!!!
      [QDisk,p,rmTime,newStartFlag]=OutQueue4Disk(QDisk,Qlen,EndTime+100,'D'); %move out from QDisk
    
      [QReady,pos]=InQueue3QReady(p,rmTime,newStartFlag,QReady,Qlen,'R');  %move into ReadyQueue
   
      %fprintf('Move the p%d from the QDisk to QReady\n',p);
      flag=1;
    end
  i=i+1;
end

if flag==0
   %disp('Nothing to move from QDisk'); 
end

QDisk=sortrows(QDisk,2); %not important,just make it look good,move the p before empty p
%disp('after checking');
% QDisk 
%    QReady

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -